# Design and Application of a Smart Lighting System Based on Distributed Wireless Sensor Networks
## 3 Materials and Methods  
### System Overview  
The architecture of the smart lighting system is depicted in Figure 1. As shown in Figure 1, one LED luminaire is equipped with one sensing module and contains one or more LED sources. The specifications of LED luminaires are depicted in Sections 4.1 and 4.2. Each module consists of two occupancy sensors, i.e., a PIR sensor and a microwave Doppler sensor, an ambient light sensor, a microcontroller (MCU), and a wireless transceiver. As shown in Figure 1, the power of a sensing module is provided by a LED driver, and the dimming level, which is the output of the sensing module, determines the value of a pulse-width modulation (PWM) signal used for analog dimming of the LED. In the mesh topology, the sensing modules communicate wirelessly through a ZigBee-based network. In Figure 1, a network node represents a sensing module with a belonging LED. All the nodes in the network denote routers, and each node maintains its one-hop neighbor table, where neighbors are identified using the Received Signal Strength Indicator (RSSI) value. Two gateways are deployed for every 500 nodes, which transfer data between ZigBee networks and servers. The transferred data include work states of LEDs and commands to directly dim a group of LEDs or a single one.  
In the architecture, the LED driver is a crucial device, and a constant current driver with PWM dimming control is selected as the LED driver. First, it converts the incoming 50 HZ alternating current (AC) line power at voltage of 220 V to the regulated direct current (DC) output current to the LED. Second, the driver provides an auxiliary output voltage to power the sensing module through VCC and GND pins, shown in Figure 1b. Third, the dimming level determined by lighting control strategy in the MCU of the sensing module is converted to an analog signal level, which is input to the driver to control the level of the LED brightness. Figure 2 shows a simple example of the interaction between a LED luminaire and its colocated sensing module. When sensing module 1 detects occupancy, as a result of its control strategy the dimming level of LED luminaire 1 is set to 100%. At the same time, as its neighbor luminaire 2 and 3 are informed to dim up to 100%. The control strategy is detailed in Sections 3.2 and 3.3.  
One of the aims of this work is to design a control system that can reduce the energy consumption of the lighting system using a scalable, low-power, and standardized sensor network for commercial applications. Due to the advantages of being low cost and low power, ZigBee is suitable for a sensor network. The ZigBee protocol stack consists of four main layers: physical layer, medium access control layer, network layer, and application layer. The network layer of ZigBee can have star, tree, or mesh  
Figure 1: The architecture of the smart lighting system: (**a**) a wireless sensing module, (**b**) a LED luminaire controlled by a sensing module through LED driver, and (**c**) a wireless mesh network composed of sensing modules and a gateway.  
Figure 2: A simple example of lighting control according to occupancy information with neighbor assistance.  
topology, as shown in Figure 3. Specifically, each node in the proposed lighting system has a routing capability, so end devices are not necessary to be used in the network. The mesh topology is more suited for wireless lighting control than the other two topologies because neighbors in one-hop of the node that detects occupants can be easily found through searching the neighbor table and ignited to resolve the underillumination problem. On the contrary, a node in a star or tree network stores only the address of its parent node. The mesh ZigBee network is realized using the CC2530 system-on-chip of Texas Instruments. The CC2530 has functions of radio frequency transmitting and receiving and the ZigBee stack.