Simple light controller idea

1,142 views
Skip to first unread message

René Knuvers

unread,
Jul 9, 2010, 12:34:44 PM7/9/10
to DmxSimple
HI, I'm René, 35 yo male from the Netherlands and new in this group.

I will be working on a project with the Arduino and probably the
DmxSimple library to make it a stand-alone DMX light show controller.
This I will use as a simple 'install and forget' controller for a
mixed LED/conventional lighting system for my band (www.re-mixed.nl
for who is interested) Our setup has two four-bars with PAR56 lights
of which two have straw filters to work as front lights that are
always on. Furthermore we have a bunch of LEDBAR's in the back,
sometimes with additional RGB led strips, and a fogger (smoke
machine). I now use a 24-channel controller, but find it bulky, and
not so easy to use on the stage. Furthermore I like to fiddle around
with µC's and especially the Arduino, so...

I envision it to be like this:

- A small box that can rest on top of my synthesizer, with a few
buttons, and possibly an LCD.
- one single DMX output, or maybe an extra one for easier cabling.
- It will transmit a set of static channels: 1 at 10%, 2 at 20% etc.>
these I can use to set dimming levels prior to the show for the static
lights.
- a few pushbuttons select different 'scenes' or sequences, defining
the 'mood' of the lights to match the song we play
- Alternatively the sequence selection could be done by a midi program
change at a later time
- The sequences should be programmable per USB flash drive, or SD
card. Programming should be something like a CSV file
- A 'black-out' button should stop the sequence, kill the light
fixtures that are in the sequence, and LEAVE the static channels.

I guess most of the things are pretty easy to program. What I'm trying
to figure out, is how to do program fades, and fade times in an easy,
but flexible way. Per sequence step one fade time? Or even per
channel? And how do I make sure fades over an unequal
"distance" (difference in DMX luminosity value) take the same amount
of time, without getting too math-intensive? Especially for RGB-Led's
this is relevant.

Anyone interested in such a project? Hints and tips are welcome. I
will publish the code and hardware description here, so feel free to
build with me!

René Knuvers

unread,
Jul 10, 2010, 7:10:50 AM7/10/10
to DmxSimple
Some extra info/thoughts/idea's:

- FILE ON SD CARD: if reading ASCII is too difficult, I probably
revert to a binary file, and have dedicated PC program to pre-program
the show
- FILE ON SD CARD: How fast would it be? If I can read lets say 64
bytes within 40ms, I probably can do this during the show playback, so
I won't need to store the whole show in an array (RAM is limited, so
shows will be short...)
- CPU HARDWARE: since hardware is relatively cheap (compared to a
computer/USB-DMX interface, or dedicated DMX playback controller) I
guess I will start off at the Arduino MEGA, rather than trying to
squeeze it into an Arduino with Atmega168 or 328.
- WIRING: I will probably end up making two boxes: one with the CPU/
DISPLAY/SHIELDS, the other being a connector box and power supply. In
between a DB9 1:1 connection would carry power supply and DMX512. This
way I can leave the box with the robust cables on the floor.

René Knuvers

unread,
Jul 19, 2010, 6:26:48 AM7/19/10
to DmxSimple
So, I'm making progress here. I have bought myself a DFRduino I/O
expansion 4.0 board, which breaks out the IO ports to 3-pin sensor/
servo connectors and (much more important) has a RS485 transciever
onboard with screw terminal. Ideal for DMX, I guess... Note that this
board is more widely available and cheaper than most DMX boards, but
since it is not advertised as a DMX board, people probably won't pick
it up for this purpose at all!

I will post my results here.

The SD-card shield is on the way, so I hope to be able to do some
testing soon with that. likewise, results will end up in this post.

René Knuvers

unread,
Jul 19, 2010, 6:29:54 AM7/19/10
to DmxSimple
About this:

On 9 jul, 18:34, René Knuvers <r.knuv...@gmail.com> wrote:
> What I'm trying
> to figure out, is how to do program fades, and fade times in an easy,
> but flexible way. Per sequence step one fade time? Or even per
> channel? And how do I make sure fades over an unequal
> "distance" (difference in DMX luminosity value) take the same amount
> of time, without getting too math-intensive? Especially for RGB-Led's
> this is relevant.
>

The answer was already on this group:
http://groups.google.com/group/dmxsimple/browse_thread/thread/952373517e52ba64

René Knuvers

unread,
Jul 20, 2010, 3:24:19 PM7/20/10
to DmxSimple
OK, it's time for the first code here. As I wrote, I'm using the
DFRobot I/O Expansion shield V4, and it requires some hardware setup
to get it to work:

- of the three 'RS485' jumpers, set the leftmost ones (the two closest
to the word DIGITAL to the upper position, so they should cap the
middle pin and the pin in the DIGITAL 485 row. BUT NOT the rightmost
one (close to the '485' text) as this is the receiver pin. You don't
need that, and it will screw up your USB connection.
- You have to test out your DMX wiring. Some equipment talks about '+'
and '-', which is not correct. The shield is labeled 'a' and 'b', but
what is '-' and what '+', is something you have to find out yourself.

I checked this using a Duemilanove 328 at 16MHz, the DFRduino I/O
expansion shield V4 DFR0014 by DFRobot, and the setup controlled a
four channel dimmer pack, Showtec Multidim MKII.

Now for the code: where the DMX shields have the 'send' mode
hardwired, this true RS485 converter has the enable pin attached to
Arduino pin 2. You need to set this to HIGH to enable transmission.
For the rest, the code is just a four channel version of 'fade up and
down'.

<code>
/* Welcome to DmxSimple. This library allows you to control DMX stage
and
** architectural lighting and visual effects easily from Arduino.
DmxSimple
** is compatible with the Tinker.it! DMX shield and all known DIY
Arduino
** DMX control circuits.
**
** DmxSimple is available from: http://code.google.com/p/tinkerit/
** Help and support: http://groups.google.com/group/dmxsimple */

/* To use DmxSimple, you will need the following line. Arduino will
** auto-insert it if you select Sketch > Import Library > DmxSimple.
*/

#include <DmxSimple.h>

const int DMXpin = 1;
const int RS_ENpin = 2;

void setup() {
/* The most common pin for DMX output is pin 3, which DmxSimple
** uses by default. If you need to change that, do it here. */
DmxSimple.usePin(DMXpin);

/* DMX devices typically need to receive a complete set of channels
** even if you only need to adjust the first channel. You can
** easily change the number of channels sent here. If you don't
** do this, DmxSimple will set the maximum channel number to the
** highest channel you DmxSimple.write() to. */
DmxSimple.maxChannel(64);

pinMode(RS_ENpin, OUTPUT);
digitalWrite(RS_ENpin,HIGH);
}

void loop() {
// Cycle channel 1 to 3
for (int channel = 1; channel <4; channel++){

// increase brightness from zero to full
for(int brightness = 0; brightness<=255; brightness++) {

DmxSimple.write(channel, brightness);

delay (1);
}

// ... and back to zero
for(int brightness = 255; brightness>=0; brightness--) {

/* Update DMX channel 1 to new brightness */
DmxSimple.write(channel, brightness);

delay (1);
}

}

// channel 4 to 2
for (int channel = 4; channel >1; channel--){

// brightness from zero to full
for(int brightness = 0; brightness<=255; brightness++) {
DmxSimple.write(channel, brightness);

delay (1);
}

// and back to zero
for(int brightness = 255; brightness>=0; brightness--) {

DmxSimple.write(channel, brightness);

delay (1);
}


}
}
</code>

It works like a breeze, so now the next step: reading show data from
an SD card. I will be using this library: SdFatLib, http://code.google.com/p/sdfatlib/
to read the SD card, and will put like 8 or so files on there, 1 for
each show... more on that in my next post!
Reply all
Reply to author
Forward
0 new messages