Long Distance Appliance Control using SMS and Internet

Embed Size (px)

Citation preview

  • 7/29/2019 Long Distance Appliance Control using SMS and Internet

    1/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. INTRODUCTIONAutomation, reliability and user-friendliness have always

    been the prerequisites of an efficacious electronic system. Inaddition to these, a salient propensity to get rid of wires has

    been prompted in the current epochs. Design andimplementation of SMS based control for monitoring systemshas been done previously with a processing unit,microcontroller and a communication module that uses GPRSmodem via serial port RS-232. The SMS has been used forstatus reporting such as power failure in this reported scheme[1]. An internet based wireless home automation system formultifunctional devices with the limitations of limited rangeand power failure has been reported in [2]. Remotemonitoring through mobile phone involving the use of spokencommands has also been reported [3]. In this reported scheme,the spoken commands are generated and sent in the form oftext SMS to the control system and then the microcontrolleron the basis of SMS takes the decision. The underlying

    limitations in previous approaches are lack of alternativecontrolling media , no option for large scale controlling andlast but not the least, high cost.

    To overcome the limitations of the previously reportedworks, in this work parallel remote switching has been doneusing two most popular means of communication: mobile andinternet. In this hardware implemented scheme, a low costmobile has used instead of the relatively expensive GSMmodem use in [4], [5]. In the SMS based control, anyelectronic appliance can be turned on or off by sending SMSfrom a pre-registered mobile number. Literally, any device(one or more at a time) can be controlled by a single SMS, aslong as the coverage of a mobile network goes. In addition tothat, the same appliances can also be controlled over internet.In that case, all that is to be done is to log in to a webpagewhere a list of all the appliances that can be controlled isavailable and the appliances can be turned on or off bymouse-clicks. Video surveillance is implemented usinginternet which enables the user to check the instant status ofhis residence from his website keeping an active internetconnection and a webcam in the PC in the residence. Thesystem is eligible to receive command from both of thesources and take decision accordingly. Two independentsystems working in parallel results in a system with improvedreliability and ease. If mobile network is unavailable forsome reason, internet access will still be possible and viceversa. A cell phone and a Personal Computer (PC) connected

    to internet at the central unit is enough to establish this systemeven in a large office or residence. There is no concern ofchanging the conduit layout and wiring as RF signal will betransferred from the central unit which will contain necessary

    commands. Antennas, being placed in every room, willreceive the signal and decoders will decode the commands inthe RF signal and the appliances will respond to the respectivecommands. Once installed, this system is simple to access buttotally secured.

    II. SMSBASED CONTROLLINGSMS is an easy mean of communication now-a-days. The

    user has to register his mobile number and then to turn on oroff any electrical appliance, he has to send an SMS containingthe appropriate commands. User-authentication allows thesystem to be safe and secured. SMS is received in a mobile inthe control module which is connected to an ATMEGA 32micro-controller unit (MCU) [6] via serial communicationusing RS-232 protocol. The MCU reads the SMS from mobileusing AT commands and checks whether the SMS is receivedfrom a registered (valid) user number. Table 1 shows the listof AT commands suitable for serving the purpose and the

    SMS processing using them is mentioned in Table 2.

    Table 1. List of Used AT Commands

    Command Purpose

    ATStart synchronization.

    ATE0To turn off echo.

    AT+CMPS=ME,ME,ME To select mobile memory for

    storing message.

    AT+CMGR=1To read message from index 1.

    AT+CMGD=1 To delete message of index 1.

    Table 2. SMS handling using AT Commands

    Phone

    Initialization

    1. AT is sent to the phone. Ok isreturned.

    2. ATE0 is sent to turn off echo.3. AT+CMPS=ME,ME,ME sent.

    Reading and

    Deleting

    SMS

    1. To make sure the new SMS will be storedat index 1, any existing text at index 1 is

    deleted by sending AT+CMGD=1.

    2. To read SMS at index 1, microcontrollersends AT+CMGR=1.

    PDU

    conversion

    PDU is a compressed and encrypted SMS formatfor fast transmission. SMS is converted from

    PDU to ASCII for our purpose.

  • 7/29/2019 Long Distance Appliance Control using SMS and Internet

    2/5

    SMS from invalid users are deleted without taking anyother action. There is an option for user registration too. In thecase of user registration it checks the password and if itmatches with the password in the database, the number isadded in the valid user list. SMS from valid user is analyzedand desired appliance states in the desired rooms are foundout. Then the data is sent to the control hub along with aconfirmation pulse. The algorithm of the working system is

    presented in Fig. 1 and a simplified block diagram is given inFig. 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 outputsignal 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

    Figure 2. Block diagram of SMS based controlling

    subsystem

    III. INTERNET BASED CCONTROLLINGTo control the appliances, the user will give command

    using a PC. This command will be sent from the remote PC toa sever PC. The microcontroller is connected with the serial

    port of the remote PC. The microcontroller processes thecommand signals coming from the PC and it is connected tothe control hub. Block diagram of the corresponding system isdepicted in Fig. 3. In the remote PC, a software named USBserver is kept running. This software allows accessing theremote computer by its IP address. To access the webpage theuser must login using his user name and password. Then thestate of any appliance in any room can be changed bycommands given from the computer. Algorithm of this systemis presented in Fig. 4 to explain the sequential processing ininternet based control. The desired states of the appliances in

    the desired room are then sent to the control hub along with aconfirmation pulse. The IP based address is not necessary ifthe user has a personal website. The user can even use hissocial networking pages like Facebook, Twitter etc.

    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 PROCEDURESerial Interfacing is used for communication between PC

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

    Figure 5. Connection with DB9 connectors

    Control

    Module

    Control

    hub

    MCU

    Remote

    User

    Command

    by SMS

    Cell

    Phone

    Network

    User Remote

    PC

    Server

    PC

    MCU &

    External

    Hardware

    to be

    controlled

    Connected

    by Internet

  • 7/29/2019 Long Distance Appliance Control using SMS and Internet

    3/5

    Also in case of interfacing between mobile andmicrocontroller, UART protocol is used. The phone used forour purpose is Siemens AX 75 which has a data cablesupporting serial interfacing. The mobile is connected to theMAX 232 converter which is connected to the microcontrollerand does the job of logic level shifting. The circuit diagramfor serial communication is shown in Fig. 6.

    Figure 6. Circuit Diagram for ATmega32 serial interface with

    Siemens AX75

    For both of the subsystems, UART communication is usedwith 9600 BAUD rate, 8 bit frame size, 1 stop bit and paritymode disabled.

    V.

    COMMUNICATION AMONG

    MOBILE

    &INTERNET

    SUBSYSTEMS,CONTROL HUB &ROOMSBoth the mobile subsystem and internet subsystem are

    connected with a central control hub. The MCU in the hubtracks the subsystem from which the control words arecoming from with the help of confirmation pulse. Then it

    processes the control words and finds out the room in whichthe 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 transmitthe command signals coming from mobile

    subsystem.

    b) Else then transmit the command signals comingfrom 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

    Each room has an RF receiver module with HT12 decoder[9] with pre-assigned address. The rooms are identifiable withthat address. After identifying the room, the control hubassigns the address of that corresponding room to the HT 12encoder [10] and transmits the encoded control words usingRF transmitter as depicted in Fig. 8. Only the correspondingroom is able to decode the signal using its decoder as itsaddress is matched with that of the encoder in transmitting the

    end. The decoded signal is then processed in a MCU whichprovides 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 networkingamong the control hub and the rooms is shown as a blockdiagram in Fig. 10.

    Figure 8. Control Hub connection for spreading the control signal

    throughout the controlled area.

    Figure 9. Block Diagram of a typical receiving end connection e.g.

    for a single room

    12 bit parallel connections

    Sending 12 bit data serially

    Combining 4 bit data with its

    8 bit addressAntenna

    Control Hub MCU

    HT 12E Encoder

    RF Transmitter

    (Tx 433)

    Relays for connecting

    devices

    4 bit parallel data

    MCU & 8255 (opt.)

    Antenna

    HT 12E Decoder

    RF Receiver

    (Rx 433)

    Control Unit

    Internet Subsystem

    Mobile Subsystem

  • 7/29/2019 Long Distance Appliance Control using SMS and Internet

    4/5

    Figure 10. Block diagram of RF networking from the control hub

    to the rooms

    VI. SYSTEM PROTOTYPEThe overall system comprises two individual subsystems

    for SMS and internet based controlling. Their systemprototypes are demonstrated in Fig. 11 and Fig. 12respectively.

    The subsystem for SMS based controlling comprises a lowcost (1,500 Bangladeshi Taka (BDT)) mobile phone, one 8 bitmicrocontroller, one serial interface chip and some other lowcost components. The total cost for this subsystem is about2,500 BDT.

    Figure 11. Subsystem for SMS based controlling

    Figure 12. Subsystem for Internet based controlling

    The subsystem for internet based control requires one 8 bitmicrocontroller, one serial interface chip and some other lowcost components. So, the cost for this subsystem is very low(about 600 BDT). A computer (or laptop) with active internetconnection is required for this subsystem to work.

    A webpage is designed for internet based controlling. Theuser 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

    Control hub incorporates another microcontroller, anencoder 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 requiredhaving a total cost of 800 BDT per room. Thus, the systemimplemented offers reasonable cost. All the costs mentionedare according to the price in June 2011.

    RF Rx 1

    HT 12 decoder

    MCU & external

    peripherals (8255)

    Control Hub

    HT 12 Encoder

    RF Transmitter

    RF Rx N

    HT 12 decoder

    MCU & external

    peripherals (8255)

    ...

    ...

    ...

    Room 1 appliances Room N

    appliances

    ...

    Receiverunitfora

    singleroom

  • 7/29/2019 Long Distance Appliance Control using SMS and Internet

    5/5

    For video surveillance, a webcam is required which is alsonot very costly. The designed website has provision forshowing the video captured from the home (where thewebcam is placed) using live streaming.

    This system requires small amount of power as itcomprises only digital circuitry. But the mobile is to becharged in regular interval and the PC for controlling thedevices must be on all the time.

    VII. SYSTEM TESTINGEvery part of the system has been tested several times

    under different circumstances. Firstly, the subsystems forSMS based controlling and internet based controlling aretested separately using locally available GSM and WiMAXnetwork. The systems performed expectedly in all tests. Aftersuccessful completion of the testing of individual subsystems,total system has been tested incorporating RF communicationamong 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 WORKThe implemented system is a state of art long distance

    appliance control scheme. It has scope for furtherimprovements.

    User might wish for notification upon completion of asuccessful operation. In that case, after command execution,the microcontroller has to be programmed to send SMS usingAT 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 fromregistered numbers. To implement this system, voice

    processing will be required which will incorporate high costFPGA for digital signal processing.

    Besides, an application can be developed to enable amobile phone to receive command over internet. This willeliminate the need to use a computer for the internet basedcontrol part. Android operating system based phones can beused for this purpose where application writing will besimple. JAVA can be used to write application for low costmobiles.

    For our test purpose, GSM network has been used. CDMAnetwork can also be used to perform the same job but withsome modification at the control module. Using 3G networkvideo surveillance can also be possible using mobile phone.

    IX. CONCLUSIONThe implemented system takes advantage of the easy

    access of SMS as well as the literally limitless range of theinternet with simple hardware connection. The system lets uscontrol numerous and diverse electrical appliances from any

    place with security and reliability. Security is ensured usinguser authentication system. This scheme also offers low costand dual controllability, when compared with previouslyreported schemes of home appliance control. Wirelessinterconnection between the control hub and the roomsincreases the scope of controlling without cumbersomewiring. A large apartment with thousands of devices can becontrolled using only one control hub with the twosubsystems and receiving units in each room. Therefore onlyone mobile phone and a PC is enough to control the apartmentremotely using this system.

    REFERENCES

    [1] Ciubotaru-Petrescu, B., Chiciudean, D., Cioarga, R., & Stanescu, D.(2006). Wireless Solutions for Telemetry in Civil Equipment andInfrastructure 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 ConsumerElectronics, 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 throughSpoken Commands. Journal of Networks, 3(2), pp. 58-63.

    [4] M Nikolova, F Meijs, P Voorwinden, Remote mobile control of homeappliances, IEEE Transactions on Consumer Electronics (2003)Volume: 49, Issue: 1, pp. 123-127.

    [5] Malik Sikandar Hayat Khiyal, Aihab Khan, and Erum Shehzadi, SMSBased Wireless Home Appliance Control System (HACS) forAutomating Appliances and Security. [On-line]. Vol. 6, pp. 889.Available: www.iisit.org/Vol6/IISITv6p887-894Khiyal592.pdf [April21, 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 AppliancesControlling 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/max232.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].