In the last issue of Envision, we introduced the DMX-512 lighting control protocol and discussed its importance in relation to emerging lighting technologies and the management of living and workplace environments. We also introduced the NB3000 RS-485 interface, as well as the WB_UART8 serial interface peripheral which can be used to implement DMX-512 communications from the NB3000. You can find that first introduction article here.
In this installment, we’ll take a look at some Altium Designer FPGA Projects which implement control of lighting fixtures using DMX-512 and the WB_UART8 component. We will start with a basic DMX-512 transmitter design, and from there extend the functionality to use the TFT touch screen for control of an RGB LED-based wall washer. Then, further still to use the NB3000’s TFT touch screen to form a simple and effective control surface for an LED-based moving head fixture.
The NB3000 RS-485 interface employs an RJ-45 jack, using the EIA/TIA-568 defined pin-out for standard Category-5 twisted pair cabling. This is also allowed for in fixed cabling installations according to the USITT DMX-512 standard. Unfortunately, most lighting fixtures manufactured in Asia employ the non-standard XLR 3-pin connector, as it significantly reduces BOM costs (as opposed to the 5-pin XLR as specified by USITT). An adapter cable to get the DMX signal to the fixtures needs to be made as shown in Figure 1. In our case, we simply cut the end of a CAT-5 patch cable off and soldered an XLR plug on the bare end.

Figure 1: Cable for adapting the RS-485 jack
to 3-pin DMX-512 interfaces
The heart of the three lighting control designs presented is an OpenBus system based on the TSK3000 processor coupled with the WB_UART8 serial controller. This system, shown in Figure 2, uses the NB3000 SRAM for program and data memory, along with the LED (NB_LEDS) controller core and a Custom Digital IO (CTRL_DESK). The LED controller will simply be used to mimic the color of the DMX output locally on the Nanoboard, and the CTRL_DESK digital IO will be used along with the Nanoboard Interface Instrument to provide a graphical user interface for the host PC over USB. The WB_UART8 is designated as DMX_UART below.

Figure 2: OpenBus System for the basic DMX
controller.
The CTRL_DESK digital IO is configured as shown in Figure 3. The three “outputs” are conceptually outputs from the control surface to the TSK3000, so we can read their status from within our TSK3000 embedded code.

Figure 3: OpenBUS Digital IO Configuration
The top level schematic (see Figure 4) shows the wiring of the FPGA to the external peripherals – note how the RS-485 connection is wired; with the transmit and receive enables both pulled up, and CTS to the UART is pulled low since DMX-512 does not use hardware handshaking. The Nanoboard Interface Instrument (U_CTRL_DESK) is used here to link the custom Digital IO in the OpenBus system to a graphical user interface script project that runs on the host PC, controlling the DMX channel values via USB.
Figure 4: Top level schematic for RGB
DMX Desk (click for a larger view)
The Nanoboard Interface Instrument has been configured to link to a new script project, with a new form designed with three slider controls, labels (RED, GREEN and BLUE), and three hexadecimal value displays. The design of the form is shown in Figure 5. This also shows the configuration of the Signal Link Manager – an invisible form control that is added to link the OpenBus Custom Digital IO outputs to the slider controls. Each slider is linked to its respective Design Signal using the appropriate Virtual Signal Link. For example, Figure 6 shows the SignalLink property of the RED slider control – and in turn the slider value (which has been configured for a minimum of 0 and a maximum of 255) – can be read from the Custom Digital IO in the embedded code running on the design.

Figure 5: Nanoboard Instrument Script Form and
Signal Links Manager
The LED style hexadecimal displays on the form are updated by script form OnChange events for the sliders in the script project, meaning they too reflect the value of the slider (in HEX) and are updated automatically whenever a slider position is changed by the user, using the mouse on the host PC.

Figure 6: Signal Link for Red Slider Control
The embedded project for this design is relatively simple, including the drivers for the LED controller, the UART and the Custom Digital IO. As such, only the main loop and Digital IO read routine, both shown in Table 1, is described here.

Table 1: Main source code loop and Digital IO
read routine
Initialize() sets up the drivers and configures the WB_UART8 to have a transmit character delay spacing of two bits, effectively giving it 2 extra stop bits (even though the hardware of the WB_UART8 is fixed for a single stop bit). This takes care of the minimum 2 stop bits required by the DMX-512 protocol, as discussed in the previous article. Next, at the beginning of the main program loop, uart8_putbreak (DMX512, 22) is called to send the required minimum 22-bit BREAK (low level) at the beginning of each DMX frame. Straight after the BREAK, a single NULL (zero) character is transmitted using uart8_putchar (DMX512, 0), which is the reserved “slot zero” indicating that the following 512 slots contain values for dimmer channels 0 through 511.
In the middle of the main loop, the values of the three sliders on the control script form are read using desk_get_value(i) and placed in the first three bytes of the 512-byte array variable, DMX_Table[i] used for the DMX-512 buffer. These values are also placed in the first three LED channels of the LED controller, being the Red, Green and Blue chips within the first LED on the NB3000 (LED 0).
The final part of the main loop simply transmits all 512 bytes of the variable DMX_Table[i] sequentially out the RS-485 port, connected to the DMX-512 input of the lighting fixture daisy chain. While this code is only using the first three channels, there’s no reason to prevent you from extending this project to use as many as you need, up to channel 511.
Figure 7 shows the project hierarchy in Altium Designer, with the Script and Embedded projects both being linked to the FPGA project, and the script control form with sliders in action. At the same time, the photo of the RGB LED wall washer fixture was taken, and is shown in Figure 8. The base address of the fixture was set to 000 so that Red, Green and Blue LEDs would be channels 0, 1 and 2, respectively.

Figure 7: RGB
DMX controller project and script running on host PC

Figure 8: LED Wall Washer under control of the
RGB DMX project.
This design is a variant of the Nanoboard 3000 Discovery Series, exercise number 13 (“Touch Screen control of the LEDs”). It has simply been modified and extended to include the WB_UART8 hardware and drivers, and some extra embedded code to transmit the RGB color value from the TFT color picker to the DMX-512 RGB Wall Washer. For more detailed information on the DS0013 tutorial document, see the Nanoboard 3000 info site at http://nb3000.altium.com/intro.html and click on the Training Room link.

Figure 9: Updated OpenBus document from TFT
LED Controller (DS0013).
The updated OpenBus document is shown in Figure 9. You can see here the addition of the WB_Multimaster for sharing screen buffer RAM between the TFT controller (WB_ILI9320_1) and CPU. The optional WB_BOOTLOADER for booting the application on startup from SPI flash is also included, along with the SPI bus and Touchscreen controller cores which facilitate use of the TFT’s touch sensor. The existing project used all these along with the NB3000 LEDs, but here we have added the WB_UART8 (DMX_UART), and wired it on the top level schematic to the RS-485 interface as in the previous design.
The rest of the modifications are simply the additional Software Platform drivers for the WB_UART8, configured to be blocking and to use the hardware buffers contained within the peripheral IP core as shown in Figure 10, and the added few functions in the embedded C code which update and transmit the three (RGB) color channel values on the DMX output.

Figure 10: Software Platform WB_UART8 Driver
Configuration for Design 2.
The updated embedded code is shown in Table 2. For clarity, the implementation details of each function have been left out. In essence it works as follows:

Table 2: Updated main code loop in embedded
project for Design 2
This design is a further extension to the previous one, adding touch screen features and additional channel mapping for the control of a 13-channel “intelligent” lighting fixture. The fixture used with this design is a miniature LED-based moving head unit which has many of the features found in larger HID (High Intensity Discharge) based units, typically seen in theatre and at music concerts. This design could easily be adapted or extended for controlling any DMX driven intelligent light.
As far as the FPGA hardware is concerned, this design is essentially identical to the last one, employing the same embedded system around the TSK3000 processor, TFT panel and touch screen, NB3000 LEDs, and of course the RS-485 interface. One minor addition has been added – the user pushbuttons which reside under the TFT panel have been wired in to the TSK3000 processor via the WB_PRTIO (a.k.a. GPIO) component.

Figure 11: User interface configuration of the
Moving Head DMX Controller
This frees up the TFT panel for use as a Pan/Tilt (X/Y) control surface and RGB color picker. The SW3/4/5 pushbuttons are then used to control the “shutter” (open, strobe or closed), and SW1/2 control the gobo wheel – allowing the user to cycle through the various gobo projection patterns available and control their movement. The TFT panel display is configured as shown in Figure 11, with the small circle giving feedback to the user of the current pan and tilt position. The co-ordinates are also displayed above the RGB color section where the user can press to set the red, green and blue intensity levels.
As with most intelligent lighting fixtures, the DMX base address of the unit has to be set according to how many lights you are controlling and how you want to control them, but in this case the design assumes a starting address of 0x00. This is because, by default, all the lights used in these projects have a base address of 0x00, meaning the first channel of the fixture is controlled by the first value transmitted after DMX slot zero, and so on. This LED moving head unit uses the DMX channel allocations shown in Table 3.
| Channel | Function |
| 1 | Pan |
| 2 | Pan (fine) |
| 3 | Tilt |
| 4 | Tilt (fine) |
| 5 | Pan/Tilt Speed |
| 6 | Dimmer/Shutter/Strobe |
| 7 | Red Intensity |
| 8 | Green Intensity |
| 9 | Blue Intensity |
| 10 | Color Macros |
| 11 | Color change speed |
| 12 | Show Macros |
| 13 | Gobo Wheel (Open, Pattern, Still, Shake, Scroll) |
Table 3: DXM Channel assignments for the LED Moving Head fixture
The final variation of this design adds Nanoboard Instrument script functionality – giving a PC based control surface over the USB JTAG connection to the NB3000 FPGA design. The scripted dialog is shown in Figure 12, and has mouse button controls for manipulating the gobo wheel and shutter. It also provides feedback from the TFT panel Pan/Tilt control as well as the color selection.

Figure 12: Script Interface for Moving Head DMX
Controller
To see the designs in action, follow the link in the following video thumbnail (Video 1). Download the designs and have a play with them, with your own lighting system!

Video 1: Click to see the NB3000 DMX
controllers in action
Download Links for Projects (zip archives):
DMX Controller Design 1 (RGB Wall Washer Controller using Script)
DMX Controller Design 2 (RGB Wall Washer controller using TFT Touch)
DMX Controller Design 3 (LED Moving Head Controller using TFT)
DMX Controller Design 3 (With TFT and Scripted User Interface)