Arduino as a DMX controller?

Hello guys. I'm planning to make a simple and cheap DMX controller for testing some fixtures ("DJ's lights").

I've read somewhere that the ATmega MCU is not capable to deliver enough bitrate (or even RAM space for buffering) for all the 512 channels, so one fixture at a time is OK (because this is for testing purposes anyway).

I've also read that I need a sort of "converter chip" that "translates" the board's signal to the 3-pin DMX signal. I want to know which of those is the easiest to find.

In the software aspect, will this library do the job?
https://code.google.com/archive/p/tinkerit/wikis/DmxSimple.wiki

Moreover, can I drive a single digit (7 segments) LED display with just my board? I guess I can, because I will just need one pin for the signal output, one for a push-button, and one analog input.

The interface that I want goes like this:

  • When the board powers up, the LED display shows the number 0 (0 for channel 1, and so on).
  • The push-button changes the current channel (and the number displayed along the way); up to 10 channels can be cycled thru (0 to 9 on the display).
  • A potentiometer sets the (8-bit) current channel's value.

I hope I've explained well that last part...
Any suggestion will be appreciated.

PD: I have a Nano board, so please don't suggest me shields; just circuit diagrams.

A popular "converter chip" is the "MAX485" RS-485/RS-422 Transceiver made by Maxim. It needs 5V and one resistor. Search online for "MAX485 Arduino".

THe DmxSimple commands are as "simple" as... DmxSimple.write(channel, value);

A single 7-segment can display > 9 by flashing the first digit i.e. "1", a delay, then the second i.e. "2" then a longer delay, then repeat, although not many DMX lights have more than 9 channels. DIO pins can do that.

The pushbutton and potentiometer that sets the (8-bit) current channel's value are easy and there are examples on this site.

when you add a second 7segment it only need one extra IO pin. when u use it as a matrix.

although not many DMX lights have more than 9 channels

i'm a lighting guy. i dont know many lights that have less then 9 channels.

almost all lights is use, use between 12 and 30 channels. also used a light with 120 DMX channels. but that one lookt more like a moving projector :smiley:

Will this schematic do what I want?


Just pay attention to the MAX chip part, because as I said before, I don't want to use 12 push-buttons and 6 potentiometers, but one of each one.

spirit:
when you add a second 7segment it only need one extra IO pin. when u use it as a matrix.

I guess you are talking me about those multiplexed display driver chips. That would be useful as well, but I think I have an idea to how to display up to 16 numbers with a single digit (displaying a hexadecimal number)

i'm a lighting guy. i dont know many lights that have less then 9 channels.

almost all lights is use, use between 12 and 30 channels. also used a light with 120 DMX channels. but that one lookt more like a moving projector :smiley:

As I said before, the ATmega MCU might not deliver enough bitrate for too many channels (as a commercial DMX controller would do), so that's why I limit the amount of channels available. If I suspect that I need even more, then I'll adapt the code to handle more.

Will this schematic do what I want?

Yes that seems to be fine.

guess you are talking me about those multiplexed display driver chips. That would be useful as well, but I think I have an idea to how to display up to 16 numbers with a single digit (displaying a hexadecimal number)

no i did not mean a driver chip just the arduin I/O pins, but a driver chip with the correct library would make it allot easyer.

As I said before, the ATmega MCU might not deliver enough bitrate for too many channels (as a commercial DMX controller would do), so that's why I limit the amount of channels available. If I suspect that I need even more, then I'll adapt the code to handle more.

the simple DMX library says it can run all 512 channels.
as i also tried and it work Ok! at my side.

you also have a 4 universe(4x512 CH) library that runs on the MEGA as the mega has 4x Tx. but i do not know it will work!

spirit:
no i did not mean a driver chip just the arduin I/O pins, but a driver chip with the correct library would make it allot easyer.

Oops, I've misunderstood you then. But yes, actually I want to use the digitial pins to drive the display.

the simple DMX library says it can run all 512 channels.

Already knew that. I've read somewhere about the bitrate problem; but, in fact, I don't know if that's true or not.

you also have a 4 universe(4x512 CH) library that runs on the MEGA as the mega has 4x Tx. but i do not know it will work!

That's nice, but I don't have a Mega board. Anyway, it's just for testing one fixture at a time, not for "professional" use; so one DMX universe is more than enough.

By the way, thank you for helping me! :smiley:

This diagram of the MAX485 looks to be set up for both Tx and Rx. I've only used Tx (to DMX light) in which case pin 1 is tied to pin 2 with a 100 Ohm resistor and pin 2 is not tied to 5V. May want to add a decoupling cap at pin 8 to GND.

almost all lights is use, use between 12 and 30 channels.

Guess I'm not a lighting guy... thought 9 was a lot.

For the value potentiometer, a regular pot will work if you only want to change the level/brightness of a channel. Since the analog pins read up to 1023 at 5V in, you can just divide the input value read at pot wiper by 4 to get the typical 0 - 255 values. If you want a specific value like "031", then that'll be a problem with a pot. For those special cases you can just have code that sends a specific value to a channel.

For that matter, if you just want to change the brightness of a channel, ignore the pot altogether and use a loop in the code to step the value from 0, 1, 2, ... to 255 and back to 0 or whatever.

rickso234:
This diagram of the MAX485 looks to be set up for both Tx and Rx. I've only used Tx (to DMX light) in which case pin 1 is tied to pin 2 with a 100 Ohm resistor and pin 2 is not tied to 5V.

So what to do with the pins 1 and 4 of the MAX chip?

May want to add a decoupling cap at pin 8 to GND.

A 0.1 uF ceramic capacitor, right?

If you want a specific value like "031", then that'll be a problem with a pot.

Why a problem with a pot? The ADC readings are always stable and accurate with a potentiometer. Also, the 10-bit to 8-bit conversion leaves us an error margin (of 4), big enough to compensate any small fluctuation between readings.

For those special cases you can just have code that sends a specific value to a channel.

Of course. And the channel is changed by a press of a button.

Pin 1 -> 100 Ohm -> Pin 2,
Pin 2 -> Gnd
Pin 4 -> DMX output from Arduino

0.1 uF ceramic capacitor should be fine but also put 1uF in parallel.

Pot will work just won't have great resolution. If using it just to change brightness then shouldn't be an issue. Could use a 10-turn pot or maybe one of each, one for coarse and one for fine.

rickso234:
Pin 4 -> DMX output from Arduino

Do you mean the TX pin of my board?

Pot will work just won't have great resolution. If using it just to change brightness then shouldn't be an issue. Could use a 10-turn pot or maybe one of each, one for coarse and one for fine.

Ohhhhh, got it. Are you suggesting me a "rotary encoder" for a real "fine tuning"?

Ohhhhh, got it. Are you suggesting me a "rotary encoder" for a real "fine tuning"?

no you dont need that. the resolution from the analogread is 0 -> 1024. (UNO)
DMX can only do 0 -> 255 so you need to divide 1024 with 4 to get 0 to 255.
fine stunning has the fixture on a differnt channel :wink:

all lightings desk i know, use analogFaders.

the only problem you can get is the analogread is realy unstable. so you need to smooth that out.
otherwise a Fixture can go all over the place.
like: the color wheel switches between 2 colors all the time.

and with a encoder you dont have this.

spirit:
the only problem you can get is the analogread is realy unstable.

Even when the potentiometer's shaft stands still? I don't think that the readings's fluctuations exceeds 4 (in a 10-bit value)

so you need to smooth that out.

How?

Do you mean the TX pin of my board?

WHichever pin you select using "DmxSimple.usePin", although exactly which pin "pin" refers to isn't clear. I had success with "DmxSimple.usePin(4);" and connecting the MAX485 to Arduino D2, which doesn't make sense but works.

Are you suggesting me a "rotary encoder" for a real "fine tuning"?

No, although that could be used. Was suggesting a 10-turn pot which takes 10 turns from end to end unlike traditional pot which takes <1. You could use just a 10-turn alone (lots of knob turning) or a traditional for coarse adjustment in series with a 10-turn for find adjust. Again, if all you want is simple 0 - 255 brightness then a traditional pot will be fine.

the analogRead is really unstable ... and ... so you need to smooth that out.

I haven't seen it be unstable or jumpy when it's not moving. I did, however, tie a cap (0.22u) from the wiper to GND to "smooth" the signal.

Making your own DMX light tester is a pretty good idea... certainly less costly than...
http://www.mcmelectronics.com/product/555-16300?scode=GS401&utm_medium=cse&utm_source=google&utm_campaign=google&gclid=CKTIg4zN-8sCFRFahgodfwAPZQ

Evidently I can't count...

I had success with "DmxSimple.usePin(4); connecting the MAX485 to Arduino D2

DMX output from Arduino is D4, as stated by usePin. Default is D3 pin.

I had success with "DmxSimple.usePin(4);" and connecting the MAX485 to Arduino D2, which doesn't make sense but works.

Why usePin(4) and connect to...

Evidently I can't count...DMX output from Arduino is D4, as stated by usePin. Default is D3 pin

Ohhhhhhh. Thankfully you clarified yourself. Otherwise you could leave me like: uhhhhhhhh ::slight_smile: are you kidding me?

Again, if all you want is simple 0 - 255 brightness then a traditional pot will be fine.

In fact, my project is meant to be just for testing fixtures, not to replace a commercial DMX controller, so that's why I want to keep this cheap

I haven't seen it be unstable or jumpy when it's not moving.

Me neither. When I tried out my Arduino board the first times, I've uploaded the example that prints out the readings from the A0 pin. When the potentiometer's shaft stays halfway, the readings oscillated between 510 and 511; so I believe here is nothing to worry about (or is it?)

Making your own DMX light tester is a pretty good idea... certainly less costly than...
http://www.mcmelectronics.com/product/555-16300?scode=GS401&utm_medium=cse&utm_source=google&utm_campaign=google&gclid=CKTIg4zN-8sCFRFahgodfwAPZQ

Ohhhh yeah. Way way less costly :o

Oh, and one more thing: if the signal is generated by a single I/O pin, will that mean the DMXSimple library is CPU-intensive?. Output is not from the TX pin (since an example of this library already uses serial communication), so definitely it's made out of the CPU timings.
Additionally, a DMX bit should take around 4 microseconds (correct me if I'm wrong); thus, even more CPU load.

Will all this be the reason why DMX communication "lags" when too many channels are available?
Take a look at this image and see what I'm talking about:

Does the MCU do all this stuff, or it's job for the MAX chip?

Yeah, I was confused with the " usePin(4)". Evidently changed the output pin and forgot to update the drawing.

I've used a pot to control DMX brightness and it works fin and not jumpy at all.

Here's an idea you might consider instead of 7-segment display... a detented pot wiper to an analog input. Read it just like the brightness pot but the detents (you put numbers on the panel behind the pot knob) are also your indication of what value detent you've selected.

  channelRead = analogRead(5);              // Read channel input
  if (channelRead >= 1006 && channelRead <= 1023) channel = 10;
  if (channelRead >=  928 && channelRead <= 1005) channel = 9;
  if (channelRead >=  806 && channelRead <=  927) channel = 8;
  if (channelRead >=  685 && channelRead <=  805) channel = 7;
  if (channelRead >=  573 && channelRead <=  684) channel = 6;
  if (channelRead >=  469 && channelRead <=  572) channel = 5;
  if (channelRead >=  362 && channelRead <=  468) channel = 4;
  if (channelRead >=  241 && channelRead <=  361) channel = 3;
  if (channelRead >=  111 && channelRead <=  240) channel = 2;
  if (channelRead >=   23 && channelRead <=  110) channel = 1;
  if (channelRead >=    0 && channelRead <=   22) channel = 0;

I recorded the readings from the Arduino analog input at each detent to use as the range's center value since they didn't quite match calculated values. With two pots (one for tens and one for ones) you can select channel 0 - 99.

"Potentiometers Linear B10K 11 detent positions"
Mouser P/N 313-3000F-10K $1.97ea.

Didn't understand how the diagram explains lag. If you're only testing one or a few lights at a time, lag shouldn't be an issue.

Does the MCU do all this stuff, or it's job for the MAX chip?

MCU does the work. MAX485 is just a level-shifter, converting the 0-5V to RS485 differential level format.

rickso234:
Didn't understand how the diagram explains lag. If you're only testing one or a few lights at a time, lag shouldn't be an issue.

I know that with a few channels that will not be a problem, but I'm trying to figure out why lags when too many channels are available; if it's a library's limitation, or a hardware limitation.

In theory, the DMX protocol goes at 250 Kbit/s, so 250000 bits in a second divided by 512 channels multipled by 11 (11 bits per channel, not just 8); then the final mathematical operation looks like this: 250000 / (512 * 11) = around 44.38 Hz of update rate for all the channels.

Is the MCU capable of accomplish that rate for the 512 channels simultaneously?

How many channels do you need at once? Thought the plan was to test DMX fixtures, and I assumed a few at a time, or are you planning to test a complete setup? Does lag matter as long as the fixtures are functioning?

THere are other DMX libraries out there for Arduino... maybe better coded and more efficient? YOu could write your own...

Can i use rs 485 breakout instead of max 485. its not working for me ..can somone pls help?