You are on page 1of 7

JOURNAL OF TELECOMMUNICATIONS, VOLUME 15, ISSUE 1, JULY 2012 10

Cell Phone and J2ME Based Home Automation System with Feedback Instant Voice Messages Support
Mahmoud shaker Nasr.
Abstract This paper introduces a friendly system to control the home appliances remotely by the use of mobile cell phones; this system is well known as "Home Automation System" (HAS). The designed system covers the most important required factors in home automation system such as flexibility, security, easy to use, the ability to feedback information to the client immediately, etc. The presented system uses the J2ME language to program the client mobile which sends information to the service mobile and this controls the operation of the appliances via a PIC microcontroller which connected to it and programmed in such a way that introduces the main characteristics of the system. Optocoupler and static power switch (TRAIC) are used as the interface devices between the PIC and the home appliances. Index Terms HAS, Home Automation, DTMF, PIC Microcontroller, J2ME, Voice Message Feedback.

1 INTRODUCTION

he idea of home automation system (HAS) has been implemented for some years. It began with the concept of domotic which is the combination of computer application and robot technology. In other words, it is the control of home appliances by means of a computer [4]. Then the concept is developed to a modern one, it is talking about the interaction of technologies and services applied to different buildings with the purpose of increasing security, comfort, communication, and energy saving. Home automation technology, although not yet as widely adopted in most part of the world as in the US, is becoming more and more available, affordable and interesting to the wider public. What once was not far from novelty products, like the "Clapper" that switches the lights on by the clap of your hands, is now becoming an important factors of utility, convenience and usability in modern houses. These factors are added to the already substantial possibilities of entertainment and security created by home automation[1]. Accessibility aspects of home automation also became more acceptable, considering the current demographical shift in the western world, which will create an increased demand for accessibility in homes and possibly for related facilities such as remote health monitoring.[11] The main parameters by which the HAS can be estimated are: interoperability (the capability of devices of different types and from different manufactures to communicate and cooperate), scalability, security, availability, usability, existence of multiple standards, simplicity, the ability to feedback information to the client, friendly, and flexibility.

These represent good reasons which call the attention of companies to enter quickly this emerging market, also they represent a great research opportunity in creating new fields in engineering, architecture, communication, and control, so HASs are becoming popular. The presented paper introduces a friendly HAS that com -plies the mentioned parameters using two mobile cell phones (client and server). The client cell phone is the master and contains the main menu of the HAS which is programmed by J2ME language. The server cell phone(situated in the home) to which the controller is connected which controls the operation of the home appliances. The controller consists of a DTMF (Dual Tone Multiple Frequency) and a PIC microcontroller. The interfacing circuit consists of an optocoupler and a static power switch (TRIAC).

2 SYSTEM FEATURES
The system considered in the present paper introduces the following features: 1. Visual Menu of home appliances the user see all appliances he want to control and operation instructions on the mobile phone screen by J2ME software. 2. The system allows the user to control (On or off) nine of home appliances and can be expanded to 22 without adding any component (depending on the microcontroller programming). 3. Controlling a high voltage device. 4. Knowing the devices present state (On or off) at any time with voice message. 5. Knowing if the home AC main power is off via voice message.

Mahmoud Shaker Nasr is assistant professor with the department of electrical engineering, university of Babylon, Hilla, Iraq. 2012 JOT www.journaloftelecommunications.co.uk

11

6. The system will communicate with user, and gives information about device's state after controlling (on or off) with voice message. 7. Any phone number can't access the home server by calling the server number, only the specify numbers will be answered, the specify numbers are of user choice. This feature has been added in the presented HAS for security. 8. Can add multi users to control this system this feature refer to user choice. 9. Server cell phone can be used for normal use without any effect in the home system, the system give ability of changing the server number by an option in the menu of master phone. 10. Server has a password at least 4 digits long and can be increasing by the user. 11. The controller will close the line automatically after entering three wrong passwords. 12. The Capability of changing the server password by user remotely at any times. 13. If there is no keypad pressed for more than 30 seconds, the controller closes the line automatically. This feature for dont keep the telephone line busy for unwanted reasons, this feature save user money 14. Working at convention home power and need no specific electrical network. 15. The system is nonvolatile; that means information of appliance status and new password arent lost if home power is off.

2. Enter "0" followed by the number of a specific home appliance to know the present state of such appliances. 3. Enter "#" followed by the number of a specific home appliance to change the present state from "Off" to "On" and vice versa. 4. Enter "*" followed by the new password the password will changed. 5. All the control states are feedback to the user by means of voice messages.

5 SYSTEM COMPONENTS
Referring to figure (1) the system consists of the following components, namely; a. Master cell phone, which contains the main menu. b. Server cell phone. c. Control circuit. The master phone serves as a remote control device through which a user can interact with the home automation system. User friendly graphical user interface is provided on the mobile phone through applications developed in Java programming language, which carries out the task of operating and checking sequence of home appliances. The required application (menu) is designed using J2ME language since J2ME characterized by the following main advantages:[2] The portability of Java ensures that applications developed in Java language are portable across different mobiles from different manufacturers. Since Java has a rich library of application program interfaces (API) providing functions such as graphical user interface, sending and receiving SMS messages, and communicating via GPRS, etc, Java applications for mobile phones can be easily developed by using Java development tools commonly known as development environment.[1]. Most mobile phone manufactures provide their respective handset emulators for developers to test their applications on before testing on real phones. The software of cell phone in our case is J2ME (Suns Java 2 Platform Micro Edition) is a form of the Java language that is optimized for small devices such as mobile phones. Most phone manufacturers have made a strong commitment to Java phone deployment. Tens of millions of Java-enabled phones are already in consumers hands with the ability to add capabilities to their phones without having to purchase new ones. Although J2ME is not the only language deployed on phones, it is an industry standard backed by many manufacturers and therefore offers a large and growing installed base. It is a natural choice for mobile application development. We used call phone procedure of connection between two cell phones; it allows control and interface better than SMS or WAP in feedback and information about the present state of each devices before given order [12]. Figure (2) Shows one stage of programming the master cell phone.

3 SYSTEM ARCHITECTURE
The system architecture of the proposed HAS in this paper can be explained according to the block diagram shown in figure (1). The system mainly consists of two cell phones one remote cell phone which called Master cell phone (client) which controls the operation of the remote home appliances, this cell phone contains the main menu which it is programmed via J2ME language; and the other home cell phone which called server phone because it is fixed in home server controller board. This system allows a user to control and communicate with home appliances by programming cell phone and built in the mentioned several features. The home appliances are controlled by the home server phone, which operates according to the user commands received from the master phone via the server phone. The control circuit which is connected to the home server phone consists mainly : DTMF decoder, microcontroller, interface& isolation circuit and voice message feed back circuit.

4 SYSTEM OPERATION
The system operation procedure can be summarized as follows: Once the user (the commander) (client) dials the server phone number, the server phone answers automatically (open the line automatically), then the user can control the operation state of home appliances according to the following successive steps after the line opened: 1. Enter the required password.

12

Home server controller


GSM
AC Main DTMF decoder Micro Controller Power driver & isolator circuit

Master phone

Server cell phone

Voice message

Figure (1) Block diagram of over all system design. The software functions are make connection (call phone) with home phone and show the home appliances sequence and number of each device which is used in the control order. Figure (2) shows an example of programming of the master cell phone. The server cell phone, this phone resides in the home which receive the call from the master phone and to which the control system is connected. server communicates with the mobile phone via GSM network and call phone, at this call phone the user will send DTMF tones by pressing the mobile keypad these tones pass through ear phone to DTMF decoder that decode the DTMF tones in to binary code. The DTMF outputs will be connected to the microcontroller to allow action to be taken corresponding to the received DTMF tone. The DTMF tones will produce vary-

ing outputs depending on the keys pressed by the user. The microcontroller will use this information to determine and validate the sequence of keys entered by the user. The microcontroller programming will execute this sequence information as output order to power driver circuit or voice message unit. The control system consists of the following components:
DTMF Dual Tone Multiple Frequency (DTMF) , the DTMF is a decoder when any key on the cell phone is pressed a two different frequencies are generated, the DTMF detects these frequencies and decode a four digits latched output whose value depends on the pressed key. For example, if bottom "1" is pressed on the keypad the DTMF decoder output is 0001, if bottom "9" is pressed the decoder output is 1001 and so on.[5] The presented system uses the CM8870 DTMF decoder to allow the system to decode the DTMF signals sent by the user through server cell phone in to binary code, these digital codes fed to microcontroller input. The CM8870/70C DTMF integrated receiver provides the design engineer with not only low power consumption its Less than 35mW power consumption, Uses quartz crystal or ceramic resonators, Adjustable acquisi-

Figure (2) Shows one stage of programming the master cell phone. The control circuit is the heart of the HAS and as we said earlier is connected to server cell phone, this home

11

tion and release times, 18-pin DIP ( refer to figure (3)), Power down mode, Buffered OSC3 output (PLCC package only) and by grounding pins 5 and 6, but high performance in a small 18-pin DIP, SOIC, or 20-pin PLCC package configuration. The CM8870/70Cs internal architecture consists of a band split filter section which separates the high and low tones of the received pair, followed by a digital decode (counting) section which verifies both the frequency and duration of the received tones before passing the resultant 4-bit code to the output bus.

i.e by PIC microcontroller all the features of the presented HAS are provided. We use pic16f877A whose pin diagram is shown in figure (4).

Figure (4) Shows the pin configuration for the PIC16F887. The most important issue when using the PIC is the port configuration. The port functions are configured by writing data into specific internal registers that called TRIS, in our design we use ports as following: PortC: as an input that connects to DTMF output. PortD: as an output that connects to power isolation circuit, which interface between microcontroller and home appliances. PortB: as an output that connects to voice message circuit (ISD2560) divided in to the control order of ISD and message address. PortE connects to led to mentoring each part. Figure (5) shows the port construction circuit of microcontroller in addition to oscillator circuit. Feedback circuit (voice messages) (ISD2560). As mention in the features that presented in this paper, the voice messages will play back to the user at different states. The circuit which feeds back (or give) the necessary information to the user is isd2500 series, we used ISD2560 for our design. The feedback information is a voice mes- sages in Arabic language, of course it is simple to record the necessary messages in any desired language. The rec- orded messages are: "wrong data entering" if any wrong data is entered, "the apparatus in on state" if the apparatus is in on-state, "the apparatus is changed to on state" if the apparatus state is changed from off to on, "the AC power if off" if there is no electrical current in the house, "the apparatus in off state" if the apparatus is in off-state, "the apparatus is changed to off state" if the apparatus state is changed from on to off.

Figure (3) DTMF pin diagram and connection. In a single-ended configuration, the input pins are connected as shown in figure (3). The internal clock circuit is completed with the addition of a standard television color burst crystal or ceramic resonator having a resonant frequency of 3.579545 MHz. Really there are also two important pins of a DTMF: The TOE (pin 10): (Tri-State output enable) pin is an active low input used to disable/enable the output latch. The TOE pin will be connected to ground in disable the output with high impedance, it is useful in case of unwanted output code, and connect to VDD in order to have the output latch enabled at all times. b. The STD signal (pin 15): this signal goes high during the time any valid key is pressed, if the key is released the STD goes low, this signal is using in the presented system; to tell a microcontroller that the key is pressing and DTMF tone are transmitting and the output latch has been updated, at this time a microcontroller read the data. PIC Microcontroller The microcontroller is the main unit in presented design, it takes the sequence order code from DTMF decoder and translates it as programming to output devices for controlling (on-off) or read the present state, check the password and change it also control the voice messages, a.

12

These voice messages are recorded and then playback a specific message at the required instant, to do that we must consider the addressing of ISD2560 to parted 60 sec of ISD in to 6 messages each message 3 second (3/0.1=30) (since the resolution of 2SD260 is 0.1) the address is at 30

Figure (5) Shows the connection of microcontroller. but we choose 32 in order to decrease the addressing lines to 3 only, the messages addresses are shown in table (1) while figure (6) shows the pin diagram and connection circuit of ISD2560.[10] Then, the voice circuit needs only 3 lines (A5,A6, & A7) for messages addressing and required only 2 lines to control the ISD2560 mode of operation (PD and CE ) the- se lines are tied from the microcontroller. The procedure of controlling the play back of the voice messages is as follows: 1. P/R should be always high in play back voice messag- es, we can connect it to Vcc at all the time, in our case this controlled pin dont need a specific line from mi- crocontroller. 2. CE pulse low to Playback starts, this pulsed are given from microcontroller output. 3. The PD pin should be LOW, during the message play back after that it should active high to Stop/Reset, al- so taken from microcontroller output line. One can refer to ISD2560 data sheet for more details about its addressing and operation. There is another solution for messages recording and playback is the use of MP3 player instead of ISD2560. Figure (6) ISD2560 pin diagram and connection circuit. Power Isolation circuit

Power isolation circuit provides the electrical isolation between the microcontroller and the power circuit (home appliance) in addition to protect the microcontroller from damage in case of any faulty operation of appliance. Optocoupler is a proper device to realize the required goal; because it works by photon sense there are no any connection between high voltage side and low voltage side, in the presented system 4N25 optocoupler is used. The control signal which comes from microcontroller to control the appliances is applied to the photodiode of the optocoupler which bias the photo transistor to make the connection of high voltage After that we need the driving circuit to increase the current for correct operation of the gate of triac circuit. The transistor type NPN TIP121 is used. TABLE 1 MESSAGE ADDRESSING OF ISD2560 FOR 6-MESSAGES (3.2 SEC) TIME DURATION Msg. A7 A6 A5 No. Addr 1 00 0 0 0 2 3 4 5 6 32 64 96 128 160 0 0 0 1 1 0 1 1 0 0 1 0 1 0 1 Msg. Duration (sec) 0 <3.2 3.2 6.4 6.4 <9.6 9.6 <12.8 12.8 < 16 16 < 16.2

Static power switches TRIACs are widely used in AC power control appli- cations, They are able to switch high voltages and high levels of current, and over both parts of AC waveform [9]. This makes TRIAC circuits ideal for use in a variety of applications where power switching is needed. One

13

particular use of a TRIAC circuits in domestic appliances on/off and control of ac motors. In addition, in most ap- plications TRIAC overcomes the main problems of the use of electromagnetic relays and contactors in spite of it is simple to control its operation comparing with TRIAC which requires an additional electronic circuit to control it. TRIAC TIC246D is used in this system.

If user presses '*' it means that change the password, the program will stored the four entered digit after the"*" in EEPROM in specific location of password. 9. After each step from a preview step the program will back to state-action label and wait next entered. 10. During call, the program is waiting until any key is pressed, the counter will count the time if it exceeding 30 second the system will disconnect the call phone by send pulse from RA5 in port A to server cell phone.

6 OVERALL SYSTEM DESIGN


Figure (7) shows the flowchart of the main program of the HAS presented in this paper. The PIC will be programmed using the PIC ProBasic complier The IDE allows the PIC to be programmed using a high level language. The code is compiled into a compatible HEX file and then burned to the PIC. The device used to burn the PIC is the winpic programming. The following procedure of the PIC programming is realized. 1. Initialize the ports as: (port C) is an input and (port D, port A, Port E) are output. 2. Initialize the ports as: (port C) is an input and (port D, port A, Port E) are output. 3. The program waits until the user presses any keypad and releases it. 4. At this time the microcontroller will read the input code from port C, which connect to the DTMF output. 5. The programming will looped around the two last steps, until 4 digit codes will input (the password), then compared these input codes with the password stored in EPROM, to check the user. 6. If the 4 entered digits arent correct the program will go back to check password this step repeats only three times after that will disconnect the call phone by send pulse from RA5 in port A to server cell phone. 7. If the 4 entered digit are correct the program will go to state_action (label in program) and run out the procedure of program (change the state or read the state or change the password). 8. The procedure is as follows: If user presses '0' it means that read the present state, the program will wait until user presses the number of device which want to read the state, and the program will read the (output port state) and check it if the specify pin of this device is low or high, if its low the program will goes to off present message subroutine which play back the voice message of this case, and it is the same in case of high state the voice message of ON present state will be playback. These message is controlled by send the specific order from portA to ISD2560. If user presses '#' it means that change the present state. the program will wait until user presses the number of device which want to change its state, after that the program change a specific pin's state, At this time the On_done message and Off_done message will be play back by send specify order from port A to ISD2560.

Figu re (7) Flo wch art of the main program of proposed HAS.

7 CONCLUSIONS
The presented HAS in this paper is realized practically, tested for multi modes of operation and gave an excellent control of the home appliances under test. The system presented in this paper introduced a friendly system to control the home appliances remotely by the use of mobile cell phones. The proposed system is characterized by its grand features required for the modern home automation system such as flexibility, security, friendly, in addition to the existence of feedback on line messages to inform the master about the state of the system and the appliances.

7 REFERENCES
[1]

Van Der Werff, M. Gui, X. Xu, W.L. Massey Univ., Palmerston North, New Zealand "A Mobile-based home automation system" IEEE,2006.

14

[2]

[3] [4] [5]

[6]


[7]

Julio Sanchez, Maria P. Canton, "JAVA Programming for Engineers", CRC Press LLC, Printed in the United States of America, 2002 Jason Chiang-"Cell Phone Security System", Cornell University-May 2006 Computer Automation Technology, Inc. "Discussion about DTMF decoding"; Fort Lauderdale, Florida. David P. Marchetti, Eric White, Aaron Sanford "DTMF Automated Door System", School of Electrical Engineering and Computer Science, University of Central Florida, Orlando, Florida ; May 2007 Sid Katzen, The Quintessential PIC Microcontroller, Engineering Monograph (English), 2000, Springer- Verlag. Microcontroller Programming The Micro-chip PIC, Julio Sanchez, Maria P. Canton, CRC Press, Boca

[8]

[9] [10]

[11]

[12]

Raton London New York, 2007. PIC micro MCU C An introduction to programming The Microchip PIC in C By Nigel Gardner, Copyright Bluebird Electronics 2002, USA. Issa Batarseh, " Power Electronic Circuits", Jone Wiley and Sons, Inc 2004. Winbond electronic corp. " Single-chip, multi messages voice record/playback device IDS-60,75,90, & 120 seconds duration, may 2003, USA. Su, Kuo-Lan, Chia, Song-Hiang, Shiau, Sheng,Ven - Guo, Jr-Hung "Developing a module-based security system for an intelligent home ", Journal of Artificial Life and Robotics, Vol.14, 2009. Piyare, R. , Tazil, M. " Bluetooth based home automation
system using cell phone", IEEE 15th International Symposium on Consumer Electronics (ISCE), 2011, PP. 192-195.

Figure (8) Overall circuit diagram of the proposed HAS.

You might also like