Receive DMX-512 with an Arduino

Part I: ProloguePart II: Instructions

arduino

Shiny and new out of the box!

Prologue: For Christmas, I received an Arduino.  If you’re not familiar with them, they’re like a little computer with a lot of pins to which you can connect outputs like LEDs, servos, relays, triacs, or anything you’d want to control, as well as photosensors, switches, anything you’d want to take an input from.  You write your program in the easy-to-learn Arduino environment, upload it to the Arduino board, and it’ll run your program automagically.  I’m not a programmer, but less than an hour after taking it out of the box I had it blinking an LED for me.  Buy one, they’re perfect for all of us who are trying to create some Theater Magic with no money or hope of getting any.

Well, Almost Perfect.  There’s been a way to send DMX with an Arduino for awhile, but when I started poking around for DMX reception code, I came up with zilch.  If you’re already savvy with microcontrollers and assembly code and avrdude and whatever-the-fuck-else, you probably know about this solution.  Me, I look at assembly code and I just hear a dull screaming in my head, nevermind all that other stuff that I don’t know how to do either.

So I figured that a great first project would be to remedy this situation, and write a program to receive DMX on the Arduino platform.  In the way of all Works in this Vale of Tears, this ended up being much more difficult and taking much longer than I initially anticipated.  But eventually I figured it all out, and so here it is!

Features:

  • In-the-field addressing from 1 to 512 via two tact switches (works with the previously released I/O Shield, here).
  • Address is stored in non-volatile EEPROM, so it is retained when power is lost to the Arduino.
  • Addressing hardware allows full use of the pins.
  • Number of addresses to receive is configurable.
  • Works with controllers that send less than the full 512 address set.
  • Break detection is done correctly by detecting a Low value of >88μS per ANSI E1.11-2008, rather than the frame error hack used by many devices.
  • Uses interrupt-based subroutines to eliminate processor-load related timing problems.
  • If the DMX data signal is lost, the Arduino will maintain the current state until new values are received.
  • The reception and user code run sequentially rather than at the same time, so they won’t interfere with each others’ timing.

Continue to Page 2 for Download and Instructions…

Go to Section:

  1. Part I: Prologue
  2. Part II: Instructions
  3. Part III: Known Limitations, Notes, and the Code
  4. View All

Pages: 1 2 3


61 Responses to “Receive DMX-512 with an Arduino”

  • dmtry Says:

    Hi. Very interesting project thanks! can be used in various applications. I would like to add encoder and managed using several DMX channel setting motor speed and position

  • Daniel Kendell Says:

    Firstly, thanks and well done for cracking this, I’ve wanted to be able to add DMX to my lighting projects for a long time now but sussing it out myself is currently beyond my ability. I’m totally building one of these! :D

    Something I’m unsure about though, Rapid Electronics don’t have a “MAX485″, but they do have “MAX485CPA+” and “MAX485CSA+”. Are either of those suitable for this? I don’t know what the difference is.

    Thanks again for publishing your work,
    Dan

  • Max Says:

    Hi Daniel,
    The difference is the package. The CPA is a through hole package, whereas the CSA is the surface mount. You’ll want the CPA. Best of luck with your project!

  • DDD Says:

    Hi there,

    Any update on the code? Will there be a future version that does not need to modify the Arduino lib?

  • Ed Says:

    Incredible work!
    I am having trouble getting things to work for me.
    I am using Arduino 0017.
    Do you have any more recent builds of your project?
    Thanks so much!

  • Max Says:

    Hi All,
    I will put together an update for IDE 0017 or verify that the current version works. If you don’t want to wait, you could just take a look at what I’ve done to the hardware.cpp file and do the same to the IDE 0017 version.

    Note that the hack to the Arduino library files is necessary due to code on the Arduino side, not my software, so I have no control over when/if this will be fixed.

  • BlueFusion Says:

    For everyone else using 0017:
    The mod you need to make to the hardwareserial.cpp is this:

    Change line 115 from:
    uint8_t rxen, uint8_t txen, uint8_t rxcie, uint8_t udre)

    to:

    uint8_t rxen, uint8_t txen, uint8_t rxcie, uint8_t udre, uint8_t u2x)

    and it should compile.

  • David Says:

    The fix given by BlueFusion does work. One note for a little more clarity: you should do this as an additional modification in the already modified hardwareserial.cpp file (the one included in the download from this site).

    Thanks anyway for the work already done on this, I will be constructing a centerpiece for a disco with this which will have 8 pinspots, mirrors and servo’s! (and maybe we will abuse it every now and then with our band :))

  • James Corbett Says:

    Can your modifications send and receive or not?

  • Gregory Haley Says:

    Doing research.
    Looking for a solution.
    I Need to manipulate 2000+ 3w-5w LED’s for my art project.
    http://www.TheBallofLight.com
    Your project seems like it would allow for it. Each of the 2000 lights would need to be able to be driven by a central DMX console. As I read each of your units can manipulate 512 individual lights. That sounds astounding. That would mean I would need to make only 4 of these units. That would also mean 4 Universes I believe. I think I would also need 4 optical splitters to lead to these units. Then back to the Console.

    I have many questions on this topic and am just getting started on a two and half year project.

    If you are interested at all interested I would love to tell all and pick your brain some you seem extremely knowledgeable on this subject.

  • Max Says:

    I actually would not use DMX for this application– I would try to get your LEDs to take a video input. That way, you’ll be able to program it from a VJ software (such as Arkaos, there are dozens) rather than a theatrical lighting console, which will give you a more intuitive and flexible programming paradigm. Also, I would try to source your LED drivers from commercially available hardware such as the driver boards for LED billboards. By the time you buy the components for 2,000 DIY drivers, you won’t be saving any money, and the soldering involved gives me the creeping horrors. I mean, why spend all your time reinventing the wheel, when you could be focusing on the art? My $.02

Leave a Reply