Portable DMX controller. Pot for changing program and push button for action.

Portable DMX controller. A pot for changing program and a push button for action.

This one is a small project that I had to do twice to get right. It is a pedal used for controlling strobe light through DMX protocol. Technically it is built on top of a Pro Mini Arduino with simple DMX driver circuit. It has button to kick the action, rotating switch for choosing different presets and one switch for future expansion. You could basically control any DMX device with this hardware, but I built it for Stairville 1500DMX strobe light.

I made first version half year ago. At that time there wasn’t real DMX library available, just and example sketch that had suspicious elements in it. However it worked fine when powered through USB but for some reason quite buggy when external power supply was used.

The main difference with this second version is size. As Pro Mini is so tiny, I could build whole thing to a smaller box. I know there are lots of people who don’t understand what would be the point in using a non USB version of Arduino board, and this is a perfect example of the project where you will not want to fit Duemilanove inside. Also I wanted to minimize all external wires, so I made this one to work with 9V battery. Below is the picture of the finished product.

Contents of the controller.

Contents of the controller.

First step was to build a DMX driver. I used the instructions at Arduino Playground but built the circuit on tiny piece of circuit board. The circuit gets power through Arduino and outputs + and – data lines to xlr jack. Note that I used evil 3 pin XLR as my strobe light does use that one. Officially you would use 5 pin XLR jack. You can see the driver on the bottom right of the picture above.

I really like rotary switches as you can fit lots of different functions in such a small space. I basically soldered 100 ohm resistor between each pin, using the switch as stepped potentiometer. Similarly as potentiometer the values can be read to the Arduino using analogRead-function.

Resistor ladder allows one to read rotary switch with one analog pin input.

Resistor ladder allows one to read rotary switch with one analog pin input.

During the summer folks at Tinker.it did come up with this extremely simple DMX library called DmxSimple. It is basically doing all the hard stuff in background and enables you to focus completely on the actual features your device needs to have. The library comes with couple simple examples of which other one is for stand alone project like this and another to computer/DMX interaction.

DMX protocol in itself is rather simple. Each device has an address that can usually be changed somehow on that very device. For instance my strobe light has a dip switch that is used to select the address. I have selected address ’1′. If you know the address of the device you can adjust the parameters by sending a value between 0 and 255 to that address through your DMX controller. That usually adjusts the brightness or does something more special for the light you are controlling of. In many cases you can control more than one parameter of the light. In that case addresses following the first address are used. For instance my strobe light has two parameters, speed and brightness. If I send DMX message ’255′ to address ’1′ and DMX message ’100′ to address ’2′, the strobe light blinks as fast as it can but not as bright that it could. If I would change the start address of the strobe light to 100, the channels I would need to send DMX messages to would be 100 and 101. Here is the picture of my strobo lights address selector switch.

The address selector switch array of DMX strobe.

The address selector switch array of DMX strobe.

At least my strobe light works such that if DMX flow (the library is continously sending DMX messages in the background) stops, after half second it updates it both channels to zero and stops blinking. Therefore it is possible to switch the controller of to save battery even if the strobe is on. However I am planning to install a relay to the pedal that would switch the power off of the DMX driver when it is not needed to extend battery life.

Here is the code I have used. It is fairly simple to modify to function with different lights and such:

/* Simple strobe light pedal example
** (c) Jari Suominen 2009
** This piece of software is hereby released to public
** domain.
**
** It uses DMX simple library which is available from:
** http://code.google.com/p/tinkerit/
 */

#include <DmxSimple.h>

#define button 6
#define rotary_switch 0
#define strobo_address 1

boolean button_pressed = false;

void setup() {
  DmxSimple.usePin(3);
  DmxSimple.maxChannel(2);

  pinMode(button,INPUT);
  digitalWrite(button,HIGH);
}

/*
  Main loop, checks if pedal has been pressed or released
  and works accordingly. For the sake of clarity I'm not using
  all possible presets here.
 */
void loop() {
  if (!button_pressed &amp;&amp; digitalRead(button)==LOW) {
    // Button was just pressed
    int preset = get_preset();
    if (preset==0) { // FAST
      DmxSimple.write(strobo_address, 255);
      DmxSimple.write(strobo_address+1, 255);
    } else if (preset==1) { // MEDIUM
      DmxSimple.write(strobo_address, 150);
      DmxSimple.write(strobo_address+1, 255);
    }
    button_pressed = true;
  }
  else if (button_pressed &amp;&amp; digitalRead(button)==HIGH) {
     // Button was just released, lets turn the strobo off.
    DmxSimple.write(strobo_address, 0);
    DmxSimple.write(strobo_address+1, 0);
    button_pressed = false;
  }
}

/* returns the value the rotary switch is set to */
int get_preset() {
  int val = analogRead(rotary_switch);
  if (val < 50) {
    return 0;
  }
  if (val < 110) {
    return 1;
  }
  if (val < 210) {
    return 2;
  }
  if (val < 300) {
    return 3;
  }
  if (val < 400) {
    return 4;
  }
  if (val < 500) {
    return 5;
  }
  if (val < 600) {
    return 6;
  }
  if (val < 700) {
    return 7;
  }
  if (val < 800) {
    return 8;
  }
  if (val < 900) {
    return 9;
  }
  if (val < 1000) {
    return 10;
  }
  return 11;
}

« »