Go Down

Topic: Arduino Nano + MAX485 -- wiring for DMX output? (Read 209 times) previous topic - next topic

whoman321

Sep 15, 2020, 04:46 am Last Edit: Sep 15, 2020, 05:16 am by whoman321
Hello Everyone,

I cannot seem to send DMX with an Arduino Nano + max485

I'm using the DmxSimple library "FadeUp" example

I believe my problem is with the wiring.

I have a DMX lighting fixture for testing, and I have confirmed the fixture is working perfectly with DMX coming out of QLC+ on my laptop (channel 1 moves the light (PAN) so it's easy to test with channel 1)

I've spent over 5 hours testing different wiring configurations, and still cannot get my Arduino Nano to output DMX.

I've used blinking LEDs as well as serial debug messages to confirm that the code is actually executing properly on the Arduino Nano, and on the right pins, so the only thing I can think is that I'm missing something regarding the wiring. 

Perhaps with the voltages or polarities?

I've tried different Nano's and different MAX485 boards just to make sure it wasn't a defective unit.

I've tried switching polarity to the DMX cable, but that had no effect.
I've tried using GND, 5v, and 3.3v to the DE and RE pins of the MAX485 board.  nothing.

Any help would be very much appreciated


Here's the code (comments removed):

Code: [Select]

#include <DmxSimple.h>

void setup() {
  DmxSimple.usePin(3);
  DmxSimple.maxChannel(4);
}

void loop() {
  int brightness;
  for (brightness = 0; brightness <= 255; brightness++) {
    DmxSimple.write(1, brightness);
    delay(10);
  }
}



horace

have a look at RS485 example
you need to use DE and RE to control the direction of transmission
I also find it useful to have a PC USB-RS485 dongle to monitor the bus

markd833

As DMX is unidirectional, you may be able to hardwire the MAX485 for permanent transmit, rather than turning it on and off.

Connect RS483 RE & DE -> Nano +5V.
Connect RS485 VCC -> Nano +5V.
Connect RS485 GND -> Nano GND.
Connect RS485 DI -> Nano D3.

I think your breadboard picture is showing Nano D3 connected to RS485 RO, which is the receiver output.

whoman321

#3
Sep 15, 2020, 09:56 pm Last Edit: Sep 15, 2020, 10:01 pm by whoman321
horace, thanks so much for the link.  It cleared up a lot of my confusion over the Max485 pin functions.

markd833, thanks so much for pointing out that I had Nano D3 connected to the wrong pin on the Max485.  Also thank you for the note about tying to 5v to keep it on transmit.


Unfortunately, it's still not working.

I checked the voltage of A and B on the max485 and they're fluctuating between:

A= +2.90 to +2.92
B= +1.39 to +1.41

VCC is at 4.53

Not sure what else I'm missing here.




Also one more thing I noticed...  if I disconnect one of the 2 data pins from the max485 (A or B) to the DMX cable, the light starts flashing all kinds of colors randomly.  and the lighting fixture's 'dmx signal' indicator is flashing erratically.

I'm not sure if that makes any difference in troubleshooting this problem I'm having, but wanted to mention in case that gives any clues

horace

have you correctly terminated the RS485 bus with a 120ohm resistor?
are you using the correct baudrate? if you have an oscilloscope have a look at the A and B signals
it would be worth getting a USB-RS485 dongle for a PC to test and monitor the Nano/RS485 interface combination

whoman321

have you correctly terminated the RS485 bus with a 120ohm resistor?
Yes I have a standard 120ohm DMX terminator in the lighting fixture's DMX OUT port.
Termination isn't an issue, as it works fine with QLC+ on my laptop.

are you using the correct baudrate?
I'm using the DmxSimple library's example called FadeUp.  I've posted the code above.  There's nothing affecting baudrate in that example, so DmxSimple would be taking care of that.

if you have an oscilloscope have a look at the A and B signals
Okay, I will give this a go shortly.  Is there something specific I should be looking for?

it would be worth getting a USB-RS485 dongle for a PC to test and monitor the Nano/RS485 interface combination
Already ordered one based on your initial reply!  :)

Thanks

horace

using a dual trace scope you can look at the A and B signals too see if they are correct - wiki/RS-485

also worth trying is interchanging the A and B lines

whoman321

using a dual trace scope you can look at the A and B signals too see if they are correct - wiki/RS-485
I only have a DSO 138.  Thanks for the link...I'll take a look today at each one individually?  Or would it be pointless without a dual trace scope?

also worth trying is interchanging the A and B lines
Yes, every time I test and it doesn't work, I try switching A and B to ensure it's not that.

Thanks so much for your help

whoman321

I can see the messages, the signals don't look dirty,

What should the voltages coming from A and B be? 
The only thing I can think is that the signal voltages aren't correct so the light fixture isn't reading them?

Any thoughts would be super appreciated.



whoman321

Tested the voltage of a working commercial DMX artnet adapter.


Working
Commercial DMX adapter:
A: 4.83 Volts
B: 0.17 Volts

Not Working
Arduino to Max485 (as pictured above on breadboard):
A: 2.63 Volts
V: 1.46 Volts


I tested 2 different Max485 boards... same voltage readings
So it seems perhaps the voltages aren't correct on my breadboard? 
Am I missing any components between the Nano and the Max485?


whoman321

I've solved the problem by using a different DMX library: https://sourceforge.net/p/dmxlibraryforar/wiki/Home/

But that library uses the serial bus for output to the Max485, meaning I can't use the serial bus for debug.

If anyone knows of any other library that works well for DMX output (not using serial), let me know.

Thank you Horace and markd833 for your help in learning more about RS485

Howwee

The max485 already has a 120ohm terminator built in it
you could try removing this
I had the same problem with a modbus hook up

https://electronics.stackexchange.com/questions/461941/multiple-terminating-resistors-on-rs-485-bus

Go Up