Hi!
I'm trying to build an Arduino DMX Receiver to control WS2812 led tape. So far I've managed to control the tape with a simple button, but now I'm stuck at the DMX part.
My setup is:
Arduino Nano
UART TTL To RS485 Two-Way Converter (ER-CIA00485T)
ArtNet Gate (ProMyk v1.2)
I'm sending DMX from MA dot2 onPC - it works perfectly, tested with a led par fixture.
To test if Arduino is receiving DMX I connected an led to digital pin 9, and the TX & RX pins of the RS485 converter to the TX & RX pins on Arduino. I combined the Blink code with DmxSerialRecv example from DMXSerial library, so that the led would be on for the number of seconds set with DMX, and if no data is received it would blink.
#include <DMXSerial.h>
#define dmxAddr 1 // dmx starting address
#define ledPin 9 // pin, where the LED is connected
void setup() {
pinMode(ledPin, OUTPUT); // initialize digital pin as an output.
DMXSerial.init(DMXReceiver); // initialize DMX receiver mode
DMXSerial.maxChannel(1); // limit the number of DMX channels to read in
}
void loop() {
unsigned long lastPacket = DMXSerial.noDataSince(); // Calculate how long no data bucket was received
if (lastPacket < 5000) {
digitalWrite(ledPin, HIGH); // turn the LED on
delay(DMXSerial.read(dmxAddr)*1000); // wait for a number of seconds set through dmx
digitalWrite(ledPin, LOW); // turn the LED off
delay(1000); // wait for a second
}
else {
digitalWrite(ledPin, HIGH); // turn the LED on
delay(1000); // wait for a second
digitalWrite(ledPin, LOW); // turn the LED off
delay(1000); // wait for a second
}
}
Unfortunately the led is constantly blinking, so I'm not receiving any data. I tried swapping the TX & RX pins and using different software (QLC+), but the result is always the same. I also tried running some code examples for DMX with neopixel, but never got any output on the led tape.
Is there something wrong in my setup? Am I missing something in the code? Any tips would be appreciated