+ All Categories
Home > Documents > D I L Programmable Home Automation Module Design and ...pegasus.javeriana.edu.co/~CIS0810SD03/Home...

D I L Programmable Home Automation Module Design and ...pegasus.javeriana.edu.co/~CIS0810SD03/Home...

Date post: 24-Feb-2019
Category:
Upload: lamtruc
View: 220 times
Download: 0 times
Share this document with a friend
6
J.-H. Su et al.: The Design and Implementation of a Low-cost and Programmable Home Automation Module Contributed Paper Manuscript received October 14, 2006 0098 3063/06/$20.00 © 2006 IEEE 1239 The Design and Implementation of a Low-cost and Programmable Home Automation Module Juing-Huei Su, Member, IEEE, Chyi-Shyong Lee, and Wei-Chen Wu Abstract This paper presents a home automation module with programmable control instructions (PCIs). Although it is implemented by using a low-cost 8-bit microcontroller with only 8 Kbytes of ROM spaces, a time-sharing task scheduler and 10 PCIs are included in the firmware. Timer and counter control, logic functions, and temperature control are examples of PCIs. Thanks to the design of pseudo nodes, these PCIs can also be combined to implement more complex functions that home automation needs. These modules, up to 65536 theoretically, share the same IP address, and can be found over the network via different port numbers. No dedicated home server is necessary because the network communication (TCP/IP) is handled by the module. A remote control and monitoring software is also developed to let users control the home automation modules on the Internet. The programmable home automation module has a lower cost and better cost/performance ratio than current home automation modules. 1 Index Terms — Programmable home automation module. I. INTRODUCTION The rapid development in computer and network technology has made the use of the Internet expand exponentially. Although the Internet is currently used for reading, chatting, and searching for information, it can also be used in home automation which provides 1) increased comfort, 2) greater safety and security, and 3) efficient use of energy. For example, the user can monitor and control his/her home gate, air-conditioner, and refrigerator over large distances. Recently, A. Alheraish [2] proposed a home automation system which is based on the wireless GSM network. This is an expensive way to control home appliances compared to the approach which use the Internet [1]. Kanma et al [3] also presented a home appliance control system architecture over Bluetooth technology. The approach in [3] uses a cellular phone with Bluetooth communication capability to locally control home appliances. In this case, each and every home appliance should be equipped with a serial communication port and a Bluetooth communication module to communicate with the cellular phone, which acts as the control terminal. The cellular phone can also report statuses to or download manuals and programs from the remote service site via the internet. The initial cost is high because of the cellular phone 1 This work was supported by the National Science Council under Grant No. NSC-95-2221-E262-026. The authors are with the Electronic Engineering Department, Lunghwa University of Science and Technology, Taoyuan county, Taiwan(e-mail: [email protected], [email protected]). with both internet and Bluetooth services, and those Bluetooth communication modules for home appliances. Although, Al-Ali and AL-Rousan [1] devised a less expensive Java-based home automation system, a dedicated home server to run Java server pages and Java beans is necessary and the ready-made embedded system board costs about USD$200. Moreover, the Java-based home automation system controls only the on/off states of home appliances. Actually, home appliances may be controlled according to several environment states or a local control algorithm. These situations are not considered in previous results [1-3]. For example, timer control instruction can help user to turn on or off a home appliance after a specific interval of time. Therefore, a low-cost (less than USD$40) home automation module with programmable control instructions (PCIs) and local control algorithms is devised in this paper. These PCIs can also be combined to implement complex functions. This is useful when a home user wants to turn on the light in the living room when either the gate or the garage door is opened, because a logic OR instruction is necessary to implement such a function. Control techniques for temperature, power, etc. can also be built into the PCIs. A remote control and monitor software is also developed to let users control the home automation module on the internet. By using these programmable home automation modules, the users can control more efficiently their home appliances according to the weather conditions, lightness, etc. II. OVERVIEW OF THE HOME AUTOMATION MODULE The block diagram of the proposed home automation module with PCIs is shown in figure 1. The hardware and software parts will be described in this section. A. Hardware The hardware part of the module is a single board computer and it costs about USD$40 (see table 1 for cost analysis). It consists of the followings: 1. A 8-bit RISC microcontroller (8K Bytes of in-system self-programmable flash memory, 1K Bytes of internal SRAM) which handles all the tasks required to control home appliances according to the environment variables; 2. A multiplexed RS232 port to support communications with other devices (e.g. programmable logic controllers, or GSM modules) and the remote control PC; It is controlled by the microcontroller via a quad bilateral switch IC (CD4066BC); 3. A TCP/IP network module for users to control home appliances and to monitor the security status on the Internet;
Transcript

J.-H. Su et al.: The Design and Implementation of a Low-cost and Programmable Home Automation Module

Contributed Paper Manuscript received October 14, 2006 0098 3063/06/$20.00 © 2006 IEEE

1239

The Design and Implementation of a Low-cost and Programmable Home Automation Module

Juing-Huei Su, Member, IEEE, Chyi-Shyong Lee, and Wei-Chen Wu

Abstract — This paper presents a home automation module with programmable control instructions (PCIs). Although it is implemented by using a low-cost 8-bit microcontroller with only 8 Kbytes of ROM spaces, a time-sharing task scheduler and 10 PCIs are included in the firmware. Timer and counter control, logic functions, and temperature control are examples of PCIs. Thanks to the design of pseudo nodes, these PCIs can also be combined to implement more complex functions that home automation needs. These modules, up to 65536 theoretically, share the same IP address, and can be found over the network via different port numbers. No dedicated home server is necessary because the network communication (TCP/IP) is handled by the module. A remote control and monitoring software is also developed to let users control the home automation modules on the Internet. The programmable home automation module has a lower cost and better cost/performance ratio than current home automation modules.1

Index Terms — Programmable home automation module.

I. INTRODUCTION The rapid development in computer and network

technology has made the use of the Internet expand exponentially. Although the Internet is currently used for reading, chatting, and searching for information, it can also be used in home automation which provides 1) increased comfort, 2) greater safety and security, and 3) efficient use of energy. For example, the user can monitor and control his/her home gate, air-conditioner, and refrigerator over large distances.

Recently, A. Alheraish [2] proposed a home automation system which is based on the wireless GSM network. This is an expensive way to control home appliances compared to the approach which use the Internet [1]. Kanma et al [3] also presented a home appliance control system architecture over Bluetooth technology. The approach in [3] uses a cellular phone with Bluetooth communication capability to locally control home appliances. In this case, each and every home appliance should be equipped with a serial communication port and a Bluetooth communication module to communicate with the cellular phone, which acts as the control terminal. The cellular phone can also report statuses to or download manuals and programs from the remote service site via the internet. The initial cost is high because of the cellular phone

1 This work was supported by the National Science Council under Grant

No. NSC-95-2221-E262-026. The authors are with the Electronic Engineering Department, Lunghwa

University of Science and Technology, Taoyuan county, Taiwan(e-mail: [email protected], [email protected]).

with both internet and Bluetooth services, and those Bluetooth communication modules for home appliances.

Although, Al-Ali and AL-Rousan [1] devised a less expensive Java-based home automation system, a dedicated home server to run Java server pages and Java beans is necessary and the ready-made embedded system board costs about USD$200. Moreover, the Java-based home automation system controls only the on/off states of home appliances. Actually, home appliances may be controlled according to several environment states or a local control algorithm. These situations are not considered in previous results [1-3]. For example, timer control instruction can help user to turn on or off a home appliance after a specific interval of time. Therefore, a low-cost (less than USD$40) home automation module with programmable control instructions (PCIs) and local control algorithms is devised in this paper. These PCIs can also be combined to implement complex functions. This is useful when a home user wants to turn on the light in the living room when either the gate or the garage door is opened, because a logic OR instruction is necessary to implement such a function. Control techniques for temperature, power, etc. can also be built into the PCIs. A remote control and monitor software is also developed to let users control the home automation module on the internet. By using these programmable home automation modules, the users can control more efficiently their home appliances according to the weather conditions, lightness, etc.

II. OVERVIEW OF THE HOME AUTOMATION MODULE The block diagram of the proposed home automation

module with PCIs is shown in figure 1. The hardware and software parts will be described in this section.

A. Hardware The hardware part of the module is a single board

computer and it costs about USD$40 (see table 1 for cost analysis). It consists of the followings:

1. A 8-bit RISC microcontroller (8K Bytes of in-system self-programmable flash memory, 1K Bytes of internal SRAM) which handles all the tasks required to control home appliances according to the environment variables;

2. A multiplexed RS232 port to support communications with other devices (e.g. programmable logic controllers, or GSM modules) and the remote control PC; It is controlled by the microcontroller via a quad bilateral switch IC (CD4066BC);

3. A TCP/IP network module for users to control home appliances and to monitor the security status on the Internet;

IEEE Transactions on Consumer Electronics, Vol. 52, No. 4, NOVEMBER 2006 1240

4. 6 A/D input ports to access the home environment variables, e.g. temperature, humidity, etc.;

5. A multi-purpose I2C/RS232 communication and push button connection port;

6. 4 outputs (3 relay and 1 pulse-width-modulation, PWM) to control home appliances or environment variables;

7. An LCD display to let local users access or change through the push buttons the working conditions of the programmable home automation module;

Fig. 1: The subsystems of the programmable home automation module

TABLE I

COST ANALYSIS OF THE INTELLIGENT HOME AUTOMATION MODULE

Components and subsystems Price USD$

8 bit RISC microcontroller 1.0

TCP/IP module 28.0

20×2 LCD display 3.0

Relay × 4 2.5

7805 and power jack 0.5

temperature sensor circuits 2.5

PCB board 1.0

Total 38.5 The entire hardware prototype circuit of the programmable

home automation module shown in figure 2 is now implemented on a 10cm×10cm printed circuit board.

Fig. 2: The hardware prototype of the programmable home automation module

B. Firmware for the home automation module The structure of the firmware in the programmable home

automation module is shown in figure 3. It is written in assembly language to make it more concise. The firmware is composed of a simple time sharing scheduler and several

application programs to implement those programmable control instructions illustrated in figure 4.

Six tasks about the basic input and output functions of the hardware are implemented by using interrupts. They are 1) timer control, 2) A/D conversions and digital inputs, 3) RS232 communications, 4) digital outputs, 5) maintenance of the interconnections of programmable instructions, and 6) LCD display. The time-sharing task scheduler assign to each task a 20ms time slot in one scan of all the tasks.

All these PCIs and the simple time-sharing task scheduler occupy only 4K bytes of the flash memory.

Fig. 3: Software structure of the firmware in the programmable home automation module

These PCIs are briefly described as follows: 1. The first 2 instructions, ‘Direct Output’ and ‘Direct

Inverting Output’, are used when some monitor input signals are used directly to control some appliances.

2. The logic instructions, ‘AND’, ‘OR’, and ‘XOR’, are provided when an appliance is controlled logically according to more than one monitor input signals. The output of anyone of the logic instruction can also be the input of another logic instruction in order to form a more complex logic function.

3. The ‘Timer control’ instruction has two modes of operation, ‘ON DELAY’ and ‘FLASH’. Once triggered by some monitored signal or the output of another programmable instruction, the first mode can be used to turn on an appliance after a preset period of time. When working in the second mode, the output of the ‘Timer control’ instruction would be turned on and off periodically according to the preset period of time. The first parameter (0 or 1) defines the operation mode, and the second parameter defines how long the time should be to turn on or turn off the output.

4. The ‘Counter control’ instruction has two inputs and a user-defined action value. The first input is used as a clock source, and the second input is used to reset the output to the ‘OFF’ state. The output of the ‘Counter control’ instruction will be turned on when the counter value is greater than or equal to the user-defined action value.

5. The ‘Temperature control’ instruction implements a simple bang-bang temperature control algorithm. When the monitored temperature input signal exceeds the

J.-H. Su et al.: The Design and Implementation of a Low-cost and Programmable Home Automation Module 1241

prescribed value by 1 degree, the output is set to low. When the monitored temperature input signal is lower than the prescribed value by 1 degree, the output is set to high. This is because the resolution of temperature input signal in this instruction is 1 degree.

6. The ‘Serial RS232 port’ instruction is activated to communicate with another device (may be PLC, GSM module, etc.) equipped with RS232 port when the input signal is high. Three bytes of data are used as control parameters for the communication data. The first parameter defines the device type. The number of bytes to be sent via RS232 port is specified in the second parameter. The third parameter contains the data to be sent. The programmable home automation module can automatically calculate the checksum information for error detection purposes.

7. The ‘P control’ instruction is currently used to control any one of the analog input signals with a gain-scheduled proportional (P-type) control algorithm. The reference value is entered in the function block by users. It would be activated by the input signal. The output signal of this instruction is a pulse-width-modulated (PWM) control signal to drive motors, heaters, etc..

Figure 4: 10 programmable instructions implemented in the home automation module

Six bytes of data (defined in table II) are assigned in the firmware to each PCI to preserve the control parameters, and to identify its configuration and interconnections with another instruction. The physical input and output nodes in table II refers to the inputs and outputs of the home automation module, respectively. Only 6 physical inputs and 4 output controls are supported in this version of programmable home automation module due to the limitations of I/O pins of the microcontroller.

TABLE II CODING INFORMATION FOR EACH PROGRAMMABLE CONTROL

INSTRUCTION

Byte no. description

1 Index of programmable control instructions

2(bit7-bit4)

1st input node 0000: physical input node I; 0001: virtual input node X; 0010-0011: virtual I/O node M, C; 0100-1111: reserved

2(bit3-bit0) Node number for 1st input node, 0-15;

3(bit7-bit4)

2nd input node 0000: physical input node I; 0001: virtual input node X; 0010-0011: virtual I/O node M, C; 0100-1111: reserved

3(bit3-bit0) Node number for 2nd input node, 0-15;

4(bit7-bit4)

Output node 0000: physical output node O; 0001: virtual output node Y; 0010-0011: virtual I/O node M, C; 0100-1111: reserved

4(bit3-bit0) Node number for output node, 0-15;

5-6 Reserved for parameters used in timer control, counter control, temperature control, serial RS232 port, and P-control instructions

C. The SMARTPC software The structure of the PC side software, SMARTPC, is shown

in figure 5. It is used to remotely control and monitor the programmable home automation modules. It is written as a menu-driven window program. The username and password are used to identify whether or not the user is authorized to use the SMARTPC program and to access the programmable home automation module. The commands provided by the SMARTPC program are divided into the following 4 groups:

Fig. 5: The flowchart of the menu-driven SMARTPC monitor and control program

1. The first group, SmartPC_set in figure 5, is used to load the background picture of home floor planning and to decide where the sensors and those controlled appliances are placed; The items Sw01-Sw05 and temperature are those 6 inputs supported by the home automation module;

2. The second group, Program_SmartIO, is used to define the interconnections of the PCIs, and to enter the control parameters of the PCIs;

3. The third group, Link_SmartIO, can help users connect

IEEE Transactions on Consumer Electronics, Vol. 52, No. 4, NOVEMBER 2006 1242

to 5 programmable home automation modules by using the same IP address and different port numbers. The connection between the SMARTPC program and the programmable home automation module should be established first such that the interconnection settings and parameter values of the PCIs can be retrieved and changed.

4. The last group, Remote_SmartIO, is used to control the status of the programmable home automation module.

To initialize the SMARTPC program, the user should first load the home floor planning image file which includes all the locations of the sensor inputs and control outputs as the background. The commands in the menu item SmartPC_set shown can be used to put the status signals of the monitoring sensors and control relays. Figure 6 is the screenshot of the SMARTPC program when the status signals of a temperature sensor, and a control relay are put on the image file of the home floor planning.

Fig. 6: The screenshot of the SMARTPC program when the status signals of a temperature sensor, and a control relay are put on the home floor planning image

As can be seen in figure 6, the red light means the door or window is open or the control relay is on, and the green light indicates the opposite meanings. The yellow light is for temperature sensors, and the temperature value is also shown nearby.

To program a user-defined function by using the PCIs shown in figure 4, the user has to use the ‘Key in PI’ command in the menu item Program_SmartIO. The screen in figure 4 will be ready for users to specify what the inputs and outputs of the PCIs are, and to enter the control parameters values.

Figure 7 shows an example of a user defined function which asks the programmable home automation module to control a GSM module via the RS232 communication port to send an alarm signal when the door and window of the 1st floor (I3 and I4), and the window of the 2nd floor are opened (I2). The OR function block is used twice to find out whether or not the door or windows are opened. When either condition happened the communication is activated to send out an alarm signal.

Fig. 7: The user defined function in the home automation module by using the programmable instructions

Table III lists the assembly codes for the first operation mode ‘ON DELAY’ of the programmable ‘Timer control’ instruction and shows how it is implemented in the firmware of the programmable home automation module. The corresponding flowchart is also shown in figure 8.

TABLE III ASSEMBLY CODES FOR THE FIRST OPERATION MODE OF THE TIMER

CONTROL INSTRUCTION ;----------------------------------------------- ; ON DELAY TIMER SUBROUTINE ; ---------------------------------------------- ; R2:INPUT1 I3 I2 I1 I0 N3 N2 N1 N0; TEMP1,TEMP2 ; R3:OUTPUT O3 O2 O1 O0 W3 W2 W1 W0; TEMP3,TEMP4 ; R4:VALUE V7 V6 V5 V4 V3 V2 V1 V0; ; ---------------------------------------------- TMR1_START: ;SEI MOV TEMP1,R2 MOV TEMP2,R2 ANDI TEMP2,0b00001111 SWAP TEMP1 ANDI TEMP1,0b00001111 RCALL INP_START CPI TEMP1,0 BRNE TMR1_1 MOV R28,R12 MOV R29,R13 ST Y,R14 ;R5 VALUE LDI R30,0x10 LDI R31,0x01 MOV TEMP1,R1 SWAP TEMP1 ANDI TEMP1,0x0F ADD R30,TEMP1 CLR R4 ST Z,R4 RJMP TMR1_OFF TMR1_1: LDI R30,0x10 LDI R31,0x01 MOV TEMP1,R1 SWAP TEMP1 ANDI TEMP1,0x0F ADD R30,TEMP1 LD TEMP1,Z CP TEMP1,R4 BREQ TMR1_ON CP R14,R5 BREQ TMR1_OFF INC TEMP1 ST Z,TEMP1 MOV R28,R12 MOV R29,R13 ST Y,R14 CP TEMP1,R4 BREQ TMR1_ON TMR1_OFF: MOV R28,R12 MOV R29,R13 ST Y,R14 MOV TEMP3,R3 MOV TEMP4,R3 ANDI TEMP4,0b00001111 SWAP TEMP3 ANDI TEMP3,0b00001111

J.-H. Su et al.: The Design and Implementation of a Low-cost and Programmable Home Automation Module 1243

RCALL OUP_START LD R1,Z AND R1,TEMP3 ST Z,R1 RET TMR1_ON: MOV R28,R12 MOV R29,R13 ST Y,R14 MOV TEMP3,R3 MOV TEMP4,R3 ANDI TEMP4,0b00001111 SWAP TEMP3 ANDI TEMP3,0b00001111 RCALL OUP_START LD R1,Z OR R1,TEMP4 ST Z,R1 RET

Fig. 8: The flowchart for the first operation mode of the timer control instruction

III. HOME AUTOMATION EXPERIMENTS A remote temperature control experiment is used in this

section to illustrate how the SMARTPC program remotely configures the PCIs in the programmable home automation module to control the water temperature. The hardware setup shown in figure 9 includes a PC running the SmartPC program, the proposed programmable home automation module, a TCN75 temperature sensor, a water tank, a relay and a heater.

In this experiment, the water temperature of the water tank is sensed through the temperature input port, and the PWM output of the PCI, P-control, is assigned to the second output port (O2). Once initiated, the home automation module uses the user input parameter in the P-control instruction as the reference value to control the water temperature via the heater. The control algorithm used in the P-control instruction to obtain the PWM control signal is a simple gain-scheduled P-type controller. When the temperature value is below the reference by 2 degrees, the PWM control signal for the heater

will be always high. If the physical temperature is lower than the reference value and the difference is within 2 degrees, the duty ratio of the PWM control signal is proportional to the value of the error. The heater will be turned off if the physical temperature value is larger than the reference value.

Figure 10 shows the water temperature values of the water tank during the experiment. The non-smooth curve of the temperature values in figure 10 is due to the resolution limitation of the temperature sensor TCN75. The performance is good in spite of the simple control algorithm.

Fig. 9: The hardware setup of the remote water temperature control experiment

Fig. 10: The temperature values of the water in the tank during the experiment

IV. CONCLUSION A low cost programmable home automation module with

PCIs is proposed in this paper. Although 10 PCIs are included in current version of programmable home automation module, there is still room (about 4Kbytes) reserved for another 10 PCIs. The cost of the TCP/IP communication module can also be further reduced if stand-alone Ethernet controller solution [4] is used. These will be done in the near future.

REFERENCES [1] A. R. Al-Ali, M. AL-Rousan, “Java-Based Home Automation System,”

IEEE Transactions on Consumer Electronics, vol. 50, no. 2, pp. 498-504, May 2004.

IEEE Transactions on Consumer Electronics, Vol. 52, No. 4, NOVEMBER 2006 1244

[2] A. Alheraish, “Design and Implementation of Home Automation System,” IEEE Transactions on Consumer Electronics, vol. 50, no. 4, pp. 1087-1092, Nov. 2004.

[3] H. Kanma, N. Wakabayashi, R. Kanazawa, H. Ito, “Home Appliance Control System over Bluetooth with a Cellular Phone,” IEEE Transactions on Consumer Electronics, vol. 49, no. 4, pp. 1049-1053, Nov. 2003.

[4] Microchip technology Inc., Stand-Alone Ethernet Controller with SPI Interface ENC28J60 datasheet, 2006.

Juing-Huei Su (S’87-M’93) was born in Tainan, Taiwan on February 17, 1965. He received his B.S., M.S. and Ph.D. degrees all in electrical engineering departments, from the National Taiwan University, Taipei in 1987, 1989, 1993, respectively. From 1993 to 1995, he served as a military officer in the army. In 1995, he was a senior engineer in the Taian Electric Co. Ltd. Since 1996, he

has been an associate professor in the Department of Electronic Engineering, Lunghwa University of Science and Technology. Currently, his research interests include digital control of power electronic systems, and the applications of microcontroller and embedded systems.

Chyi-Shyong Lee received his B.S., and M.S. degrees in electrical engineering departments, from the National Taipei University of Technology, and the National Tsing Hua University, in 1979, and 1985, respectively. From 1985 to 1988, he served as a lecturer in the Hwa Hsia Institute of Technology. Since 1989, he has been an lecturer in the Department of Electronic Engineering,

Lunghwa University of Science and Technology. Currently, his research interests include digital control of power electronic systems, and the applications of microcontroller and embedded systems.

Wei-Chen Wu was born in Tainan, Taiwan on February 11, 1968. He received his B.S. degree in the electrical engineering department and M.S. degree in the electronic engineering department, from the Lee-Ming Institute of Technology and Lunghwa University of Science and Technology in 1987 and 2006, respectively. From 1993 to 2003, he served as a software engineer and product

manager in the Taian Electric Co. Ltd. Since 2004, he has been a deputy manager in the Phihong Technology Co., LTD. Currently, his research interests include home automation systems, and the applications of microcontroller and embedded systems.


Recommended