Keywords

1 Introduction

Home lighting composed of various connection modes plays an important role in the lighting market as well as in daily life [1]. The connection modes of home lighting control networks can be divided into two types: i.e. the wired and the wireless. The inflexible layout of cable way causes high installation costs; alternatively, most wireless protocols are private which also leads to high product and maintenance costs. Under these circumstances, the ZigBee alliance issues ZLL standard [2], which includes many advantages of ZigBee Pro, such as low cost, low power consumption, easy installation, easy extensibility, etc. Meanwhile, the ZigBee cluster library (ZCL) has been extended. For instance, the addition of the Touchlink function with coordinatorless system configurations can establish a ZLL network with the use of only one button.

In this work, in order to promote the ZLL protocol, DALI was selected as an expanding control object with which to design a ZLL-DALI gateway, which exhibits the characteristics of low development cost, open protocol and easy extensibility. Additionally, a self-built small-scale ZLL-DALI lighting system was realized.

2 Format of ZLL and DALI Data Frame

Based on ZigBee PRO, ZLL extends and standardizes the network, security and application layers. Nodes of coordinatorless ZLL systems communicate with one another via certain clusters provided in the ZCL. For instance, the ZLL commissioning cluster is used for the basic commissioning of a new network or adding a new node to an existing network; the on/off cluster is used to establish certain nodes in the “on” or “off” states, or toggle between the two states. The format of the ZLL data frame is depicted in Fig. 1. Compared to the ZigBee PRO data frame format, the APS (Application Support Sublayer) of ZLL is divided into ZCL headers and ZCL payload [2].

Fig. 1
figure 1

Format of the ZLL data frame

DALI uses a Manchester encoded unidirectional serial protocol with a transmission rate of 1.2 kHz. There are two types of data frames. The frame transmitted from the main control unit to the DALI slave unit is a forward information frame; the alternative is a backward information frame. The former is composed of 19 binary bits, including one start bit, 8 address bits, 8 data bits and two stop bits; the latter is composed of 11 bits, including one start bit, 8 data bits and two stop bits [3, 4].

3 Design of ZLL-DALI Gateway Hardware

Considering the comprehensive cost and performance, the proposed design abandons the traditional dual chip solution [57], which realizes wireless transceiver functions and MCU (Microcontroller Unit) architecture, respectively, with two separate chips, and then adopts the CC2530 single chip solution. CC2530 incorporates an IEEE802.15.4 RF transceiver, enhanced 8051 CPU and 8 KB SRAM, etc. Therefore, CC2530 is an ideal SoC controller to realize related applications of IEEE802.15.4/ZigBee. The hardware diagram of the ZLL-DALI gateway is shown in Fig. 2.

Fig. 2
figure 2

Structure of hardware layer

The power supply module provides dual voltages: 12 V for DALI bus, and 3.3 V for MCU. The CC2530 core board schematic diagram refers to the resolution of TI [8]. The built-in RF transceiver will convert ZLL frames received from the air into DALI frames, then transmit them to the DALI device via the pin of IO-TX (Input/Output Transmit). Additionally, it can send the ZLL frame transferred from the DALI feedback data frame to ZLL equipment.

To achieve the mutual conversion between the TTL and DALI electrical levels, the DALI interface circuit was adopted, as shown in Fig. 3 [9, 10]. When IO-TX is 0, Q2 will be in the conduction state and Q1 in the closed state, so that the DALI bus is characterized at a low level; when IO-TX is 1, Q2 is in a closing state, Q1 is in a conduction state, and the DALI bus is characterized at a high level. Q3 limits the maximum current of the DALI bus, because when the bus current exceeds 250 ma, the partial pressure of R5 can force Q3 to conduct and Q1 to close. R3, R4 and LM311 compose the hysteresis comparator. Compared with a single-limit comparator, a hysteresis comparator has a strong anti-interference ability. The cooperation of the hysteresis comparator and inverter can successfully transfer the DALI electrical level to the TTL (Transistor-Transistor Logic) level.

Fig. 3
figure 3

Interface circuit of DALI

4 Design of Gateway ZLL-DALI Software

The software structure of the ZLL-DALI gateway is shown in Fig. 4. The programming employed is IAR Embeddded Workbench. This software was designed based on the API functions in Z-Stack Lighting 1.0.2. Such a gateway joined the network by using zllTarget_PermitJoin(), called zcl_SendCommand(), to submit messages to the ZLL node. Meanwhile, the HAL_ISR_FUNCTION() function was also used to submit messages to the DALI node.

Fig. 4
figure 4

Structure of software layer

The following three points should be taken into consideration in the software design process.

  1. 1.

    Due to frame format differences, the encoding method and baud rate of the two protocols, and the lack of a hardware transceiver for the built-in DALI CC2530, the software simulation method was adopted to realize the conversion between the two types of protocol. To reduce communication conflict caused by data error, following avoidance mechanism was adopted: dali_rx_status and dali_tx_status were used to switch the variable to identify the sending and receiving state of DALI at different times.

  2. 2.

    The ZLL-DALI gateway is a derivative node of the ZLL network as well as a device of the DALI system. The APS address based on the ZLL protocol stack and DALI slave device are different. Hence, an address adaptation function was established in APS to match them.

  3. 3.

    To address the method by which the DALI slave device can adopt odd or even values, an addressing mode was employed. When the value of the address bit is even, a data bit represents the voltage level (0–255); otherwise, a data bit represents the voltage level or the commands of the scene controlling, group controlling and status query, etc. This paper utilizes the odd value method of address.

5 Validation Test

To verify the feasibility of the ZLL-DALI gateway, a small ZLL-DALI lighting system was built, which included a ZLL remote controller, a ZLL-DALI gateway and a DALI slave module. According to the test results, the controller was able to successfully send control information to the DALI slave module through the ZLL-DALI gateway, which could control RGB tricolor LEDs with the methods of separate control, group control and scene control and could query the communication status of the DALI device. Figure 5 shows the signal of the DALI bus when the controller sent the communication status query command to the DALI slave. According to DALI protocol, the device, of which the address value is 0x07, is operating at normal communication status.

Fig. 5
figure 5

Waveform of communication status query

6 Conclusion

With the development of communication technology, the demand of intelligent and wireless home lighting is ever increasing. This work demonstrated the high practical value of the ZLL-DALI gateway design, which not only expands the topology of the lighting network, but also paves the way for the scalable fabrication of low-cost home lighting products.