# Design and Application of a Smart Lighting System Based on Distributed Wireless Sensor Networks
## 3 Materials and Methods
### Occupancy Sensing and Daylight Sensing  
PIR sensors and microwave Doppler sensors are commonly used for occupancy sensing. A PIR sensor is an electronic sensor that detects infrared light radiated from targets in its field of view (FOV). In the proposed system, the RE46 BN-P PIR sensor is used, and its specifications are listed in Table 1. When a person enters the sensing range of the sensor, the output voltage is 5.5 V, and when people leave the sensing range, the output voltage automatically decrease the high level. The sensing circuits are enclosed in a metallic can to protect them from environmental interference, such as noise, humidity, and external electromagnetic fields. A microwave Doppler sensor utilizes the Doppler effect to detect moving targets. The MS-220 is used, and its specifications are also listed in Table 1. When motion is detected, the sensor's TTL-level output pin switches from low (0 V) to high (3.3 V) for a finite time (2-3 s) before returning to its idle (low) state. To improve the performance of occupancy detection, a data fusion method is developed using the data collected by the PIR and microwave sensors. The main flowchart of the data fusion method is presented in Figure 4, where it can be seen that at the beginning, the microwave sensor is switched off, and the PIR sensor passively detects infrared radiations. When a person enters the sensing area, the PIR sensor produces a high-level output, and the microwave sensor is activated. At the same time, a timer is set to zero and starts counting. Once the sensor detects a person in the sensing area, the timer will be reset to zero and restart counting. If the value of the timer is greater than a threshold value \(T_{0}\), it is considered that the area is unoccupied and the microwave sensor can be put in the sleep mode. After the microwave sensor wakes up, the occupancy sensing result is determined based on the microwave sensor output. There are two reasons why the PIR sensor output is used to control the microwave sensor. First, PIR sensors have fairly low power consumption, and when people walk \begin{table}
\begin{tabular}{l l} \hline \hline
**Sensor** & **Specification** \\ \hline \multirow{3}{*}{PIR sensor (RE46 BN-P)} & Maximum sensing angle: 132\({}^{\circ}\) \\  & Operating wavelength: 5–14 \(\upmu\)m \\  & Operating temperature range: \(\sim\)30 to 70 \({}^{\circ}\)C \\ \hline \multirow{3}{*}{Microwave doppler sensor (MS-220)} & Maximum sensing angle: 360\({}^{\circ}\) \\  & Sensing distance: adjustable \\ \cline{1-1}  & Operating temperature range: \(\sim\)35 to 75 \({}^{\circ}\)C \\ \hline \multirow{3}{*}{Illuminance sensor (BH1750 FVI)} & Detection range: 0–65 525 k \\ \cline{1-1}  & Operating temperature range: 40–85 \({}^{\circ}\)C \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Specifications of the sensors installed in the sensing module. Figure 3: ZigBee network topologies: (a) star, (b) tree, and (c) mesh. into their sensing area, their accuracy rate is high. However, PIR sensors are prone to error detection of small movements when people stay in the sensing area. Second, microwave sensors are highly sensitive, so they are prone to be triggered falsely when used alone, but they are well suited for little movement detection. Interior artificial lighting can be reduced when there is daylight, thus reducing energy consumption. Therefore, light sensors are utilized to capture the illuminance value of daylight in the external environment, and measured values are sent to the sensing modules through the wireless sensor network. Ambient light sensors are sensors of light, which convert light photons into the current. One type of light sensor is a photodiode that is sensitive to sunlight radiation. The BH1750 FVI light sensor based on the photodiode is used in the proposed system. The BH1750 FVI is a low-cost digital ambient light sensor with low power consumption, wide detection range, and high detection resolution. The output voltage is converted to digital 16-bit data representing the illuminance of light.