//Logo Image
Author: Che-Chang Yang (2010-06-26); recommend: Yeh-Liang Hsu (2010-06-27).

Design of detectors for monitoring activities of daily living

This document describes the design of detectors for monitoring activities of daily living (ADL) in the home environment, including the human movement detector and the appliance usage detector. The human movement detector is for detecting human movement in space and the appliance usage detector is for detecting the use of home appliances.

1.     Design of the human movement detector

The human movement detector is a device for detecting human movements within a sensitive range. When a subject moves, the passive infrared sensor (PIR) is triggered. The movement count will be periodically and automatically transmitted to the distributed data server (DDS).

1.1  Schematic design

Figure 1 shows the system block diagram of the human movement detector. The detailed schematic design of this system is shown in Figure 2 to Figure 4. All the components inside this detector can be powered by DC3.3V, except the pyroelectric infrared (PIR) sensor module (KC7783R) requiring at least DC4V. Therefore this detector is DC5V-powered from an AC-DC power adaptor. A voltage regulator (LM3940, National Semiconductor) is used to convert DC5V input power to regulated DC3.3V power. The DC5V input power is also bypassed to the PIR sensor module.

The PIR sensor module is used to detect the existence of human movement. The module uses a master PIR control chip (KC778B, COMedia Ltd.) for signal amplification and logic control. The PIR sensor is covered by a Fresnel lens that the incident IR can be uniformly distributed onto the sensor. When human movement exists within the sensitive range of the PIR sensor module, the module asserts a high (as its supply power) in its module output; otherwise the output is zero (GND).

The processing core of this detector is the PIC microcontroller (PIC18LF6722, Microchip Co.). It is in a 64-pin plastic thin quad flatpack (TQFP) package and provides basic and advanced functions in signal input/output, A/D conversion, data communication and processing. The output of the PIR sensor module is connected to a digital input channel (PortB, RB5) of the PIC microcontroller. Note that an optional channel of serial SCK (Port RB1) and DATA (Port RB2) is reserved for connecting a digital humidity and temperature sensor (SHT7x series, Sensirion AG) when the environmental parameters are required.

A watchdog (WD) timer (MAX6369, MAXXIM) can also be optionally activated if external timing is required. In this design, the WD timer is a sleep mode switch of the PIC microcontroller. The pin RA4 of the PIC microcontroller normally outputs high (as VDD) and low (zero as GND) periodically per time interval while functioning. The watchdog input (WDI) of the WD Timer reads the status (high or low) of the pin RA4 to determine whether the PIC microcontroller is in run mode or in sleep mode. The WD timer starts timing when the PIC microcontroller is in sleep mode of which the pin RA4 stops changing its alternating high/low status. If the watchdog timeout (WDt) expires, the WD timer asserts a low output at its watchdog output (WDO) which is connected to the pin RB0 of the PIC microcontroller. The low status at pin RB0 activates the PIC microcontroller to return to run mode. The WDt can range from 1s to 180s. The setting can be configured with a 3-bit logic selector.

The PIC microcontroller offers two serial RS-232 channels that the COM-A is for communicating with PCs or any other compatible devices, and COM-B is internally connected to the ZigBee RF Module (XBee Series 2 OEM RF module, Digi International) for wireless data communication and wireless sensor network (WSN). The ZigBee RF module is compatible with IEEE 802.15.4 “ZigBee” protocol operating in 2.4GHz with data rate up to 250kbps. This ZigBee RF module features the capabilities of point-to-point, and multi-mesh wireless networking, with the maximum data transmission range of 40m (indoor) and 120m (outdoor) between each node. The ZigBee RF module is in sleep mode, it can be “waken” by a low status (GND) at the pin RB3 of the PIC microcontroller. The ZigBee RF module is in sleep mode when the pin RB3 is high.

Figure 1. System block diagram of the human movement detector

Figure 2. Schematic of the human movement detector (1)

Figure 3. Schematic of the human movement detector (2)

Figure 4. Schematic of the human movement detector (3)

1.2  PCB design, space layout and finished product

Figure 5 shows the PCB design and overall space layout of the human movement detector which uses a universal case (RH3135) of the dimension 120×70×25(mm). Note that if this device serves as a temperature/humidity monitor without using the PIR sensor module, a battery pack of two AA or three AAA batteries can be stored inside this box, occupying the position of the PIR sensor module. The space for the SMA 2.4GHz antenna of the ZigBee RF module is also reserved. Figure 6 shows the finished products of the PCB and the device assembly.

Figure 5. The PCB design and space layout of the human movement detector

Figure 6. The PCB and the product

2.     Design of the appliance usage detector

The appliance usage detector is an intermediate device between a main AC outlet and the appliance to be monitored. It can detect the use of single or multiple main-powered home appliances. The appliance usage detector senses the AC current consumed by the appliances. A specific threshold of AC current is given to determine the on/off status of the appliances, indicating whether the appliances are in use or not. This detector can periodically transmit the count signals to the DDS when the appliances being monitored are in use.

2.1  Schematic design

Figure 7 shows the system block diagram of the appliance usage detector and Figure 8 to Figure 10 show the schematics of the detector. An AC-DC switching power supply unit (A5-110915B) is used to provide the circuit with DC5V from any AC power input from 100-240V/50-60Hz. This AC-DC power supply has a PCB-mount package so that the module is small and can be integrated onto a PCB. A voltage regulator (LM3940) outputs a regulated DC3.3V power from DC5V power. A replaceable fuse is used to protect the whole circuit against power overload, electrical shock, short circuit or any electrical failure that might damage the detector.

The schematic design is similar to that of the human infrared detector, except that the sensor is replaced by a CT (current transducer/transformer) that can be soldered on a PCB. The CT (CTL-6-P-4-H, U_RD) is a small transformer to sense the AC current in the power line bypassed from the input power. The CT output voltage is small and therefore an amplifier circuit based on LM358 OPA is used. The amplified CT output is then directed to the pin RA0 of the PIC microcontroller for 10bit A/D conversion. Note that the load resistor R4 coupled to the CT output (Figure 8) determines the sensitivity of the CT raw output. The larger resistance that resistor is used, the more sensitive the CT outputs. But a more linear response at the CT output can be obtained when the resistance of the resistor is kept low. Typically a 10Ω resistor is used. The OPA output level can be adjusted with the resistor R5 and R6.

Figure 7. The block diagram of the appliance usage detector

Figure 8. The schematic of the appliance usage detector (1)

Figure 9. The schematic of the appliance usage detector (2)

Figure 10. The schematic of the appliance usage detector (3)

2.2  PCB design, space layout and finished product

Figure 11 shows the PCB design and space layout of the appliance usage detector. The dimension of the housing is 125×85×55(mm). This detector has an IEC type AC inlet for connecting a power cord to mains power line. There is also an IEC type AC socket on the top side of the detector for connecting the power cord to the appliances to be monitored. Figure 12 shows the PCB and the finished product of the electricity detector.

Figure 11. The PCB design and space layout of the appliance usage detector

Figure 12. The PCB and finished product of the appliance usage detector

3.     Operation of the detectors

Figure 13 illustrates the flowchart of the common program code for both the human movement detector and appliance usage detector. The detector type (human movement detector or appliance usage  detector) must be assigned in the program for correct functioning. If the detector type is assigned as the human movement detector, the program will ignore the functions associated with the appliance usage detector, and vice versa.

Figure 13. The common program flowchart of the detectors

In addition, both detectors use common format and protocol in wireless data transmission in Process P4. Table 1 shows the data protocol with an example of data sequence. A complete data sequence contains 11 ASCII characters. The initial (SN.1) and end characters (SN.11) are always “0x71” and “0xFF”, respectively. Both the characters are used as flags to indicate a complete and a valid data sequence. When DDS receives and screens a data stream, the characters between the initial and end addresses are identified. Except the both flag characters, the first character is a register for sensor ID, which may range from “0x01” to “0xFF”. Each ADL detector has unique sensor ID in a wireless sensor network. The other following 6 characters (SN.3 to SN.8) are temperature and humidity readings. For example, in temperature reading characters “2 5 8” mean 25.8°C, and “5 5 7” in the humidity reading characters mean 55.7%RH. The character SN.9 and SN.10 are for ADL register. The SN.9 is given for human movements and SN.10 for appliance use. A 0x30 accounts for “none movement (off)” and 0x31 accounts for “movement exists (on)” in SN.9. In SN.10, a 0x30 indicates “off” and 0x31 indicates “on” of the appliance.

Table 1. The data format and protocol in wireless data transmission

SN

Address

Descriptions

1

0x71

Initial character

2

0x01

Sensor ID, from 0x01, 0x02, …

3

2

Temperature value [1]

4

5

Temperature value [2]

5

8

Temperature value [3]

6

5

Humidity value [1]

7

5

Humidity value [2]

8

7

Humidity value [3]

9

0x31

Movement count. ON: 0x31; OFF: 0x30

10

0x30

Appliance use count. ON: 0x31; OFF: 0x30

11

0xFF

End character

For a human movement detector, the PIC microcontroller read the output of the PIR sensor module twice (P2) to determine whether human movement exists. The first reading is registered in S1, and then is followed by a one second delay. The second reading is registered in S2. Decision D3 determines whether human movement exists according to the lookup table in Table 2. Note that a “0” stands for “off” and “1” stands for “on” for the status S1 and S2.

If both S1 and S2 are zeros, the output is 0x30 that indicates “no movement exists”. In other cases the outputs are 0x31 showing movement exists. If human movement exists (the output is 0x31), the PIC microcontroller will then retrieve the temperature and humidity readings of SHT75 sensor in Process P3. The character 0x31 with the temperature and humidity readings will be transmitted wirelessly via the Zigee RF module to the DDS according to the data protocol described in Table 1, and the system returns to the beginning to repeat the procedure and function. In the absence of any human movement, the human infrared detector does not transmit data but will report the temperature and humidity readings every one minute interval (as shown in Decision D3, D4 and Process P3). The readings with the movement count 0x30 are also transmitted via the ZigBee RF module to the DDS.

Table 2 The lookup table for PIR status to determine movement

PIR status

S1

S2

Output

0

0

0x30

1

0

0x31

0

1

1

1

For the appliance usage detector, the PIC microcontroller reads the CT output (P1) and then determines the on/off status of the appliances. A voltage threshold is required here to distinguish whether the appliance is in use or is switched off /standby mode. This threshold should be manually selected in the program according to the operational and electrical characteristics of the appliances. If the CT output exceeds the threshold, the appliance is deemed switched on (in use). The count 0x31 will be transmitted to the DDS via the ZigBee RF module and then the procedure repeats continuously in every 6-second interval. In other words, if the detector is continuously triggered and transmitting the counts, the DDS will receive 100 event counts per 10-minute period.

Appendix: Bill of material lists of the ADL detectors

Table A1. Human movement detector

Designator

Part/item

General footprint

Note

U1

LM3940

TO-220

 

U2

PIC18LF6722

 

64-pin TQFP

U3

MAX6369

SSOP-8

 

U4

XBee Series 2 OEM RF module

 

2.0-pitch pin

J1

DC connector

 

 

J2

Connector

CON3

Single-inlet 2.54-pitch (F)

J3

CON6

J4

CON3

J5

 

Single-inlet 1.27-pitch (F)

BT1

CR2032 socket

 

 

D1

LED

0805

 

D2

 

Y1

XTAL

HC-49

10MHz

R1, R2

Resistor

0805

 

R3, R5

2.2kΩ

R4

100Ω

R6, R10

10kΩ

R7

2kΩ

R9

20kΩ

C2

Capacitor

0805

33uF

C3, C7, C8

0.22uF

C4

0.01uF

C5, C6

22pF

S1, S4-S6

Switch

CON2

2.54-pitch pin

S2, S3

 

 

Table A2. Appliance usage detector

Designator

Part/item

General footprint

Note

U1

LM2940

TO-220

 

U2

LM3940

TO-220

 

U3

PIC18LF6722

 

64-pin TQFP

U4

LM358

DIP8

 

U5

XBee Series 2 OEM RF module

 

2.0-pitch pin

J1

AC inlet

 

IEC type

J2

Switching power supply

 

 

J4

Connector

CON6

Single-inline pin socket (F)

J5

CON3

RS-232

J6

AC outlet

 

IEC type

F1

Fuse

 

6×30mm, 250V 10A(T)

Y1

XTAL

HC-49

10MHz

S1

Switch

CON2

 

S2

 

 

S3

 

D1

LED

0805

SMD

D2

SMD

CT1

CT

 

CTL-6-P-4-H

R1, R3

Resistor

0805

2.2kΩ

R2

0805

100Ω

R4

AXIAL0.3

10Ω

R5

10kΩ

R6

270kΩ

R7

0805

2kΩ

C1

Capacitor

0805

0.47uF

C2, C3

33uF

C4, C5

22pF

C6

0.1uF, or 0.22uF

C7

0.01uF

C8, C9

0.22uF

C10

RB.2/.4

470uF