My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
DmxSimple  
DmxSimple library - Driving DMX from Arduino
Arduino, DMX, DmxSimple, Featured
Updated Jul 3, 2009 by cathed...@gmail.com

Video walkthrough now available

DMX controlled lights and visual effects are easily available from DJ or theatrical suppliers. This library gives you a simple way to drive spot lamps, floods, wall washers, lasers, smoke machines and more from a normal Arduino using DMX. If you can use analogWrite() to dim an LED, you will have no problems using DmxSimple to control something much bigger and brighter.

The software output is compatible with the Tinker.it! DMX shield, or DIY DMX circuits.

DmxSimple does some fancy stuff behind the scenes, so there is no need to worry about DMX frames, retransmissions and channel orders. Specify which channels you want at which value, and the library will handle everything else for you.

Compatibility

DmxSimple is compatible with all known Arduinos including the Mega. The following Arduinos are recommended, as they support both DmxSimple and the Tinker.it! DMX shield: Arduino Mega, Arduino Duemilanove 328, Arduino Duemilanove, Arduino Diecimila, Arduino Bluetooth, Arduino Pro (5V version only), Arduino NG, Arduino Serial.

Installation

Download the archive. Extract to (arduino install)/hardware/libraries/DmxSimple . Restart Arduino so it recognises the library.

Example code

The example code is also built into the library. Open Arduino, and look under File > Sketchbook > Examples > Library-DmxSimple.

Function calls

DmxSimple.write(channel, value);

Set DMX channel to value. Channel has the range 1 to 512 (128 on old Arduinos with a 168 or Mega 8). Value is in the range 0 (off) to 255 (full brightness).

DmxSimple.maxChannel(channel);

Set the number of DMX channels in the DMX system. The DMX system sends out channels in order, starting at 1. So it takes longer to send channels 1-512 than it does to send only channels 1-10. DmxSimple defaults to sending all channels, but by reducing this you can increase the lamp update rate for even smoother animation. Using DmxSimple.maxChannel(0) turns off the DMX system, so you can use pin 3 as a regular pin. It will revert to a DMX output next time you call DmxSimple.write() or DmxSimple.maxChannel(nonzero).

DmxSimple.usePin(pin);

Set the output pin. DmxSimple defaults to using pin 3, making it compatible with the Tinker.it! DMX shield. But if you use this function, you can output on any pin capable of digital output.

DmxSimple community

We now have a group on Google Groups. Get assistance starting with DMX, or show off your installations.

Library limitations

Timer 2 is used. Due to the small amount of RAM on 168 and Mega8 Arduinos, only the first 128 channels are supported. Arduinos with processor sockets can easily be upgraded to a 328 to control all 512 channels.

Upgrade notes

The original version 1 of DmxSimple used a file "DmxInterrupt.h". This has since been removed. To upgrade old sketches, remove the #include "DmxInterrupt.h" line. When upgrading the library from v1, delete all the old files before copying the contents of the new archive.
Comment by jekol...@gmail.com, Dec 30, 2009

Is it possible to make it work along with other libraries that uses Timer2?

I found this wonderful IRRemote library http://arcfn.com/2009/08/multi-protocol-infrared-remote-library.html and I think that DMX+IRRemote would be a wonderful combo, but both the libraries use Timer2 (in a very different way) and I wonder if it would be possible to make them work together...

Comment by pdgsocme...@gmail.com, Jan 4, 2010

Here's a first stab at using this library to control DMX via Firmata:

#include <Firmata.h>
#include <DmxSimple.h>

void dmxWriteCallback(byte pin, int value)
{
    // analogWrite is 10-bit, but DMX is 8-bit, so reduce the value
    DmxSimple.write(pin, value/4);
}

void setup()
{
    Firmata.setFirmwareVersion(0, 1);
    Firmata.attach(ANALOG_MESSAGE, dmxWriteCallback);
    Firmata.begin(57600);

    // Firmata only supports 16 analog pins, so limit the DMX output
    DmxSimple.maxChannel(16);
}

void loop()
{
    while(Firmata.available()) {
        Firmata.processInput();
    }
}
Comment by pan...@gmail.com, Apr 5, 2010

DMX Shield available to purchase from SK Pang Electronics http://www.skpang.co.uk/catalog/product_info.php?cPath=140_142&products_id=663

Comment by cadoma...@hudsonscenic.com, May 11, 2010

I am having getting this working well in Arduino 17 or 18. Has anyone tried it with either of these builds. I have verified my hardware with a different DMX out code set, but would prefer this library for ease.

Thanks - Chuck

Comment by reactify...@gmail.com, Oct 15, 2010

Does anyone know how to send messages with Firmata from Pure Data to an Arduino to control the DMX lights?

I have lamp with red in pin 3, white in pin 4 and the copper braid into the ground. Arduino Duemilanove is loaded with SerialToDMX (but I've also tried StandardFirmata?). I'm just not sure of the syntax of messages to come from Pd?

Thanks. Y

Comment by yuli.lev...@gmail.com, Oct 21, 2010

Just in case this interests anyone, I've now solved this problem and have made a video tutorial on how to do hook this up, along with a few examples of usage possibilities.

Pt 1: http://www.youtube.com/watch?v=3Q4hLA7YM7c Pt 2: http://www.youtube.com/watch?v=sq33uOGq_l0

Comment by jnrhack...@gmail.com, Nov 22, 2010

I need to alter DMXsimple to give a 500us break instead of the usual 88us. I have a light fitting that requires this.

heres the email from the manufacturer:

The problem is the "SPACE" for BREAK of the TRISTAR-RGB-DMX, which is 500. The standard DMX "SPACE" for BREAK is 88~144, but some DMX controllers handle a wide range of from 88~1,000.

So at this point, unless we can get our engineers to change the "SPACE" for BREAK, you need a DMX controller than can handle 500.

Thanks

Comment by project member cathed...@gmail.com, Nov 22, 2010

Cheers for the excellent technical diagnosis, jnrhacksaw. I'm inclined to keep the default break period to 88us, but it makes sense to make it easily adjustable for less compatible lights. I'll get coding. Watch this space...

Comment by Jonas.Ke...@gmail.com, Feb 16, 2011

Does it work on Arduino Mega2560?

Comment by alexande...@web.de, Mar 27, 2011

Hello, Peter Knight I need such a DMX-Shield, what does it cost me, and could You sent it to Germany ? please response to me to funnyking@live.de :)

Thaks

Comment by kavacrea...@gmail.com, May 12, 2011

analogWrite is only 8-bit, analogRead is 10-bit

Comment by ledsandc...@gmail.com, May 17, 2011

Does it work on Arduino Mega2560?

Comment by robert.v...@gmail.com, Jun 15, 2011

SK Pang module works with a 2560, you just need to make sure the pins line up correctly - not hard, as they are labeled on both boards.

Comment by cubikpla...@gmail.com, Jun 17, 2011

I have an Arduino UNO, does it support DmxSimple and the Tinker.it? Also can I use the shield on the Arduino UNO?

Comment by robert.v...@gmail.com, Jul 11, 2011

I have to admit I was too quick to give my above statement. I haven't managed to get the arduino and the shield to control my dmx lamp properly. I have tried the SerialtoDMX sketch, but I get NO response from my DMX light. I've followed the directions in Yuli's video, and my 2560 is blinking when I send a serial message, but nothing else happens after that.

Is the shield supposed to blink also on incoming serial messages? LED1 is lit all the time, otherwise no lifesigns from the shield. Is that normal?

Comment by kubr...@gmail.com, Dec 14, 2011

since arduino 1.0 wiring.h is not presend, so this library will not upload :(

Comment by soundguy...@gmail.com, Dec 17, 2011

Hi i get the following error's when compiling - any ideas as to why and how i can fix this?

C:\Program Files\arduino-1.0\libraries\DmxSimple\DmxSimple.cpp:11:20: error: wiring.h: No such file or directory C:\Program Files\arduino-1.0\libraries\DmxSimple\DmxSimple.cpp: In function 'void dmxBegin()': C:\Program Files\arduino-1.0\libraries\DmxSimple\DmxSimple.cpp:57: error: 'digitalPinToPort' was not declared in this scope C:\Program Files\arduino-1.0\libraries\DmxSimple\DmxSimple.cpp:57: error: 'portOutputRegister' was not declared in this scope C:\Program Files\arduino-1.0\libraries\DmxSimple\DmxSimple.cpp:58: error: 'digitalPinToBitMask' was not declared in this scope C:\Program Files\arduino-1.0\libraries\DmxSimple\DmxSimple.cpp:61: error: 'OUTPUT' was not declared in this scope C:\Program Files\arduino-1.0\libraries\DmxSimple\DmxSimple.cpp:61: error: 'pinMode' was not declared in this scope C:\Program Files\arduino-1.0\libraries\DmxSimple\DmxSimple.cpp: In function 'void dmxWrite(int, uint8_t)': C:\Program Files\arduino-1.0\libraries\DmxSimple\DmxSimple.cpp:183: error: 'max' was not declared in this scope C:\Program Files\arduino-1.0\libraries\DmxSimple\DmxSimple.cpp: In function 'void dmxMaxChannel(int)': C:\Program Files\arduino-1.0\libraries\DmxSimple\DmxSimple.cpp:194: error: 'min' was not declared in this scope

Comment by pedel...@gmail.com, Jan 26, 2012

I have managed to get SimpleDMX to work with arduimo 1.0 and Arduino Uno (at least the FadeUp example).

It seems like the functions and definitions that used to be in wiring.h has moved in to Arduino.h (causing the compile errors above). Simply open the DMXSimple.cpp file, remove the #include wiring.h line and add #include "Arduino.h"

Disclaimer: First time playing with Arduino :)

Comment by teamljsr...@hotmail.com, Yesterday (28 hours ago)

Please help mi dmx tester say my dmx shiel dont work y want to use ipad 2 dmx ulate an arduino uno ethernet shield and dmx shield al is ok , compiler ok but the dmx shield not work the dmx shield is a sk pang dmx shield , help


Sign in to add a comment
Powered by Google Project Hosting