We’ve designed lots of DMX equipment over the years. Here’s our very simple guide:
Set the UART port up as 250k baud, 1 start bit, 2 stop bits, no parity bit.
To send a frame of DMX:
Generate a Break (TX pulled low for at least 88uS, recomended > 130uS to allow for bad equipment).
Generate a MAB (Mark After Break – TX left high for min 8uS, max 100 to 200uS – some devices are sensitive to too long break time).
TX the start code 0x00
TX between 24 and 512 bytes of DMX level data (512 is normal but you can send less)
Receivers are set with a start address and will get their level data from that byte number within the 512 bytes of level data
That’s it, just keep resending it at least a 1 frame every 1.4 (?) seconds to stop a receiver deciding data is lost, but as fast as possible in reality to give good fade resolution as the levels change
The complication is typically just being able to generate the Break, as not all uarts can do it. If not you have to find a workaround, which on a microcontroller is typically accomplished by turning the uart off and setting the pin low, before turning it back on and carrying on. If your working with a high level OS (operating system) then check you can work with the port to create the Break and MAB with suitable timings.
Refresh Rate
Minimum 512 channel packet length is 23mS. The maximum advisable refresh rate is around 30mS before slowness becomes noticeable during fades (aim for 30mS or better).
Hardware
A typical RS422 or RS485 IC is all that is needed, e.g. a MAX483 or MAX3483. The last device on the bus needs a 120ohm resistor across the D+ and D- connections to terminate it (stop signal reflections back down the bus)