Give away medical masks when you place an order. learn more

Lighting the Way, Securely


As the Internet of Things (IoT) grows, more and more applications are being discovered, as objects that were once considered standalone now become part of a wider connected network. While such expansion has the ability to improve lives and efficiency, it also comes with a danger; if it is connected then there is a route for unwanted access.

One of the early applications for the IoT is the connected home or workplace, including the control of heating and, as this article will show, lighting. Lighting is a key aspect of the smart home or factory. Wireless remote control of lighting will become an integral part of a smart building installation. This article will look at how such a network can be set up and, just as importantly, how it can be protected from unwanted access. The pros and cons of the various wireless standards will be considered and practical design tips will be given for setting up some aspects of the network.

Protocols and standards

There are various protocols and standards that govern wireless transmission and the choice is widening all the time as companies prepare for a rapidly expanding IoT. The most used is the OSI open systems interconnection model that breaks the data exchange into functional layers: the link layer converts bits into radio signals, handles data framing for wireless communications and manages access to radio channels; the network layer routes data through the network; the transport layer handles communications between applications running on two ends of the network; and the applications layer takes care of data formatting.

If devices have to be connected to the Internet they should use IP (internet protocol). However, in a local network, such as in a home where it is being used to control the lighting and other aspects, non-IP methods can be used with IP only becoming important when the communications go through an Internet gateway to the outside world. However, some argue that it is better to give every device an IP address and run IP even in the home network; others say this makes it all too complex. The jury is still out on that one.

As to the network standard, Wi-Fi is an obvious choice, as it is probably in the home already linking computers, tablets and smartphones. It was once considered too cumbersome for IoT applications, but recent silicon devices and modules have removed some of those barriers. The addition of Bluetooth Low Energy – also known as Bluetooth Smart – to the Bluetooth portfolio has added to the case for using this technology in a home network; again because it is already there in phones and computers. This also makes it a good technology to link the home network to the Internet via a smartphone or computer.

Growing in popularity for home networks, and many believe this will become the most popular, is ZigBee. This is a mesh network and is low power and low cost. One of the nodes in the mesh would need to be a gateway to the wider Internet. For those who want every device to have an IP address, including the lights, 6LoWPAN may be the answer. This uses IPv6 and was created for the IoT. It is fairly new and it is not yet clear how popular it will become.

Deploying wireless networks

A mesh radio system such as ZigBee has the advantage that it can be set up in both new and existing buildings; and NXP, for example, has a range of devices using a single JN51xx chip that can be used to build a network based on ZigBee, JenNet-IP and IEEE 802.15.4, on which ZigBee and others are based. The MAC sublayer, if used properly, can provide a level of secure communications suitable for a home network. However, there is an insecure MAC mode and its use depends on the level of security needed.

Wireless microcontrollers, such as the JN5168, are designed to operate in the 2.4 GHz radio band, which is an ISM band available worldwide. An IEEE 802.15.4-based network may have to share its frequency space with systems such as Wi-Fi, video distribution, Bluetooth and cordless telephones. However, the IEEE 802.15.4 protocol is well suited to shared-band operation. It has sixteen separate channels that allow the system to choose a channel that is not being used by others. Figure 1 shows an example of ISM band sharing.

Figure 1: ISM band sharing: It is usually possible to find channels that are not used by WLAN systems.

Digitally Addressable Lighting Interface

The Digitally Addressable Lighting Interface (DALI) has emerged as a standard in Europe to address growing power issues, mostly for commercial and industrial purposes. DALI is part of the IEC 60929 specification, and relates specifically to digitally-controlled dimmable fluorescent ballasts. Such ballasts can run at lower power levels than standard magnetic ballasts.

There are no specifications or recommendations on how to implement a circuit design for DALI. The following optically-isolated circuit interfaces a Microchip PIC16F1947 to the DALI bus. The circuit diagram is shown in Figure 2.

Figure 2: Isolated communications circuit diagram.

DALI uses Manchester (bi-phase) encoding to send the start and information bits. The information rate is 1200 bps with an acceptable range of ±10%. One bit time is 833.33 μs. The most significant bit is sent out first. Any packet sent between the control device and control gear is a bi-phase Manchester encoded packet. The packet is then decoded, and the address and messages are then processed accordingly. A lighting communications board can be created using a PIC16F1947 with an isolated DALI communications circuit interface and a simple power supply.

Since the signal from the DALI bus is inverted by the optocoupler, this is how the PIC microcontroller views the Manchester encoding and decoding: The Manchester code is a digital encoding format in which symbol ‘1’ is represented by a falling edge (high followed by low), and symbol ‘0’ is represented by a rising edge (low followed by high). Both the high and low pulses have equal width, which is equal to half the bit period.

Manchester decoding is more complicated than encoding. As the reception starts, the receiver, whether it be the control gear or the control device, makes sure the packet is received in its entirety, starting with the start bit, then an 8- or 16-bit message and, finally, at least two idles to indicate the stop bit. The decoding is done using the external interrupt pin RB0 on the PIC16F1947. This pin is used to generate an interrupt every time the phase of the incoming signal changes. A timer generates an interrupt every 3/4th of the bit, so the value is measured at that point, and that decides whether the bit is a ‘0’ or a ‘1’. The timer is reset and reloaded in the middle of the bit when the external interrupt happens, and that keeps the error due to drifting in check.

A DALI circuit with simple power supply and Manchester encoded and decoded communications implemented using a PIC16F1947 provides a solid foundation for implementing DALI commissioning and commands for both the control device and the control gear.

Dipole PCB antennas

Many RF ICs use differential ports to transmit and receive RF power. This makes the use of balanced antennas attractive, as one can do away with the balun normally needed to convert the differential RF power at the IC ports to single-ended signals that can be fed to an SMA connected antenna or RF instrument. A simple half-wave dipole antenna can be integrated on a PCB and works well with the CC2530 RF IC from Texas Instruments.

The half-wave dipole is one of the simplest and most commonly used antenna structures in the RF world. It can be made from a piece of wire, or a trace on a PCB. The basic half-wave dipole antenna is a wire or trace with a length of lambda/2 and a slot in the middle where the antenna is fed. The impedance is around 73 Ω, and the directivity is 2.15 dBi.

A 40 mm PCB disc can be used to demonstrate the capabilities of the CC2530 when used as a wireless LED controller. This places some constraints on the use of the basic dipole antenna structure, the main ones being that the antenna will be close to the edge of the board, and it will be curved with a radius of 20 mm. The width of the trace does have an impact on the antenna performance, particularly the bandwidth.

Placing the antenna close to the edge means the effective dielectric constant is harder to determine, as a 2.5D EM simulation tool such as Momentum will not accurately capture the effects of the finite substrate. Changing the shape of the antenna from a straight line into a curve means the radiation pattern will not be the same as that of an ideal dipole.

As a first step, simulate a close-to-ideal dipole using ADS Momentum to verify the simulation setup yields credible results. Then, add substrate, curvature and a ground plane to model the final board more accurately. Finally, add some length to fine-tune the antenna length manually on the first prototypes. This latter step is a precautionary one, given the uncertainty in the effective dielectric constant seen by the antenna.

The prototype testing and optimization process involves trimming the antenna to the right length, and then adding matching and filtering components to obtain a good trade off of high output power at the carrier frequency and low harmonics. Figure 3 shows the final layout of the antenna and filtering components.

Figure 3: Final layout of the antenna and filtering components.

Conclusion

Lighting is set to become a significant part of connected homes and workplaces as the IoT expands. This article has looked at some of the more popular wireless standards that are being used and the importance of security and avoiding interference when deploying wireless networks. An example circuit of digitally controlling lighting has been presented along with a look at how to implement an antenna on a PCB for a wireless LED controller.

Supplier