You are on page 1of 5

Long Distance Appliance Control Using Mobile Short Messaging Service and Internet in Parallel

Md. Shafayat Hossain, Ariyan M Kabir, Pratyai Mazumder, Ahmedullah Aziz, Masudul Hasan Quaraishi, Md. Zunaid Baten
Abstract This paper illustrates a secure and reliable system for remotely controlling electrical appliances by Short Messaging Service (SMS) and/or internet. The system requires serial interfacing of two micro-controllers with SIEMENS AX75 cell phone and a personal computer respectively. A microcontroller unit was used to merge the independent subsystems for SMS and internet based control. The micro-controllers were programmed in C and a webpage was created using PHP for internet based controlling. The proposed parallel controlling system incorporates user verification and registration, password protection and RF communication between central controller and the remote receiver segments. The overall scheme offers advantages over so far reported rigid control systems, which involve high cost GSM or GPRS modems. Also the proposed scheme can serve the purpose of appliance controlling in a large scale.

I. INTRODUCTION Automation, reliability and user-friendliness have always been the prerequisites of an efficacious electronic system. In addition to these, a salient propensity to get rid of wires has been prompted in the current epochs. Design and implementation of SMS based control for monitoring systems has been done previously with a processing unit, microcontroller and a communication module that uses GPRS modem via serial port RS-232. The SMS has been used for status reporting such as power failure in this reported scheme [1]. An internet based wireless home automation system for multifunctional devices with the limitations of limited range and power failure has been reported in [2]. Remote monitoring through mobile phone involving the use of spoken commands has also been reported [3]. In this reported scheme, the spoken commands are generated and sent in the form of text SMS to the control system and then the microcontroller on the basis of SMS takes the decision. The underlying limitations in previous approaches are lack of alternative controlling media , no option for large scale controlling and last but not the least, high cost. To overcome the limitations of the previously reported works, in this work parallel remote switching has been done using two most popular means of communication: mobile and internet. In this hardware implemented scheme, a low cost mobile has used instead of the relatively expensive GSM modem use in [4], [5]. In the SMS based control, any electronic appliance can be turned on or off by sending SMS from a pre-registered mobile number. Literally, any device (one or more at a time) can be controlled by a single SMS, as long as the coverage of a mobile network goes. In addition to that, the same appliances can also be controlled over internet. In that case, all that is to be done is to log in to a webpage where a list of all the appliances that can be controlled is available and the appliances can be turned on or off by mouse-clicks. Video surveillance is implemented using internet which enables the user to check the instant status of his residence from his website keeping an active internet connection and a webcam in the PC in the residence. The system is eligible to receive command from both of the sources and take decision accordingly. Two independent systems working in parallel results in a system with improved reliability and ease. If mobile network is unavailable for some reason, internet access will still be possible and vice versa. A cell phone and a Personal Computer (PC) connected to internet at the central unit is enough to establish this system even in a large office or residence. There is no concern of changing the conduit layout and wiring as RF signal will be transferred from the central unit which will contain necessary

commands. Antennas, being placed in every room, will receive the signal and decoders will decode the commands in the RF signal and the appliances will respond to the respective commands. Once installed, this system is simple to access but totally secured. II. SMS BASED CONTROLLING SMS is an easy mean of communication now-a-days. The user has to register his mobile number and then to turn on or off any electrical appliance, he has to send an SMS containing the appropriate commands. User-authentication allows the system to be safe and secured. SMS is received in a mobile in the control module which is connected to an ATMEGA 32 micro-controller unit (MCU) [6] via serial communication using RS-232 protocol. The MCU reads the SMS from mobile using AT commands and checks whether the SMS is received from a registered (valid) user number. Table 1 shows the list of AT commands suitable for serving the purpose and the SMS processing using them is mentioned in Table 2.
Table 1. Command AT ATE0 AT+CMPS=ME,ME,ME AT+CMGR=1 AT+CMGD=1 List of Used AT Commands Purpose Start synchronization. To turn off echo. To select mobile memory for storing message. To read message from index 1. To delete message of index 1.

Table 2. Phone Initialization

SMS handling using AT Commands 1.

Reading and Deleting SMS PDU conversion

AT is sent to the phone. Ok is returned. 2. ATE0 is sent to turn off echo. 3. AT+CMPS=ME,ME,ME sent. 1. To make sure the new SMS will be stored at index 1, any existing text at index 1 is deleted by sending AT+CMGD=1. 2. To read SMS at index 1, microcontroller sends AT+CMGR=1. PDU is a compressed and encrypted SMS format for fast transmission. SMS is converted from PDU to ASCII for our purpose.

SMS from invalid users are deleted without taking any other action. There is an option for user registration too. In the case of user registration it checks the password and if it matches with the password in the database, the number is added in the valid user list. SMS from valid user is analyzed and desired appliance states in the desired rooms are found out. Then the data is sent to the control hub along with a confirmation pulse. The algorithm of the working system is presented in Fig. 1 and a simplified block diagram is given in Fig. 2. 1. Begin. 2. Initialize serial port. 3. Wait until any new message is received. 4. Check whether the number from which the SMS is received is authorized. a) If authorized then proceed to next step. b) Else go to step 3. 5. Check if the message matches with any of the predefined actions. a) If matches then convert it to suitable data output signal to control appropriate devices in appropriate rooms. b) Else go to step 3. 6. Send the signal to interface circuits. 7. Check if the signal contains command for quit. a) If yes then proceed. b) Else go to step 3. 8. End.
Figure 1. Algorithm of working sequence of SMS based control

User

Remote PC Connected by Internet

Server PC

MCU & External Hardware to be controlled

Figure 3.

Internet based controlling subsystem

1. Begin. 2. Initialize serial port. (through USB to RS232 converter) 3. Check if the user is authenticated. a) If authenticated then proceed. b) Else repeat this step. 4. Wait until new command has arrived. 5. Convert command to suitable output signal using php. 6. Send the signal to serial port. 7. Convert to a suitable voltage level to be used in microcontroller using MAX232 IC. 8. Convert control word to suitable data output signal to control appropriate devices in appropriate rooms. 9. Send the signal to interface circuits. 10. Check if the signal contains command for quit. a) If yes then proceed. b) Else go to step 4. 11. End.
Figure 4. Algorithm of working sequence of Internet based control

IV. INTERFACING PROCEDURE


Remote User Command by SMS Figure 2. Block diagram of SMS based controlling subsystem Cell Phone Network Control hub MCU Control Module

III. INTERNET BASED CCONTROLLING To control the appliances, the user will give command using a PC. This command will be sent from the remote PC to a sever PC. The microcontroller is connected with the serial port of the remote PC. The microcontroller processes the command signals coming from the PC and it is connected to the control hub. Block diagram of the corresponding system is depicted in Fig. 3. In the remote PC, a software named USB server is kept running. This software allows accessing the remote computer by its IP address. To access the webpage the user must login using his user name and password. Then the state of any appliance in any room can be changed by commands given from the computer. Algorithm of this system is presented in Fig. 4 to explain the sequential processing in internet based control. The desired states of the appliances in the desired room are then sent to the control hub along with a confirmation pulse. The IP based address is not necessary if the user has a personal website. The user can even use his social networking pages like Facebook, Twitter etc.

Serial Interfacing is used for communication between PC and the microcontroller which was previously done with parallel interfacing [7]. Serial communication is more efficient than parallel one. ATMEGA 32 supports Universal Asynchronous serial Receiver and Transmitter (UART) communication [6]. The MAX232 converter [8] allows the microcontroller to communicate with the PC using a standard serial cable and the RS232 serial COM port. In order for the PC and the microcontroller to communicate successfully, some logic level shifting and translation is necessary. The MAX232 converter IC converts 0 and 5 volt Transistor -Transistor Logic (TTL) signals to -12 and 12 volt RS-232 serial COM port signals. As USB to RS-232 converter is cheap and easily available, system can be seamlessly used in laptops without built-in serial port. DB9 connectors are used for serial communication (Fig. 5).

Figure 5. Connection with DB9 connectors

Also in case of interfacing between mobile and microcontroller, UART protocol is used. The phone used for our purpose is Siemens AX 75 which has a data cable supporting serial interfacing. The mobile is connected to the MAX 232 converter which is connected to the microcontroller and does the job of logic level shifting. The circuit diagram for serial communication is shown in Fig. 6.

Each room has an RF receiver module with HT12 decoder [9] with pre-assigned address. The rooms are identifiable with that address. After identifying the room, the control hub assigns the address of that corresponding room to the HT 12 encoder [10] and transmits the encoded control words using RF transmitter as depicted in Fig. 8. Only the corresponding room is able to decode the signal using its decoder as its address is matched with that of the encoder in transmitting the end. The decoded signal is then processed in a MCU which provides ports for connecting the devices as suggested in Fig. 9. If it is necessary to control a very large number of devices, Intel 8255 IC is recommended to use. Total RF networking among the control hub and the rooms is shown as a block diagram in Fig. 10.

Mobile Subsystem

Internet Subsystem Control Hub MCU

Figure 6. Circuit Diagram for ATmega32 serial interface with Siemens AX75

12 bit parallel connections HT 12E Encoder Combining 4 bit data with its 8 bit address Antenna

For both of the subsystems, UART communication is used with 9600 BAUD rate, 8 bit frame size, 1 stop bit and parity mode disabled. V. COMMUNICATION AMONG MOBILE & INTERNET SUBSYSTEMS, CONTROL HUB & ROOMS Both the mobile subsystem and internet subsystem are connected with a central control hub. The MCU in the hub tracks the subsystem from which the control words are coming from with the help of confirmation pulse. Then it processes the control words and finds out the room in which the appliances for which control words are given, are located. Sequential processing is shown in Fig. 7. 1. Begin. 2. Initialize Mobile control subsystem and Internet control subsystem connected with the control hub. 3. Check for confirmation pulse. a) If confirmation pulse is received, then proceed. b) Else repeat this step. 4. Check whether the confirmation pulse is from mobile. a) If confirmation pulse is from mobile, then transmit the command signals coming from mobile subsystem. b) Else then transmit the command signals coming from internet subsystem. 10. Check if the signal contains command for quit. a) If yes then proceed. b) Else go to step 3. 11. End.
Figure 7. Algorithm of Sequential Processing in the Control Hub Figure 9. Figure 8.

RF Transmitter (Tx 433) Sending 12 bit data serially

Control Hub connection for spreading the control signal throughout the controlled area.

RF Receiver (Rx 433) HT 12E Decoder

Antenna

4 bit parallel data Control Unit MCU & 8255 (opt.)

Relays for connecting devices

Block Diagram of a typical receiving end connection e.g. for a single room

Control Hub Receiver unit for a

single room

HT 12 Encoder

RF Transmitter

RF Rx 1

...

RF Rx N

HT 12 decoder

...

HT 12 decoder

MCU & external peripherals (8255) (optional) Room 1 appliances

...

MCU & external peripherals (8255) (optional) Room N appliances Figure 12. Subsystem for Internet based controlling

...

Figure 10.

Block diagram of RF networking from the control hub to the rooms

VI. SYSTEM PROTOTYPE The overall system comprises two individual subsystems for SMS and internet based controlling. Their system prototypes are demonstrated in Fig. 11 and Fig. 12 respectively. The subsystem for SMS based controlling comprises a low cost (1,500 Bangladeshi Taka (BDT)) mobile phone, one 8 bit microcontroller, one serial interface chip and some other low cost components. The total cost for this subsystem is about 2,500 BDT.

The subsystem for internet based control requires one 8 bit microcontroller, one serial interface chip and some other low cost components. So, the cost for this subsystem is very low (about 600 BDT). A computer (or laptop) with active internet connection is required for this subsystem to work. A webpage is designed for internet based controlling. The user can log in using his user name and password and access to the webpage (screenshot of the webpage is shown in Fig. 13) where he can set the status of the electrical appliances.

Figure 13. Screenshot of the designed webpage for internet based controlling

Figure 11.

Subsystem for SMS based controlling

Control hub incorporates another microcontroller, an encoder and an RF transmitter which costs about 1,000 BDT. A single control hub is enough for a large apartment or office. For each room, a simple microcontroller (only to suite the purpose of ports), a decoder and an RF receiver is required having a total cost of 800 BDT per room. Thus, the system implemented offers reasonable cost. All the costs mentioned are according to the price in June 2011.

For video surveillance, a webcam is required which is also not very costly. The designed website has provision for showing the video captured from the home (where the webcam is placed) using live streaming. This system requires small amount of power as it comprises only digital circuitry. But the mobile is to be charged in regular interval and the PC for controlling the devices must be on all the time. VII. SYSTEM TESTING Every part of the system has been tested several times under different circumstances. Firstly, the subsystems for SMS based controlling and internet based controlling are tested separately using locally available GSM and WiMAX network. The systems performed expectedly in all tests. After successful completion of the testing of individual subsystems, total system has been tested incorporating RF communication among control hub and the rooms. The designed system has passed all the tests and it is fully implemented in a house (belonging to a co-author Ahmedullah Aziz) now. VIII. FUTURE WORK The implemented system is a state of art long distance appliance control scheme. It has scope for further improvements. User might wish for notification upon completion of a successful operation. In that case, after command execution, the microcontroller has to be programmed to send SMS using AT command (AT+CMGS). However the device controlling phone will need to have sufficient credit in this case. Call based operations can be implemented where the user will call the device phone and simply speak up Lights ON. And the device phone automatically receives calls from registered numbers. To implement this system, voice processing will be required which will incorporate high cost FPGA for digital signal processing. Besides, an application can be developed to enable a mobile phone to receive command over internet. This will eliminate the need to use a computer for the internet based control part. Android operating system based phones can be used for this purpose where application writing will be simple. JAVA can be used to write application for low cost mobiles. For our test purpose, GSM network has been used. CDMA network can also be used to perform the same job but with some modification at the control module. Using 3G network video surveillance can also be possible using mobile phone.

IX. CONCLUSION The implemented system takes advantage of the easy access of SMS as well as the literally limitless range of the internet with simple hardware connection. The system lets us control numerous and diverse electrical appliances from any place with security and reliability. Security is ensured using user authentication system. This scheme also offers low cost and dual controllability, when compared with previously reported schemes of home appliance control. Wireless interconnection between the control hub and the rooms increases the scope of controlling without cumbersome wiring. A large apartment with thousands of devices can be controlled using only one control hub with the two subsystems and receiving units in each room. Therefore only one mobile phone and a PC is enough to control the apartment remotely using this system. REFERENCES
[1] Ciubotaru-Petrescu, B., Chiciudean, D., Cioarga, R., & Stanescu, D. (2006). Wireless Solutions for Telemetry in Civil Equipment and Infrastructure Monitoring. 3rd Romanian-Hungarian Joint Symposium on Applied Computational Intelligence (SACI) May 25-26, 2006. [2] Alkar, A. Z., & Buhur, U. (2005). An Internet Based Wireless Home Automation System for Multifunctional Devices. IEEE Consumer Electronics, 51(4), pp. 1169-1174. [3] Jawarkar, N. P., Ahmed, V., Ladhake, S. A. & Thakare, R. D. (2008). Micro-controller based Remote Monitoring using Mobile through Spoken Commands. Journal of Networks, 3(2), pp. 58-63. [4] M Nikolova, F Meijs, P Voorwinden, Remote mobile control of home appliances, IEEE Transactions on Consumer Electronics (2003) Volume: 49, Issue: 1, pp. 123-127. [5] Malik Sikandar Hayat Khiyal, Aihab Khan, and Erum Shehzadi, SMS Based Wireless Home Appliance Control System (HACS) for Automating Appliances and Security. [On-line]. Vol. 6, pp. 889. Available: www.iisit.org/Vol6/IISITv6p887-894Khiyal592.pdf [April 21, 2011]. [6] Atmel. (2010, October 20). ATMEGA 32 datasheet. [Online]. Pp. 1-233. Available: www.atmel.com/atmel/acrobat/doc2503.pdf [May 1, 2011]. [7] Fadhil T. Aula, Using SMS in Mobile Phone for Home Appliances Controlling through PC Parallel Port Interfacing. [On-line]. Pp. 1-4. Available: www.emo.org.tr/ekler/8808cfb5939be38_ek.pdf [April 21, 2011]. [8] Maxim. (2004, March). MAX232 Datasheet. [On-line]. pp. 1-7. Available:www.datasheetcatalog.org/datasheet/texasinstruments/max23 2.pdf [May 19, 2011]. [9] Holtek. (2002, November 8). HT12D Datasheet. [On-line]. pp. 1-6. Available: www.ipic.co.jp/Pdffiles/ht12d.pdf [May 28, 2011]. [10] Holtek. (2000, April 11). HT12E Datasheet. [On-line]. pp. 1-8. Available: www.ipic.co.jp/Pdffiles/ht12e.pdf [May 28, 2011].