daftar isi final

3 downloads 0 Views 335KB Size Report
Keywords: micro-controllers, cellular phones, missed call, SMS. *Corresponding Author. E-mail : jazi@ugm.ac.id. 1. Introduction. This paper presents a design ...
nd

2 Jogja International Physics Conference “Enhancing Network and Collaboration Developing Research and Education in Physics and Nuclear Energy” September 6-9, 2007, Yogyakarta-Indonesia

A DC Motor Control Based-On Cellular Phone Jazi Eko Istiyanto1* and Ferry Wahyu Wibowo1 1 Electronics and Instrumentations Laboratory Physics Department Gadjah Mada University – Yogyakarta INDONESIA 55281 Abstract A design and an implementation of a DC motor control built around micro-controller and cellular technology have been completed. The system is hosted by an AT89S51 micro-controller connected to a DC motor, a rotation counter, and a cellular phone. The user holding another cellular phone can request the number of rotations by dialing the cellular phone attached to the micro-controller. The first dial serves as an authorization and the second triggers the system to send an SMS (Short Message Service) message containing the number of DC motor rotations. The system has been tested and has shown an error rate of 3.19 % in the average counting. Keywords: micro-controllers, cellular phones, missed call, SMS *Corresponding Author. E-mail : [email protected]

constructing codes understandable by the cellular phone's electronics. Although, in theory, most AT commands are the same for different handsets, in reality there are differences. Data transferred to/from the SMS center can be of the PDU (Protocol Data Unit) format. The PDU contains hexadecimal numbers representing headers. The PDU consists of eight headers: the SMS center, the SMS type, the SMS reference number, the receiver’s cell phone number, the SMS form, the data encoding, the expiry date, and the SMS content (leBodic, 2002).

1.

Introduction This paper presents a design and an implementation of a device to control a DC motor using a cellular phone. The cellular phone used is a Siemens SL45. SL45 communicates with the DC motor via a microcontroller AT89S51. An engineer holding a cellular phone sends a missed call to SL45. Missed calls are differentiated based on the number of RINGs before the call is cancelled by the caller and before the callee accepts the call. Because the callee is unmanned, the missed call is fully controlled by the caller. The device responds to the eingineer's commands by sending an SMS. At present, the SMS contains only the rotation per second at which the motor rotates. The commands from the engineer is based on the number of RINGs before the call stops. This work has been inspired by the work of Serasidis (www.serasidis.gr) in which a Sony Erricson and a microcontroller are used to turn a set of lamps on/off. Our initial work uses a Siemens and a microcontroller to turn a set of LEDs on/off (Istiyanto and Effendy, 2005). We then designed many devices based on the same principle.

2.2. AT89S51 Microcontroller The MCS-51 family of micro-controllers was first built by Intel. The AT89S51 single chip micro-controller is a hardware device equipped with special facilities and a set of instructions making it a stable and effective controller delivering precision computation, communication and industrial application.

2. A Brief Theory 2.1 AT Command 2x AT commands can be tested via Windows Hyperterminal or using a software called serial watcher. To convert a text to a PDU code or vice versa, a software called PDUSpy can be used. AT Command is similar to >(prompt) tag in the DOS command. In the cellular phone, AT Command 2x is responsible for message processing i.e. sending/receiving data to/from SMS center by

EI072

nd

2 Jogja International Physics Conference “Enhancing Network and Collaboration Developing Research and Education in Physics and Nuclear Energy” September 6-9, 2007, Yogyakarta-Indonesia

h.

i. j.

(external EPROM) EA/VPP (External Access Enable) (pin 31): to access internal program memory, the EA pin must be connected to VCC+5 VDC and to access external program memory, the EA pin must be connected to ground (GND) XTAL1 (pin 18) : an input pin to internal oscillator circuit XTAL2 (pin 19) : an output pin to internal oscillator. It is only used with the crystal oscillator.

The MCS-51 family consists of many registers, such as: a. The accumulator (ACC): an 8-bit general purpose register used to accumulate the results of instruction executions. b. The register R and B: The register R consists of a set of eight auxiliary registers R0, R1…, R7. The register B is similar to the accumulator in the sense that it stores a value of 8-bit (1 byte) of data. c. DPTR, PC, and SP The data pointer (DPTR) is a 16-bit register composed of the register DPH (Data Pointer High Order Byte) and the register DPL (Data Pointer Lower Order Byte). DPTR is used to address the registers in an indirect way to move the content of a program memory, to move data variable from/to the outside of data memory such as the external RAM, and also used for the jump to a 64 Kbyte address instructions. Program Counter (PC) is a 16-bit register used to address the location of program instruction stored in the ROM. Stack Pointer (SP) is used to point to an address of internal RAM known as the top of the stack. d. Program Status Word Register: four flag registers used in arithmetic operation. These are carry (CY), auxiliary carry (AC), parity (P) and user flags (F0). e. Serial Buffer (SBUF): two separate registers used as the receive buffer and the transmit buffer registers. f. Timer/Counter Register: 16-bit timer high (TH) and a timer low (TL) registers used in four modes of counting.

Figure 1. AT89S51 micro-controller Pins Configuration The AT89S51 micro-controller has specific facilities such as a CMOS 8-bit optimized for control applications, 4Kbytes of Flash PEROM, which has fully static operation between 0-33 MHz, and can be written and erased until 1000 times, 128 x 8-bit internal memory (RAM), two 16-bit timer/counters, six interrupt sources, programmable serial ports, and 32 programmable I/O lines. The AT89S51 micro-controller is one of MCS-51 micro-controller family which has 4Kbytes of Flash PEROM in 40-pin package with single a power supply (Figure 1). The pin assignment of the AT89S51 microcontroller and the functions are: a. VCC (pin 40) : a +5 VDC power supply b. GND (pin 20) : the ground c. Port 0 (pins 32-39), port 1 (pins 1-8), and port 2 (pins 21-28): 8-bit bi-directional I/O ports. d. Port 3 (pins 10-17): 8-bit bi-directional I/O port which can be used also for specific function such as serial input/output, external interrupt inputs, input to a counter, and external memory write/read signals. e. RST (pin 9): an active-high reset pin. f. ALE/PROG (Address Latch Enable) (pin 30): used to hold the low-byte address during external memory access and a program signal during the Flash programming. g. PSEN (Program Store Enable) (pin 29): used to control external program memory

2.3. The DC Motor A DC motor is a device capable of converting electrical energy into mechanical energy. A direct current is converted into electrical energy via a two-magnet interaction. The first EI073

nd

2 Jogja International Physics Conference “Enhancing Network and Collaboration Developing Research and Education in Physics and Nuclear Energy” September 6-9, 2007, Yogyakarta-Indonesia

is the rotor (the rotating part) which consists of coils. The second is the stator (the stationary part) i.e. magnet. A DC motor follows the law of electromagnetism: if the coils of the rotor carry an electric current then the coils become a magnetic field. The coils experience a force that makes them rotating.

the counter is not zero, then it is a missed call and the system process the missed call. Some of the advantages of using miscalls compared to SMS or voice calls are (among others) - a miscall is free of charge - a missed call is real-time (synchronous), unlike SMS which is off-line (asynchronous). The delivery success of an SMS is dependent on the communication traffic. - SMS requires a large amount of storage in the micro-controller's memory before a processing stage is carried out. A missed call uses an interrupt address. - It is much faster to dial a missed call compared to preparing an SMS.

3. The System Design 3.1 The Hardware Design The design of the device can be illustrated in Figure 2.

However, a missed call system does have some disadvantages: - Sometimes the ringing signal is not detected by the callee. - counting the number of 'RING's is a little bit tricky.

Figure 2. The Hardware Block Diagram

3.3. The Hardware and Software in Execution Immediately after the power is ON, the micro-controller turns the motor OFF via the software and clears the content of register R0. When cellular phone B receives an interrupt indicating a missed call, the signal will be detected by micro-controller as 'RING'. Communication between cellular phone B and the micro-controller is done by the RS232 circuitry in which EIA232 signals are converted into +5V TTL signals. Upon detecting a 'RING', the microcontroller activates the looping and setting R0 to 1. Then the micro-controller will delay for 1 minute 3,75 seconds and turn the serial interrupt line off. For delay time, the 'RING' or miscall input always counted at register R0. If R0 is equal to 2 then the micro-controller will instruct the cellular phone to dial the destination number for 10 seconds and then close the communication. If R0 does not equal to 2 then the micro-controller keeps looping. The cellular phone A is the one that choose whether to 'RING' once, twice, thrice, etc. before cancelling the call. Of course, the number of times the 'RING' can be done is dependent on the cellular operator. When the port P1.0 is high, the transistor C9014 will saturate until the collector current flows via the 330-ohm

The cellular phone A will send a missed call signal to the cellular phone B. The cellular phone B will respond and send it to the RS232 circuitry. The RS232 circuitry is a cellular phone data cable and an IC MAX232 functioning as a driver to convert a signal to a TTL(transistor-transistor logic) level voltage. The system is powered by a power supply (CATU DAYA). 3.2 The Software Design The DC motor controlling program is stored in the AT89S51 micro-controller's internal ROM. The software is writen in the assembly language. Initially, the program is written and assembled on the PC. Then, a down-loader program is used to embed the program into the micro-controller. The system is programmed to repeatedly process an incoming miscall. A miscall is a call intentionally dropped by the caller before it is accepted by the callee. An incoming missed call will trigger an interrupt to the micro-controller. In an experiment using the MS Windows HyperTerminal has shown that an incoming call displays the word 'RING'. Therefore, the system will detect the present the word “RING' . When the word is detected then it is not a missed call. Therefore the system will increment a counter and loop back again. When the word is not detected and EI074

nd

2 Jogja International Physics Conference “Enhancing Network and Collaboration Developing Research and Education in Physics and Nuclear Energy” September 6-9, 2007, Yogyakarta-Indonesia

resistor directly to the ground. The transistor BD139 is not biased at its base and cuts off stopping the motor current and the motor rotation. If P1.0 is low then the transistor C9014 cuts off and the 330-ohm resistor current flows not to the ground but to the base causing the BD139 to saturate and motor current will flow and activate the DC motor. To stabilise a diode IN4002 is used to prevent a reverse voltage from the motor coils. After the DC motor is activated, the micro-controller counts the number rotations using an opto-coupler input. The pulse train to port T0 is stabilised by an IC74LS14. The counting is done each second to get rotation per second (RPS). The count is stored in address TL0 and converted into ASCII code and latter converted to a PDU code. Converting an ASCII to a PDU is not straightforward. As an example, 00H will be displayed as in the HyperTerminal or in the serial watcher. However, PDU need a zero not a . This can be solved using a DA (Decimal Adjust) instruction in which an 8-bit number is converted into two nibbles. The DC motor control based on cellular phone can be illustrated in Figure 3. The device consists of mainly 3 parts: the cellular phone, the DC motor, and the microcontroller circuitry.

process. 5. References 1. Serasidis, V: an SMS-based Remote Control, http://www.serasidis.gr 2. Istiyanto, J.E., and Yeyen Effendy, 2005 : Rancangan dan Implementasi Pengendali Jarak Jauh Berbasis SMS dan Mikrokontroler, Jurnal Ilmu Dasar, Universitas Negeri Jember (in Indonesian) Jazi Eko Istiyanto completed a Ph.D degree in Electronic Systems Engineering from the University of Essex, UK in 1995. He is the head of the Physics Department, Gadjah Mada University Ferry Wahyu Wibowo holds a B.Sc in Physics from Gadjah Mada University. He is now pursuing an M.Sc in Computer Science at Gadjah Mada University.

Figure 3. The DC Motor Control Based on Cellular Phone 4. Conclusion The prototype system for controlling a DC motor using the cellular phone has been designed, implemented, and tested. There are many practicality aspects not found in textbooks such as the trick to count the number of 'RING's and to convert 00H into PDU format. The device has been tested many times and has shown results consistent with the specification and expectation. An error of 3.19% has been experienced in the counting EI075