ADVENTURES IN PROPELLER PROGRAMMING
■ BY JON WILLIAMS
DO IT UP WITH DMX
Even if you’ve never heard of DMX512-A (DMX), chances are you’ve seen it in
action. Where? At any large stage production. Concerts and plays are big users
of DMX-controlled lighting. So, what if you’re not one for concerts or the
theater? Well, have you ever been to a night club with lots of crazy, dancing,
pulsating lights? Then you’ve seen the magic of DMX.
So, what is DMX? It is, in fact, a very simple, half-duplex (one direction, controller to fixture) serial protocol that
runs over a standard RS-485 hardware link. The protocol
was originally designed for controlling stage lighting, but
as it is so easy to implement it has been put to use in a
variety of show control applications.
We can break down the protocol into four essential
• Break (B)
• Mark After Break (MAB)
• Start Byte (S)
• Packet of Frames (Fx)
Figure 1 visualizes these elements as seen on the
DMX RX pin of the Propeller.
The Break is what allows all receivers on the system to
synchronize themselves with the packet; this is a space (0)
on the line that lasts 88 µs or longer. The Mark After Break
is a short rest with the line at idle (1); the MAB is ( 8 µs) or
longer. The first byte that follows the MAB is called the
Start byte; it is typically zero and ignored in many systems
(though it really shouldn’t be). DMX bytes are transmitted
in 8N2 (eight data bits, no parity, two stop bits) format.
After the Start byte is the Packet of channel values
called Frames (0 to 255, also 8N2) which could be up to
Light fades and motion are created by a master
controller that streams the DMX data at a pretty swift clip:
250K baud. At this rate, the Break, MAB, Start byte, and
512 Frames can be transmitted every 22. 7 milliseconds
■ FIGURE 1. DMX Signaling.
(per the DMX specification).
I’ve written DMX receiver code for the SX28 but it is a
challenge, especially when one needs to do brightness
control of LEDs as we intend to do here — there’s not a lot
of room left in the interrupt when running an RX UART VP
at 250K. With the Propeller and a dedicated DMX receiver
cog, however, it’s really very simple — so much so that it
makes me shake my head and smile.
What we’re going to build this month is a generic
DMX I/O add-on for the Propeller platform with three
channels of medium current output to control devices
like 12V LED circuits and small DC lamps. This will let
us create a simple DMX lighting fixture using a high
brightness RGB LED.
Figure 2 shows the schematic for a generic DMX
interface — yes, this circuit can transmit, as well as receive.
It would have been silly to design an add-on module for
the Propeller that couldn’t transmit as well, especially
since the “cost” of this upgrade was a resistor and a
single I/O pin. Pretty cheap price for the flexibility, don’t
A quick note about JP1 and JP2: JP1 is used only
when the node is the master (transmitting) and only one
node will ever use JP1 (for receiver devices we leave this
out). JP2 is for the end nodes (transmit or receive) on a
DMX network; this resistor prevents reflections. So, if your
DMX project using this circuit is the last on the DMX line
then JP2 needs to be installed. For a lot of really great
information on RS-485 hardware, please see Jan Axelson’s
book, Serial Port Complete.
For what it’s worth, my design does, in fact, violate
the DMX specification in that I’m using three-pin XLR
connectors instead of the five-pin units that are normally
called for. But guess what? I have a mini DMX console
and a popular DMX lighting fixture here in my office,
and both use three-pin XLR connectors; this “violation” is