In this project, I will show how to implement a DMX master controller using one Arduino Uno, and one MikroElektronika Uno Click shield hosting one RS-485 click board. This project allows up to 32 devices to be connected to the same DMX bus, including the master controller, so up to 31 slave devices can be used. The number of DMX channels is up to 512, but due to memory space restrictions you may wish to use a limited set of channels.
The RS-485 click board features a half-duplex SN75176 IC (which is basically an MAX485 clone). This is a non-isolated DMX transceiver, so there is no galvanic isolation between the master device and the rest of DMX devices. Two unwanted issues here: this allows for ground loops to exist, so a current path can be established from a DMX slave device through the RS485 transceiver and then through Arduino and the USB cable connected to a computer or a laptop. If there’s a defective device and you have such a ground loop, you can damage all the equipment, including the computer. Second, lack of galvanic insulation can allow the live mains voltage to leak from a defective device through the DMX cable and into the Arduino and the connected PC. Another issue is that when used outdoor, especially with a long DMX bus, hazardous voltages can appear on the DMX bus during electric storms. So, it’s best to use this project only indoors.
While there’s a low statistics for this to happen, the lack of galvanic isolation creates a potentially life-threatening situation, so please take all the appropriate safety measures when working with this project. Don’t touch any of the exposed circuits. Use battery power if possible. Better safe than sorry.
If you plan to do some serious projects starting from this article, then I strongly recommend the use of a DMX isolator or use an isolated RS485 click board, with minor changes in the code.
|Close-up view of the RS485 click board|
The main element on the RS-485 click board is the RS-485 transceiver, which is configured to work in half-duplex mode. You can either transmit or receive, the selection between these modes being made through the R/T signal, which corresponds to the PWM pin of the RS-485 click board. When using the Click shield, if the RS-485 click is inserted into slot #1, the PWM pin is connected to Arduino pin D5. If the slot #2 is used, the selection between emitting or receiving is made through Arduino pin D6.
Three jumpers are present on the RS-485 click. If our project is connected to one end of the DMX bus, which is the most frequent situation, all three jumpers must be closed. However, the DMX master can take any position of the DMX bus. If the master is somewhere in the middle of the bus, remove all three jumpers.
|DMX master schematic. Created with fritzing.org|
By the RS-485 standard (inherited by DMX), there must be also a proper termination of the other end of the DMX bus. So, a terminator comprising of a 120-ohm resistor mounted inside an XLR connector was plugged in.
|DMX terminator. Created with fritzing.org|
The light fixture used for testing is a Eurolite T-36 LED DMX Par, which uses five DMX channels, as follows:
CH1: Red (0:100%)
CH2: Blue (0:100%)
CH3: Green (0:100%)
CH4: Brightness (0:100%)
CH5: Flash (0:10 — no flash; 11:255 flash 0:100%)
The switches on the back of the T-36 were configured for DMX operation, channel range 1:5.
Arduino DMX master connected to a T-36 DMX from Eurolite
As for the software, I used the Conceptinetics DMX library. The following is a code example for this light fixture, which turns on each color for about 3 seconds, then turns off all lights, followed by a dimming of the red channel from 0 to 100%: