DMX Receiver

Most (all?) DMX receivers are based on microcontrollers. Two common controllers are the AT-Mega AVR, and the PIC. These microcontrollers provide many I/O pins that can directly drive equipment, minimising the need for external logic.

Most (all?) DMX controllers are based on microcontrollers. Various devices can be used, one common controller is the AT-Mega AVR. This device provides many I/O pins that can directly drive equipment, minimising the need for external logic. The DMX512 signal is received at the hardware level by setting a UART to 250 kbps.

Example receiver software architecture.

A typical software design comprises 5 basic modules:

The algorithm below provides the input processing for reception of a DMX frame to create a set of DMX values, stored in the byte array DMXField[]. The algorithm is triggered as an Interrupt Service Routine (ISR), for each byte received from a Universal Asynchronous Receiver/Transmitter (UART).

gDMXState is a global variable used to retain the current receiver DMX state.
DMXcount is initially set to the base address used by the device.
DMXcount is later used to count the received number of bytes within DMXField.
DMXField represents the number of bytes that the device needs to collect from the DMX Frame.

The algorithm above cycles through 6 internal states to process frames with a start code of zero:

State Machine for the example DMX receiver.

Waiting of the base address: A receiver skips a number of bytes corresponding to the allocated base address. e.g. for a base address of 8 the receiver skips 8 slots. It then extracts a set of contiguous bytes (slots) from the DMX frame. Fixtures may use one slot or many, depending on the configuration - which must be consistent between the sender and receiver. The answer must clearly show each slot is associated with a channel and therefore that a receiver reacts to a pre-defined subset (group) of slots. The algorithm collects the value of the slots in the array DMXRXField[]. The contents of this array may be used by a parallel thread to generate the output waveforms/levels.

What happens if there are errors? Each receiver device is supposed to hold their last setting for up to 1 second if the signal stop being received. There is no checksum or error correction of any kind. You may note that for lighting this is ok, if a device has been getting 0 for the last few seconds, and suddenly gets a 128 due to noise, it does not have time to change brightness noticeably before the next value comes. Therefore it is to be used only for non-critical systems (i.e., no dangerous equipment).

Watchdog Timer

The watchdog is a special-purpose timer often found in microncontrollers. It is started in the initialisation code and periodically reset in the user interface routine. Once enabled, the watchdog can not be reset by the computer software.

If the timer ever counts to zero (too much time expires since the last reset), the program is assumed to have crashed. The microncontroller automatically reinitialises the hardware and call the initialisation routine.

Output Waveforms

Each of the control slot values accumulated may be used in many different ways, for example:

Some controllers use a combination of slot values to signal to the controller. For example, a moving head may combine 8, 16 or more consecutive slots to determine the orientation of the fixture, colour, effects, iris, focus, gobos, prisms, and other aspects of the fixture.


See also:


Prof. Gorry Fairhurst, School of Engineering, University of Aberdeen, Scotland.