7

Click here to load reader

Cell Phone and J2ME Based Home Automation System with Feedback Instant Voice Messages Support

Embed Size (px)

DESCRIPTION

Journal of Telecommunications, ISSN 2042-8839, Volume 15, Issue 1, July 2012 http://www.journaloftelecommunications.co.uk

Citation preview

Page 1: Cell Phone and J2ME Based Home Automation System with Feedback Instant Voice Messages Support

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

© 2012 JOT www.journaloftelecommunications.co.uk

Cell Phone and J2ME Based Home Automa-tion System with Feedback Instant Voice Mes-

sages 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 fac-tors in home automation system such as flexibility, security, easy to use, the ability to feedback information to the client imme-diately, … 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 pro-grammed 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.

—————————— u ——————————

1 INTRODUCTIONhe idea of home automation system (HAS) has been

implemented for some years. It began with the con-cept 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 talk-ing about the interaction of technologies and services ap-plied 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 in-teresting 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, consid-ering the current demographical shift in the western world, which will create an increased demand for acces-sibility in homes and possibly for related facilities such as remote health monitoring.[11]

The main parameters by which the HAS can be esti-mated are: interoperability (the capability of devices of different types and from different manufactures to communicate and cooperate), scalability, security, avail-ability, usability, existence of multiple standards, sim-plicity, the ability to feedback information to the client, friendly, and flexibility.

These represent good reasons which call the atten-tion of companies to enter quickly this emerging market, also they represent a great research opportunity in creat-ing new fields in engineering, architecture, communica-tion, 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 ap-pliances. The controller consists of a DTMF (Dual Tone Multiple Frequency) and a PIC microcontroller. The inter-facing circuit consists of an optocoupler and a static pow-er 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 appli-

ances 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 with-out adding any component (depending on the micro-controller 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 electri-cal engineering, university of Babylon, Hilla, Iraq.

T

Page 2: Cell Phone and J2ME Based Home Automation System with Feedback Instant Voice Messages Support

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 fea-ture 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 se-conds, the controller closes the line automatically. This feature for don’t 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 aren’t lost if home power is off.

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 fol-lowing successive steps after the line opened: 1. Enter the required password.

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 fol-

lowing 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 auto-mation system. User friendly graphical user interface is provided on the mobile phone through applications de-veloped 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 de-

veloped 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 de-veloped by using Java development tools commonly known as development environment.[1].

• Most mobile phone manufactures provide their re-spective handset emulators for developers to test their applications on before testing on real phones.

The software of cell phone in our case is J2ME (Sun’s

Java 2 Platform Micro Edition) is a form of the Java lan-guage 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 with-out 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.  

Page 3: Cell Phone and J2ME Based Home Automation System with Feedback Instant Voice Messages Support

12

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 program-ming 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.

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

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 de-code the DTMF tones in to binary code. The DTMF outputs will be connected to the microcontrol-ler to allow action to be taken corresponding to the re-ceived 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 se-quence information as output order to power driver cir-cuit 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 out-put is 1001 and so on.[5]

The presented system uses the CM8870 DTMF de-coder 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 consump-tion its Less than 35mW power consumption, Uses quartz crystal or ceramic resonators, Adjustable acquisi-

GSM

DTMF decoder

Voice message

Micro Controller

Mas-ter

phone

Power driver & isolator circuit

AC Main

Server cell

phone

Home server controller

Page 4: Cell Phone and J2ME Based Home Automation System with Feedback Instant Voice Messages Support

11

tion and release times, 18-pin DIP ( refer to figure (3)), Power down mode, Buffered OSC3 output (PLCC pack-age only) and by grounding pins 5 and 6, but high per-formance in a small 18-pin DIP, SOIC, or 20-pin PLCC package configuration.

The CM8870/70C’s internal architecture consists of a band split filter section which separates the high and low tones of the received pair, followed by a digital de-code (counting) section which verifies both the frequency and duration of the received tones before passing the resultant 4-bit code to the output bus.

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 cir-cuit is completed with the addition of a standard televi-sion color burst crystal or ceramic resonator having a resonant frequency of 3.579545 MHz. Really there are also two important pins of a DTMF: a. 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 re-leased 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 mi-crocontroller 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,

i.e by PIC microcontroller all the features of the present-ed HAS are provided. We use pic16f877A whose pin di-agram 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 cir-cuit, 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 mes-sage address. PortE connects to led to mentoring each part. Figure (5) shows the port construction circuit of micro-controller 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.  

Page 5: Cell Phone and J2ME Based Home Automation System with Feedback Instant Voice Messages Support

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  don’t  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 cur-rent 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

 

                       

 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  

Msg.  No.    

 Addr  

A7    

A6    

A5    

Msg.  Duration  (sec)  

1   00   0   0   0   0  à  <3.2  

2   32   0   0   1   3.2  à  6.4  

3   64   0   1   0   6.4à  <9.6  

4   96   0   1   1   9.6à  <12.8  

5   128   1   0   0   12.8à  <  16  

6   160   1   0   1   16  à  <  16.2  

Page 6: Cell Phone and J2ME Based Home Automation System with Feedback Instant Voice Messages Support

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.  

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 us-ing 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 program-ming. The following procedure of the PIC programming is real-ized. 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 aren’t 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 pro-gram 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 or-der 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, af-ter that the program change a specific pin's state, At this time the On_done message and Off_done mes-sage will be play back by send specify order from port A to ISD2560.

• 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 exceed-ing 30 second the system will disconnect the call phone by send pulse from RA5 in port A to server cell phone.

 

 

Figure  (7)  Flowchart  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.  

Page 7: Cell Phone and J2ME Based Home Automation System with Feedback Instant Voice Messages Support

14

[2] Julio   Sanchez,   Maria   P.   Canton,   "ʺJAVA  Programming   for   Engineers"ʺ,   CRC   Press   LLC,  Printed  in  the  United  States  of  America,  ©  2002  

[3] Jason  Chiang-­‐‑"ʺCell  Phone  Security  System"ʺ,  Cornell  University-­‐‑May  2006  

[4] Computer  Automation  Technology,  Inc.  "ʺDiscussion  about  DTMF  decoding"ʺ;  Fort  Lauderdale,  Florida.  

[5] 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  

[6] Sid  Katzen,  The  Quintessential  PIC  Microcontroller,  Engineering  –  Monograph  (English),  2000,  Springer-­‐‑Verlag.  

   [7] Microcontroller   Programming   The   Micro-­‐‑chip   PIC,  

Julio   Sanchez,   Maria   P.   Canton,   CRC   Press,   Boca  

Raton  London  New  York,  2007.  [8] PIC   micro   MCU   C®   An   introduction   to  

programming   The   Microchip   PIC   in   C   By   Nigel  Gardner,   Copyright®   Bluebird   Electronics   2002,  USA.  

[9] Issa   Batarseh,   "ʺ   Power   Electronic   Circuits"ʺ,   Jone  Wiley  and  Sons,  Inc  ©  2004.  

[10] Winbond   electronic   corp.   "ʺ   Single-­‐‑chip,   multi  messages  voice  record/playback  device  IDS-­‐‑60,75,90,  &  120  seconds  duration,  may  2003,  USA.  

[11] 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.  

[12] 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.