LightingDemo High-Brightness LED Control

Freescale Semiconductor, Inc (now NXP) has produced a reference hardware design to demonstrate the control of High-Brightness LEDs using the DMX512/RDM and DALI protocols. The hardware consists of two types of board, a slave board which drives an individual multi-colour LED package, and a controller board which controls one or more slaves.

Working on behalf of Freescale, MicroAPL has developed the software to drive the boards, providing a reference implementation of the DMX512/RDM and DALI protocols together with code to perform colour balancing and thermal regulation of a typical high-brightness LED.

In order to demonstrate the use of the boards, MicroAPL has also developed an application called LightingDemo available in two formats. One version runs on a Windows PC and connects to the controller board via a USB cable; the second version uses an LCD touchscreen attached to the controller board.

Screen shot of LightingDemo application running on a PC:

Screenshot of LightingDemo running on a PC

Screen shot of LightingDemo application running on a 320 x 240 LCD touchscreen:

Screenshot of LightingDemo running on a 320 x 240 LCD touchscreen

DMX512/RDM and DALI protocols

DMX512 is an industry-standard protocol used for controlling lighting equipment and accessories, including dimmers and related equipment. The RDM protocol is an extension of DMX512 which provides remote device discovery and management. For example, RDM can be used to check the LED's operating temperature. DMX512/RDM uses a bit rate of 250K bits/sec.

DALI is an industry-standard protocol used to control lights digitally. It is a simpler protocol than DMX512/RDM and uses a much lower bit rate of 1200 bits/sec.

Controlling High Brightness LEDs using DMX512/RDM and DALI

The LightingDemo application lets you drive the controller and slave boards using a PC or an LCD QVGA touchscreen, allowing you to control the colour and brightness of the high-brightness LEDs. The application requires the following:

  • One Freescale MCF52259 Lighting Controller or Freescale Tower DALI/DMX-512A/Wireless Lighting Interface (the controller board)
  • One or more Freescale High-Brightness LED Driver boards (the slave boards).
  • A PC running Windows XP or Windows Vista 32-bit editions, with .NET framework version 3.0 or later installed

The PC communicates with the controller board using a USB connection. The controller board then controls one or more slave boards using either DMX512/RDM or DALI.

For demonstration purposes, it is also possible to connect the controller and slave boards using both DMX512 and DALI cables simultaneously. The protocol used can be dynamically selected by changing switch settings on the boards, even when the boards are running.

Slave boards

A typical LED package consists of three or four separately controllable colours, e.g. Red, Green, Blue and White.

The LED package is connected to a Driver board (the slave board) based on a Freescale MC13213 microprocessor. The slave board comes in two versions: one for controlling very high power LEDs like the Luminus PhlatLight, which can take upto 32 Amps of current; and another for LEDs like the Philips Lumileds series

A system can include many slave boards, all connected to a single controller.

Software on the slave board is responsible for colour balancing, and also monitors the temperature of the LED, adjusting the power to prevent the LED being damaged

Each LED colour, or channel, is controlled by a separate power stage on the slave board. The ‘fully-on’ current and voltage used by the LED channel are determined by hardware on the board (including current-limiting resistors to prevent LED damage). Colour control is achieved by using a PWM signal to control the channel current, varying the duty cycle in order to vary the brightness of the LED.

High Power LED Driver Board for Luminus PhlatLight (LED not shown)

High Power LED Driver Board

Controller board

The LightingDemo system can use one of two types of Controller board:

  • A Freescale MCF52259 Lighting Controller
    This is an older stand-alone board based on the ColdFire MCF52259 processor. The board does not support a touch screen, so you will need to run the LightingDemo application on the PC to control the system.
  • A Freescale Tower DALI/DMX-512A/Wireless Lighting Interface
    This is a newer board which replaces the MCF52259 Lighting Controller. The board needs to be part of a Freescale Tower system that also includes the following:
    • TWR-K60N512 - Kinetis K60 processor board
    • TWR-SER - Serial board for USB communications
    • TWR-LCD - Graphical LCD module featuring 3.2" QVGA touch screen
    A system using this controller can either be controlled via the LightingDemo application running on a PC, or through the LCD touch screen.

The controller is connected to one or more slave boards using either a DMX512 or a DALI connection. In addition it connects to a PC via a USB interface, allowing the LightingDemo application on the PC to control the LEDs

The software on the board handles all DMX512/RDM and DALI related tasks, including discovering which slave boards are connected and instructing them to change colour/brightness.

Note that the controller is not simply relaying DMX512 or DALI commands sent by the PC. Instead the PC sends commands using a simple high-level proprietary protocol, and these are then converted into the appropriate DMX512/RDM or DALI commands by the controller board. The intention is that it should be as easy as possible to build a new system that doesn't require a PC.

Controller Board installed in Kinetis K60 Tower system

Tower Controller Board

Device Discovery

When the PC version of LightingDemo application is launched it will first attempt to contact the Controller board via the USB connection. Assuming that all is well, the application will instruct the Controller board to begin a search for connected devices using either the DMX512 or DALI 'Discovery' process. Discovery should complete rapidly for DMX512 but may take a few seconds for DALI. After discovery is complete you will see a list of the connected devices:

Screen shot after DMX512/RDM Discovery

DMX512/RDM Discovery

sRGB Colour Space Control

One option for controlling the LEDs is to specify colours working in the sRGB Colour Space

sRGB is probably the most familiar to users because it's a standard colour space used with computers. A colour defined in the sRGB space has three components: Red, Green and Blue. Each of these is typically represented by an 8-bit value in the range 0-255, leading to a 24-bits-per-pixel representation of colour. For example a 'pure' red is specified as (255, 0, 0)

The sRGB Colour Space could be thought of as a three-dimensional cube, with Red, Green and Blue as the axes. In the colour picker show below, the square area represents a slice through the cube showing all possible Green and Blue values when Red = 255.

Screen shot showing LED control in the sRGB colour space

sRGB colour space control

Note that the primary colours (Red, Green and Blue) of the sRGB colour space are not the same as the Red/Green/Blue primaries used by a typical high-brightness LED. In order to achieve a given sRGB colour using the LED primaries, software has to perform a colour transformation.

CIE1931 Colour Space Control

Although sRGB is widely used for computers, it's not ideal for specifying colours. There are many colours which are visible to the human eye but which cannot be represented accurately on the computer screen. To specify these colours it is necessary to use another Colour Space such as CIE 1931.

Screen shot showing LED control in the CIE 1931 colour space

CIE 1931 colour space control

Consider two colours like White (sRGB = 255, 255, 255), and Gray (128, 128, 128). In fact, these are normally considered to have the same 'tint' but different 'brightness'. To use more formal language, White and Gray have the same chromaticity but different luminance.

The CIE 1931 colour space is an attempt to separate the specification of colours into a chromaticity component and a luminance component. Colours are specified in the form xyY where (x,y) are the chromaticity coordinates and Y is the luminance.

You may also see colours specified in the form XYZ which is closely related to xyY. The XYZ values are known as the tristimulus values.

The diagram below shows the possible chromaticity values x and y from 0 to 1. The coloured horse-shoe shaped area represents all the colours which the human eye can see. The outer curve is the known as the spectral locus and shows single-wavelength colours in the range 380 - 700 nanometres.

CIE1931 horseshoe

Note that not all colours in the coloured area can be accurately shown on the computer screen or the printed page. The white triangle shows the 'gamut' of the sRGB Colour Space: the three corners of the triangle correspond to the Red, Green and Blue primaries used by sRGB, and colours outside the triangle cannot be shown accurately on screen.

Similarly the black triangle shows the gamut of a typical three-colour LED (in this case a Philips Lumileds Luxeon Rebel). Some colours that are within the gamut of the LED are outside the gamut of sRGB and vice-versa.

Given two corners of a triangular gamut, any colour on the line connecting the corners can be produced by a combination of the two corresponding primaries. Any colour within the triangle can be produced from some combination of all three primaries.

The LightingDemo application allows you to specify a colour by selecting its (x,y) chromaticity coordinates and a Y luminance value.

Other LightingDemo features

The LightingDemo application also includes the following features:

  • Direct specification of LED colours using DMX512 slot values

    Direct control of LED channels
  • Monitoring of LED junction temperatures and current via sensors on the slave board (DMX512 only)

    Thermal regulation of LEDs
  • A diagnostic window showing the DMX512/RDM or DALI traffic exchanged between controller and slave boards

    Diagnostics Window
  • A free-running Light Show which cycles the attached LEDs through a sequence of colour and luminance values

    Light Show
  • A simulator which allows you to evaluate the LightingDemo application even when no Freescale lighting boards are available

Using the LCD touchscreen

Although the screen shots on this web page are mainly taken from the PC version of LightingDemo, use of the embedded GUI version is very similar. Because the LCD touchscreen is only 320 x 240 pixels (QVGA format), the screen display is necessarily simplified. However the basic application layout is very similar to the PC version. For example sRGB control is very similar to the PC version described above, as shown by the following equivalent screenshot.

Screen shot showing LED control in the sRGB colour space using LCD touchscreen

sRGB colour space control using LCD touchscreen

In order to change RGB values using the LCD panel you can either touch the colour picker/slider or specify a value exactly. To do this, touch the individual colour's value such as 179 in the screen above and enter a new value using the number entry screen:

Screen shot showing number entry using LCD touchscreen

Specifying numbers using LCD touchscreen

The LCD touchscreen version makes use of a eGUI, a free embedded graphics library available from Freescale.

Source Code

The source code of the software running on the Controller and Slave boards is written in ANSI C and designed for simplicity and a small memory footprint.

If you are contemplating a new product based on Freescale's reference hardware, the source code is available from Freescale. Contact MicroAPL or Freescale for further details:

               Freescale: Freescale web site

               MicroAPL: LightingDemo @