Receive DMX-512 with an Arduino!

Hi All, I've written a sketch that allows you to receive DMX-512 with an Arduino. If you're not familiar with it, DMX is the control protocol for theatrical/live event lighting. It's been possible to send DMX with an arduino for quite awhile, but this will allow you to receive DMX values and execute your custom code accordingly.

The code is quite long, and there's some hardware setup and malarkey with the wiring_serial.c file involved, so I'm just going to give you the link:

http://blog.wingedvictorydesign.com/2009/03/20/receive-dmx-512-with-an-arduino/

It's my first project with the Arduino, and I worked really hard on it, so please let me know if it works for you and how you like it.

It has the following features: - Capable of receiving 8 contiguous addresses from 1 to 505. - Works with controllers that send less than the full 512 address DMX frame. - Break detection is done correctly by detecting a Low value of >88[ch956]S per ANSI E1.11-2008, rather than the frame error hack used by many devices. - Uses interrupt-based algorithms to eliminate processor-load related timing problems. It may be of general interest to those in this forum who are trying to get interrup-based sketches off the ground - 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.

And the following limitations, as of now: - Atmega168 based processors only (you will have to rename the registers and interrupt vectors if you want to use it for another processor). - Currently only tested with a USB-DMX Pro controlled via Lightfactory and MagicQ software, since that's what I could get my hands on. But it handles a variety of frame rates, break lengths, etc. just fine. If you're in the Portland area, and you'd like to let me test it with other controllers, drop me a line. Also, if you use it with other controllers, let me know how it turned out. - Because I needed access to exact timing, I had to use the Timer2 functionality, so pins 3 and 11 cannot be used for PWM. - Will not detect bad addressing, such as “dmxaddress=510;” or ”dmxaddress=50;” when only 55 slots are sent by the controller.

I'm still developing and improving the software, so check the link above for the latest version.

Max

great Work! i will try that one.

this is the code I´m using. I modified it for the atmega 168 arduinos. Se the last post. http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1223117506/15

It would be great to make a dmx reciving libary. im also working on how to make the adressing of the dmx reciver easy. im thinking of a shift register soultion.

Update:

Code is confirmed working on the Atmega 328. Turns out the register names are the same, so it works without any adjustment.

I have designed a shield for it, which can also be used for DMX output: http://blog.wingedvictorydesign.com/2009/04/29/arduino-dmx-512-io-shield/

The shield allows in-the-field addressing, without permanently disabling any of the pins.

Address is stored in non-volatile EEPROM, so it is retained when power is lost to the Arduino.

Drop me a line in this thread or the comments section on my blog if it worked for you :), or didn't work for you :(

Cool, this is exactly what I was looking for.

Are there any updates on your endeavors with DMX-512?