94 Abstract— Nowadays the embedded systems such as microcontroller are used to control electrical instrument. To learn microcontroller a student as beginner need a programming knowledge which can be learned easily using an attractive learning method. In this paper we proposed an application which can be used to help students who are interested in learning microcontroller. They can arrange tasks consisted of commands which have to be performed by microcontroller into the column contained the objects of task.
The application will read the objects consisted of tasks, perform the animation of a movement of a stepper motor and make codes of task formatted in String. These codes of task will be sent to the microcontroller to run the stepper motor. The running stepper motor and the animation of running stepper motor can be performed at the same time. The commands which are sent to microcontroller are “turn right”, “turn left”, “turn degree”, “turn to”, “if”, “for” and “delay”.
Keywords— Animation, Microcontroller, Smalltalk Application, Stepper Motor.
I. INTRODUCTION
HIS paper proposed the application developed using Smalltalk language that can send codes of task formatted in String to microcontroller. This application specifically designed for students who will learn to program microcontroller. The objective of developing the smalltalk application is that the students become interest in learning programming and microcontroller.
Many students in school have lack of knowledge in programming and have no interest to learn it because they know that it is difficult to learn a basic programming language. The Smalltalk application that was developed is easy to use for the beginner who will learn programming and microcontroller. The user can use the commands which can run a stepper motor. The Smalltalk application displays the animation of the movement of stepper motor. By pressing the “Start Button”, computer screen and the stepper motor will perform the tasks at the same time.
The students can make script by clicking and dragging the object of task. The type of task objects are morph objects (morph object is an image). The morph object can be duplicated by clicking the left mouse. The duplicate object can be drag into the script column. There is a parameter of integer type in task objects. The number of rotation of stepper motor will be performed based on parameter of integer type given by student.
II. MATERIAL AND METHODS
The Smalltalk application used to learn programming on microcontroller can be called AvrObject application which has
Main Menu Object, Task Object, Drag Object, Script Layout, Animation Screen, Arrow, Start Button, and Download Button.
Fig. 1 Use Case Diagram of AvrObject Application
Fig. 1 shows the use case diagram of the application. User can open the application, make a script by clicking and dragging, make the script, run the animation, download the script into Arduino and close the application. AvrObject
application is developed using Squeak development tool and morph project [1]. The following pseudo code is used to initialize global instance variables which can be used by other class.
SMALLTALK APPLICATION - LEARNING
PROGRAMMING ON MICROCONTROLLER
FOR BEGINNER
Meyhart Sitorus
1, Saptadi Nugroho
2, Deddy Susilo
395 Morph subclass: #Avrobject
instanceVariableNames: 'mainMenu taskMenu scriptLayout animationScreen startButton downloadButton trashCan'
classVariableNames: '' poolDictionaries: '' category: 'Avrobject-Main'
Morph subclass: #ScriptLayout
instanceVariableNames: 'label' classVariableNames: ''
poolDictionaries: '' category: 'Avrobject-Main'
Morph subclass: #DownloadButton
instanceVariableNames: 'port' classVariableNames: ''
poolDictionaries: '' category: 'Avrobject-Main'
A new instance variable is declared as private instance variable which cannot be accessed directly by other class. The
accessor functions can be used to access the instance variable from other class [1]. This function is similar to the getter and
setter method used in programming with Java language. The electronic devices which are used in learning programming of microcontroller are Arduino Uno R3, steeper motors 28BYJ-48 5 Volt and driver stepper motors ULN2003. The USB cable is used to send the task formatted String from personal computer to Arduino Uno R3. The following figure of Fig. 2 is the system which consist of AvrObject application Arduino, driver motor and stepper motors.
Fig. 2 Diagram of the System
Library of functions used to move the stepper motors based on the command given by the user are embedded in the microcontroller. These functions will be run when the microcontroller retrieve the sequence of characters which represents the task made by user. These characters indicate the tasks such as rotateRight, rotateLeft, turnDegrees, and
turnTo[2].
Arduino will send the binary codes to driver motor as shown in Fig. 3. The binary codes will be forwarded by driver motor to the stepper motor to rotate motor. All objects which was made will be added into AvrObject. The command in the source code program shown in Fig. 4 is used to open
AvrObject. This code is written in Smalltalk language [3].
Fig. 3 Command to open Avrobject
Fig. 4 The command used to open AvrObject
(a)
Fig. 5 The learning module (a) front – side (b) top – side
Fig. 5 shows the module of Arduino, driver motor and stepper motor which was implemented to support the
96
Fig. 6 Avrobject User Interface
97 Fig. 6 shows the user interface of the AvrObject application. The task objects consist of X, Motor1, Motor2, Turn Left, Turn Right, Turn Degree, Turn To, If, For, Close, Delay. The script layout in Fig. 6 is used to put the tasks object made by user.
Fig. 7 shows the class diagram of the AvrObject application and association between classes.
Fig. 8 shows the learning module which is connected to the personal computer that has the installation of AvrObject
application.
Fig. 8 The learning module and personal computer
III. RESULT AND DISCUSSION
The Avrobject application and module are tested by giving a single command to display the animation of stepper motor. The initial degree of application and stepper motor hardware is set to 0o. Two objects of DragObject are place inside the
ScriptLayout. The objects describe the motor object and the task object. The Table I show the result of the testing of the application. The tasks Turn Right, Turn Left, Turn Degree and Turn To were performed successfully by the animation.
The sequence of characters is transmitted from personal computer to microcontroller using tool of “Serial Monitor”. The data is transmitted when stepper motor hardware is set to 0o.
The tasks Turn Right, Turn Left, Turn Degree and Turn To were performed successfully by the motor stepper as shown in Table II.
TABLEI
TESTING OF AVROBJECT APPLICATION
Motor Given implemented using this application. The sequence of characters which are transmitted from personal computer to microcontroller is used to run the wiper to the top position and the bottom position. The following figure of Fig. 9 (a) shows
98 The Fig. 9 (b) shows the script layout of the clock application. This analog clock application is used to test the looping function that is done successfully.
REFERENCES
[1] A. P. Black, Squeak by Example. Kehrsatz, Switzerland: Square Bracket Pub., 2007.
[2] S. Ducasse, Squeak Learn Programming with Robots. Berkeley, CA; New York: Apress; Distributed to the Book trade in the U.S. by Springer-Verlag, 2005.
[3] A. Golberg, Smalltalk-80. Canada: Addison-Wesley,1983
[4] Syahrul, Mikrokontroler AVR ATMEGA 8535. Bandung, Informatka, 2012.