Friday, February 4, 2011

Prototype for Arduino control of Midi Dimmer pack

For my ME Senior Project this year, I have been assigned to work with the Galena Historical Society in Galena, Illinois. My Group has the task of designing three different exhibits for the museum. One exhibit involves the creation of a holographic type projection of Ulysses S. Grant and his wife Julia. The second exhibit is an interactive exhibit designed to highlight the famous Peace in Union painting, which will possibly be using this Arduino control, and a third hypothetical exhibit consisting of a rotating/translating display case. Write ups or more details on the display case and holographic projection may be posted later.

For the illuminated painting, the idea is to have a touchscreen with a digital version of the painting. Guests will be able to click on the individual figures to learn more about everyone contained in the painting. When a character is selected, they will be highlighted on the actual painting on the wall either by the addition or subtraction of lighting. Users will be able to navigate through various layers of details for each individual as they see fit, with the lighting following along.

The team is currently investigating several forms of lighting control, ranging from the standard Arduino to a Phidgets controller or perhaps a LANBox DMX controller. Ideally we will be able to create smooth fades between preset scenes without a huge investment.

Being a group of MEs, we aren't the most familiar with interactive museum exhibits so it has been an interesting process so far. We have a couple prototype interfaces in VB and html/php that we have been working with. At this point, it looks like we are going to got he VB route as it seems a little easier to talk to serial devices.

On the actual hardware control side, we picked up a few Arduinos to play with and try to start making some headway. Currently we have some little circuits rigged up to just trip relays so they stand as a fallback to actual commercial control solutions. As a next step, dimming was the logical option. My roommate Gigawatts had an old Midi controlled dimmer pack that we had been playing with for lighting control in our apartment and the necessary cables and stuff to hook it to an Arduino. I spent most of the night figuring out how to get midi to make stuff happen. I first went through playing with a button to change the light that was on. Although that was fun a moderately useful, I was more concerned about the quality of fades that could be obtained with MIDI as I am not terribly familiar with it as a lighting control interface. The biggest concern was that since we will be driving LEDs with it was that it would look choppy. I ended up sending MIDI values from 0x00 to 0x90 with a 20ms pause between steps. I suppose the resolution should not really have been a concern as 20ms is about one full cycle at 60Hz.

Anyway, This is what I ended up with for a circuit and such:

And this is the code that I have:
/* Midi light control
 Basic code to fade a light channel up and down via midi
 Initially used with Leprecon LD-360-MIDI dimmer pack
 Designed for:
 Bradley University Mechanical Engineering Senior project
 in cooperation the Galena Historical Society
 The circuit:
 * digital in 1 connected to MIDI jack pin 5
 * MIDI jack pin 2 connected to ground
 * MIDI jack pin 4 connected to +5V through 220-ohm resistor
 By Steve Krave
 Created 2 Feb 2010
 find more at
 This code is based on the midi tutorial found on the main Arduino page

int dim = 1;      // dim controls whether to fade up or down  
int intensity = 0;  // Controls the intensity, a value from 0 to 127
void setup() {
  //  Set MIDI baud rate:

void loop() {
  intensity = intensity + dim;
  //Set Intensity Value. Min 0x00, max 0x90
  //int value = 64 * (1 + sin(millis()/500));
  noteOn(0x90, 0x06, intensity);
  //controlls fade rate (ms) per step
  //sets to fade out when max intensity is reached
  if (intensity >= 0x90) dim = -1;
  //set to fade on when intensity hits 0
  if (intensity <= 0x00) dim = 1;

//  plays a MIDI note.  Doesn't check to see that
//  cmd is greater than 127, or that data values are  less than 127:
void noteOn(int cmd, int pitch, int velocity) {
  Serial.print(cmd, BYTE);
  Serial.print(pitch, BYTE);
  Serial.print(velocity, BYTE);

For a final result of:

On the video there is a set of regular old incandescent Christmas lights plugged in as well as this is a fairly cheap string of LEDs and will not dim properly without them.

Overall, I am quite pleased with the MIDI solution, though it does eat up the main serial port of the Arduino. Later on if we continue to use this method, it will probably require a software serial port but that not a major issue. It will of course take triggers and run the desired fades instead of a loop or any of that nonsense, but that's fairly trivial overall.

No comments:

Post a Comment