| Light Sequencing and Decoding DMX with an Arduino | | Print | |
| Written by Akiba | |
| Monday, 31 October 2011 | |
|
It's been a while since I posted anything and that deserves another post just to talk about everything that happened in the last 8 months since the March earthquake and tsunami here in Japan. I'm a little bit tired of heavy topics and serious projects so I thought I'd put together a little something that's kind of fun and also timely. Now that we're moving into the holiday season, we're about to start seeing the hard core Christmas people setting up the elaborate light displays. The equipment to switch all the lighting channels and sequence everything is usually a bit costly but it doesn't have to be. If you're familiar with the Arduino environment and willing to put in a bit of elbow grease, blinging out your lawn is just a couple of mouse clicks away :) I put this three part video tutorial together on how to use the Arduino platform to decode the DMX protocol. The DMX protocol is a standard protocol for stage lighting displays and it happens to be supported by a nice freeware light sequencer called Vixen. In the first part, I go over the DMX-512 protocol and the Arduino source code to decode it. In the second part, I show how to configure a lighting sequence with Vixen, some hardware implementations, and the whole system working together. And in the final part, I show how some simple changes to the code can enable you to control your lights wirelessly. You can download the source code here. Note: A sample of the modified "HardwareSerial.cpp" is also included as a reference on how to modify the one inside your particular Arduino IDE installation. I'd recommend using a fresh installation of the Arduino IDE to try this tutorial out. The reason is that the HardwareSerial.cpp file needs to be modified and this may break other Arduino projects you might have. Hope you enjoy :)
Hits: 26017 Trackback(0)
Comments (9)
![]()
New to DIY projects
written by Charles Candles, November 05, 2011
Was wondering if the is a place where i can get more information about "HardwareSerial.cpp" changes. I try several thing, including replacin/utilizing the exmaple provided.
The "HardwareSerial.cpp" has a different sequence of event and after several tries of commenting different areas/segments I have not been succsesful to compile. Any help or guidance is apreciate it. report abuse
vote down
vote up
Votes: +0
Re:Light Sequencing and Decoding DMX with an Arduino
written by gbmhunter1, October 01, 2012
I just had a look at HardwareSerial.cpp in the latest Arduino release (v1.0.1), and it looks like it has been changed again from the '022' version.
I couldn't get Vixen to talk to my Arduino (the RX interrupt was never being triggered), I have a got a feeling it is because I have the new HardwareSerial.cpp version and don't know enough to comment out the correct parts. report abuse
vote down
vote up
Votes: +1
Light Sequencing and Decoding DMX with an Arduino
written by FEK_, October 05, 2012
Same problem here : the latest release (v1.0.1) has been changed from the '022' version.
Any idea to how properly comment the good lines for HardwareSerial.cpp ? report abuse
vote down
vote up
Votes: +0
Write comment
|
| Michael Morlan |
Re:Light Sequencing and Decoding DMX with an Arduino
Feb 18 2012 16:17:46 Thanks, in advance, for taking the time.
|
#3938 |
| Michael Morlan |
Re:Light Sequencing and Decoding DMX with an Arduino
Mar 22 2012 14:17:35 Hi Akiba,
Thanks, again, for sharing your project. I'm not sure why I couldn't replicate your results. I finally gave up trying to get your code to work on my setup and found success with the DMXSerial library created by Matthias Hertel over at http://www.mathertel.de/Arduino/DMXSerial.aspx. Best, Michael |
#4623 |
| Akiba |
Re:Light Sequencing and Decoding DMX with an Arduino
Mar 23 2012 00:42:51 Sorry about not getting back to you. Things got super hectic over here. But thanks for sharing the link. I'd like to check it out and see if there's anything I can learn from his project. Good luck on yours!
|
#4631 |
| Michael Morlan |
Re:Light Sequencing and Decoding DMX with an Arduino
Mar 23 2012 14:16:58 You've been very generous to share your own projects. Thank you.
I now have a Boarduino driving a 2x16 LCD and TLF5940 chip. The TLF chip drives two hobby servo motors on a pan/tilt rig and a ULN2803 transistor array to a 3w RBG LED. I have a multi-channel DMX scheme, much like intelligent moving heads, with acceleration/deceleration functions to handle smooth movement of the servos. Having a lot of fun. Michael |
#4658 |
| j reckart |
Re:Light Sequencing and Decoding DMX with an Arduino
Mar 26 2012 12:11:59 Michael Morlan wrote:
QUOTE: I'd be very interested in your moving light project! I have always thought of doing that. Can you post more specifics, schematics , pictures, or videos? Jr |
#4708 |
| Michael Morlan |
Re:Light Sequencing and Decoding DMX with an Arduino
Mar 26 2012 15:47:56 Yes, of course. I'm still debugging the acceleration algorithm (which is essentially a simple, physics-based accel/de-accel routine rather than a math-based s-curve calculation.)
I'm not sure where best to post the project. Akiba, is it okay to post in this thread or do you recommend another forum? Michael |
#4709 |
| j reckart |
Re:Light Sequencing and Decoding DMX with an Arduino
Apr 05 2012 23:27:29 I would like to build a wall mounted DMX controller that would fit into a single gang box. I would like to have maybe four buttons on the faceplate, that i would pre-program to various "scenes" for a church, ie full on, full off, worship, prayer.
the Arduino would do this, but i have a twist. I would sometimes control the lights with full DMX console. so i would want to have the Arduino be a "middle man". DMX Console --> Arduino wall mount controller --> wire to dimmer packs --> lights I would want the DMX to check for an incoming signal, and if none is found act as a DMX master and "take over" sending the signal down the line, according to which scene's button was pressed. But if it detects a signal, I would want it to "repeat" the incoming signal from my Console down the line. Is the Arduino Robust enough, or fast enough to do this? JR |
#4971 |
| Akiba |
Re:Light Sequencing and Decoding DMX with an Arduino
Apr 06 2012 00:42:39 No problem to post it here
|
#4974 |
| Akiba |
Re:Light Sequencing and Decoding DMX with an Arduino
Apr 06 2012 00:45:19 I think you'd have to check to see if there is any speed issue on the Arduino. At 8 MHz, which is what the Freakduino runs at, I can decode the DMX and send/receive wireless data. For standard Arduinos, they run at 16 MHz so you can theoretically get twice the performance (or utilization) out of them. So in theory, you should be able to both decode, toggle lighting, and forward the data.
|
#4975 |
| j reckart |
Re:Light Sequencing and Decoding DMX with an Arduino
Apr 06 2012 13:01:10 Is there an appropriate spot here that i can start a discussion on this? I would be using the full arduino, not the freakduino, but the folks here seem to be morte friendly and helpful that other places. I would be willing to post all info or schematics to help others also.
thanks JR |
#5013 |
| Akiba |
Re:Light Sequencing and Decoding DMX with an Arduino
Apr 06 2012 23:47:04 Ha ha ha. Start away. Might be good to use a new thread though. I'm actually starting up a project in Tokyo Hackerspace for DMX light sequencing for some stage work using an Arduino so I should be actively developing on the software too.
|
#5032 |
| Mitch |
Re:Light Sequencing and Decoding DMX with an Arduino
Apr 22 2012 13:51:02 Hi everyone. I'm new to the forum and I'm glad I've found this precious resource.
In particular, I'm planning to realize an arduino-based project involving wireless DMX lighting control. I've consulted the tutorial above and I think it is brilliant work. Actually, I'm planning to realize this with a RFM12B transmitters (they are very cheap and support 115K baud rate, on paper at least). What I want to do is connect a PC running e.g. FreeStyler (multi-platform lighting control software) to an arduino which will then send DMX data via the RFM12 transmitter to a RFM12 receiver on another arduino board which in turn will be connected to the 3-pin DMX input of a fixture (e.g. a scanner, moving head or LED PAR). The above I think is covered by the tutorial (with some tweaking due to the different wireless protocol). However, I'll also need to get going with the DMX "daisy-chain" to more fixtures (e.g. PC -> LED PAR -> scanner -> Laser -> moving head -> 120ohm DMX terminator). All this I'm planning to realize wirelessly. The problem I see is in using only 1 arduino per fixture to manage both the DMX input TO the fixture and the forwarding of the DMX output FROM the same fixture to the next light in the daisy-chain. Would in your opinion 1 arduino uno board be capable of processing both Input and Output streams? would 2 separate RFM12 transmitters per board be needed? Is it possible to go for a point-multipoint wireless solution where, instead of a "chain" of fixtures, the first arduino connected to the PC broadcasts the DMX universe separately to all receiving arduinos and lights connected thereto? This I think could be possible as I understand that the DMX protocols works by addresses so that every light only takes into account the part of the signal addressed to it and just forwards the DMX signal stream without processing. As you see I'm in pre-alpha stage here. Any suggestion would be highly appreciated. Also, do please move this post as appropriate. Sorry if I've been long. Thank you very much for your appreciated attention =) |
#5482 |
| Akiba |
Re:Light Sequencing and Decoding DMX with an Arduino
Apr 23 2012 01:55:03 I don't think you'd want to decode the data and then re-encode the data to forward it. I would probably recommend tying the DMX input pins to the DMX output pins for the forwarding. Then tap off the input pins to the Arduino to decode the data. That way, you won't have to burn CPU cycles re-encoding things. Even processing 250kbps serial data is a huge burden on the Arduino.
|
#5490 |
| Michael Morlan |
Re:Light Sequencing and Decoding DMX with an Arduino
Apr 23 2012 16:01:40 Yes, exactly. Tap off a pass-thru DMX circuit. (Don't forget to have a 120ohm terminator on the last DMX device in the line.)
M |
#5508 |
| Alex |
Re:Light Sequencing and Decoding DMX with an Arduino
May 10 2012 21:05:34 Hello.I have a question. I made the same(as on video), but on usb cord. But when i connect Xbee- light-emitting diodes stop to blink. What Wireless you used, and what setting is?
can i do the same using Xbee? Explane plz how to make it! I use arduino, xbee shield, and xbee 2 series |
#6259 |
| Kevin McLoughlin |
Re:Light Sequencing and Decoding DMX with an Arduino
Nov 05 2012 22:58:21 I have just made a similar setup using and arduino uno r2 and v1.01
Vixen - Enttec Open DMX - USB-RS485 (FTDI Adaptor cable) - max 485 chip output to RX pin on Uno. I have added a line to Akib`s setup code... and left in (commented out) a couple of other things i tried. Not sure why it works but it does! Thanks for this excellent site, i would be totally lost without the help of the software guys. void setup() { // set update flag idle update = 0; // set default DMX state dmx_state = DMX_IDLE; // set DMX pins to ouput and idle value for (int i=0; i<DMX_NUM_CHANNELS; i++) { pinMode(dmx_pin[i], OUTPUT); //pinMode (13, OUTPUT); digitalWrite(dmx_pin[i], LOW); } // initialize UART for DMX // this will be 250 kbps, 8 bits, no parity, 2 stop bits //UCSR0C |= (1<<USBS0); // NEXT LINE PUT IN TO ENABLE REC AND REC COMP INTERUPT //UCSR0B = (1<<RXEN0) | (1<RXCIE0); // From ATmeg manual UCSR0C = (1<<USBS0)|(3<<UCSZ00); Serial.begin(250000); } |
#8953 |
| Eddie Noyes |
Re:Light Sequencing and Decoding DMX with an Arduino
Feb 01 2013 04:37:16 Maybe I'm missing something, and I feel a simple answer exists so excuse me if this is already posted on another thread.
I have the DMX receiver working with the software through the USB, but I'd like to make this a standalone device that can accept DMX input from another lighting console through a max485 chip and the pins on the arduino. What modifications need to be made in the code for this to work? I'm relatively new to digital logic design and the arduino platform itself, so any help would be greatly appreciated. |
#10497 |
| Akiba |
Re:Light Sequencing and Decoding DMX with an Arduino
Feb 01 2013 07:30:28 The USB looks just like a serial port from the Arduino's perspective. If you want to make it standalone from a 485 transceiver, just connect the serial pins from the RS-485 chip to the Arduino's serial pins. Don't forget to terminate the RS-485 properly.
|
#10500 |
| Eddie Noyes |
Re:Light Sequencing and Decoding DMX with an Arduino
Feb 02 2013 00:06:18 Thanks so much. This is one of the most helpful forums I've found on the topic so far.
|
#10507 |
| Eddie Noyes |
Re:Light Sequencing and Decoding DMX with an Arduino
Mar 25 2013 03:21:02 I finally had the opportunity this past weekend to prototype a DMX reception circuit to dim an LED up and down using an external DMX controller. I had some issues, the main being that the LED flickers the entire time, and ch 2 on the controller decides that it also wants to control the LED. I made a video demonstrating this and offering a better explanation to my problem, any help would be great. I wasn't sure if anyone else here was having the same problem as I am. I would like to get this working to control strips of red, green, and blue, thus the reason my code has 3 channels declared.
Video: http://www.youtube.com/watch?v=ZzbTI0iwSjU&feature=youtu.be Code: QUOTE: |
#12536 |
| Eddie Noyes |
Re:Light Sequencing and Decoding DMX with an Arduino
Mar 25 2013 03:22:46 I also don't want anyone to get the wrong impression, I don't claim any ownership of this code, it was all borrowed from earlier posts on this thread. I really only added the analogWrite line instead of using the digitalWrite.
|
#12537 |
| Akiba |
Re:Light Sequencing and Decoding DMX with an Arduino
Mar 25 2013 03:26:59 How many channels are you decoding?
|
#12538 |
| Eddie Noyes |
Re:Light Sequencing and Decoding DMX with an Arduino
Mar 25 2013 03:43:44 Right now for testing purposes I only have 1 LED hooked up, however the code is ready to use 3 channels for RGB using PWM pins 9,10,11 on the Uno.
|
#12539 |
| Danny |
Re:Light Sequencing and Decoding DMX with an Arduino
Apr 01 2013 23:15:57 For starting quickly writing you arduino dmx master or slave app you might want to take a look at the following library: http://sourceforge.net/projects/dmxlibraryforar
It is a uart based library and still under development but support all basic functionality required to get running. If you want advice on shields to use just leave me a message. |
#13224 |
| Akiba |
Re:Light Sequencing and Decoding DMX with an Arduino
Apr 01 2013 23:56:42 Nice. Thanks for the link!
|
#13243 |
| Next > |
|---|
I built an expensive controller with 16 channels of triacs and such - it does variable light levels not just the On/Off in your tutorial. http://www.diylightanimation.c...al_Express
It would be very cool if I could do just a few channels with variable levels and some bright LEDs inside for cheap.