I'm currently working on a project using a MEGA 2560, a MAXIM rs485 driver and the DmxSimple library. The device outputs 12 channels of DMX with 6 of the levels being set by pots and the others being set with an encoder and a display.
I'm having issues with the stability of the DMX. I;m monitoring the output with an ENTTEC usb-dmx box and a MAX/MSP patch (I have also looked at the output with a professional DMX microscope which I managed to borrow to rule out this setup)
The output is completely stable when the levels are all (or mostly) at 100% or 0%, if all of the levels are set to any other values, the dmx signal jumps to different levels at random intervals.
When I look at the TTL signal output from the arduino pin on an oscilloscope, I can see the dmx pulses are "jumping" appearing to get longer for a moment, then going back to normal, repeating regularly at about 3 times a second. The oscilloscope is pretty old and I thought that it might just not be triggering correctly but looking at the output from a lighting desk, the pulses are solid and dont move at all.
Im pretty certain that this is the cause of the erratic behavior. It would make sense that the signal settles when all of the values are at full or 0 because every bit would be 1 or 0 within each byte causing less "interference" when the timing jumps.
My code if fairly complex and too large to post in its entirety. The call to DmxSimple is just
which only happens when 'level' has changed for that channel.
Am I correct in thinking that DmxSimple uses TIMER2 to keep track of its timings and TIMER2 is also used by delay() and millis()? I dont use delay() at all but I do have quite a few calls to millis(). Could this disrupt the dmx output timings?
Any help with the issue would be much appreciated...