Light "scrambler" for theatrical lights

Hi everyone!

This is my first venture into Arduino projects. At this time I have no hardware, I would need a recommendation on what to buy..

I run tech for my local community theater, and the play that we are producing is of a "supernatural" variety. There are a couple scenes where characters who play ghosts make an entrance and when they do the lights are supposed to go nuts.

It would not be an issue if we had modern DMX equipment to work with, but being community theater money is very tight. We are all volunteers and we work very hard for free and pay for things out of pocket to keep the theater running.

The lighting console does not have individual flash buttons, and trying to rapidly work 12 channel sliders in a way that doesn't look like crap is proving to be a challenge. So I had an idea..

This is a standard 0-10v analog theatrical scrimmer system. So I was planning on picking up a 16 channel relay board, and wiring it up with the output to the lights on the common terminal and the input from the console on the NC terminals. Then I plan to feed 10v into the NO terminal. My original idea was to simply make a momentary button board that activates the relays and just rake the buttons with my hand - overriding the slider voltage and causing the lights to flash full intensity..

But then I started thinking that I might be able to use an Arduino to activate the relays - to where I can press one button and it will do 5 seconds of totally random flashing then stop and wait for the next button press.

However, I know NOTHING of programming. Is there some kind soul out there who would be willing to write this up for me and help out the arts? :slight_smile:

Thanks for anything you can help with!

Seems like it ought to be easy enough from the Arduino point of view. Is it OK from the point of view of the lamps themselves to flash them like that, though? It's quite a shock and big incandescent lamps might not like it.

Hi Peter,

Yes they are heavy duty theatrical ellipsoids, 575w apiece. They are designed to take it. :slight_smile: The dimmer pack also keeps the bulbs 'pre-warmed' even when the sliders are at zero.. There is always a small amount of current flowing through the filaments so they don't have 'cold shock' and burn out when you turn off the blackout switch.

Try and look at the arrays.
Then hook it up "random" and you got it :wink:

Pady:
Try and look at the arrays.
Then hook it up "random" and you got it :wink:

I don't follow..

The software side will be very easy. I think the immediate challenge will be to design the circuit between the Arduino and the 'scrimmer'. Using relays as you describe isn't the simplest way but has the advantage of completely isolating the two systems which seems like a big advantage here. I assume you would replace each manual slider with a relay that switches between two circuits. One circuit would use the standard slider to set the brightness when the flashing was 'off'; the other would use an additional pot to set the brightness when the lamp was being flashed 'on' by the Arduino. In this way you would still have access to all the original controls, and if you use the NC circuit for the original slider then you always have the option to unplug the Arduino and revert to plain old manual control. That will probably be important in case this DIY solution messes up in the middle of a production.

ETA: Incidentally, I suggest that you control the flashing using a hard-coded timed sequence rather than actually randomising it.

Does your scrimmer unit provide independent analog inputs for the 0-10V signals?

If so and as long as the Arduino is powered from the same AC branch or battery supplied, you don't need relays. The input impedance to theatrical lighting controls is supposed to be about 100K ohms, so a low-current 10V signal switched with a transistor is all you need to activate that input. See attached schematic. Note that the logic is inverted, as "HIGH" on an output pin turns OFF the lamp. The 10V source could be from the Arduino battery supply as well.

dimmer.png

PeterH:
The software side will be very easy. I think the immediate challenge will be to design the circuit between the Arduino and the 'scrimmer'. Using relays as you describe isn't the simplest way but has the advantage of completely isolating the two systems which seems like a big advantage here. I assume you would replace each manual slider with a relay that switches between two circuits. One circuit would use the standard slider to set the brightness when the flashing was 'off'; the other would use an additional pot to set the brightness when the lamp was being flashed 'on' by the Arduino. In this way you would still have access to all the original controls, and if you use the NC circuit for the original slider then you always have the option to unplug the Arduino and revert to plain old manual control. That will probably be important in case this DIY solution messes up in the middle of a production.

You nailed my intentions perfectly. It must be absolutely fail-safe, which is why I thought SPDT relays from the start. If something goes awry, I should be able to cut power to the relay board and release control back to the console. I wasn't even thinking about having adjustable voltage on the override, I don't think it's needed since there will be plenty of headroom on the channels to just hit them with straight 10v.. We have enough lights that it's rare to run them over 60% during production.

What else would I need as far as the interface? I thought there were output channels on the Arduino board that could drive the relays directly, no? I will be building a T-harness for the relay board that simply plugs in between the console and the scrimmer, I won't have to modify the console or scrimmer at all.

ETA: Incidentally, I suggest that you control the flashing using a hard-coded timed sequence rather than actually randomising it.

If you feel that's a better route, by all means I'm listening. :slight_smile:

jremington:
Does your scrimmer unit provide independent analog inputs for the 0-10V signals?

If you mean one wire per channel plus common, yes. It's not a multiplexed signal.

If so and as long as the Arduino is powered from the same AC branch or battery supplied, you don't need relays. The input impedance to theatrical lighting controls is supposed to be about 100K ohms, so a low-current 10V signal switched with a transistor is all you need to activate that input. See attached schematic. Note that the logic is inverted, as "HIGH" on an output pin turns OFF the lamp. The 10V source could be from the Arduino battery supply as well.

The scrimmer pack is backstage connected to a 240V/50A dedicated breaker, and the console is up in the booth on a regular branch circuit. The Arduino would be powered in the booth by the same circuit.

However as I explained to Peter, this has to be fail-safe, which is why I need to use relays and keep it isolated from the system. I can't have it go rogue and take over the console on me. :slight_smile: I really appreciate the suggestion though. :slight_smile:

What else would I need as far as the interface? I thought there were output channels on the Arduino board that could drive the relays directly, no?

If you get one of the relay boards designed to run directly from the Arduino, that's all you need.

If you intend to use individual relays directly connected to the Arduino, you need relays with a 5V coil rated at 40mA or less. Note that in addition to the 40mA per I/O pin limit, there is an overall limit of 200mA total.

It must be absolutely fail-safe, which is why I thought SPDT relays from the start.

I'm not too sure about the "logic"... The relay will give you 2-states: That could be on/off, or Arduino/Manual. I think you need the Arudino to switch on/off, and you MIGHT need another relay to switch between the Arduino controller and the manual controller.

...Just make sure you've thought-through how it's going to work.

taz420nj:

Pady:
Try and look at the arrays.
Then hook it up "random" and you got it :wink:

I don't follow..

look at the [u]Blink Without Delay Example[/u].

Modify the sketch to use a [u]random()[/u] delay time.

Then, modify the sketch again to add more LEDs/lamps.

(The blink without delay method allows you to have independent timers without one delay/timer affecting the other.)


This isn't a difficult project, but depending on much electronics and/or programming experience you have,and depending on how much time you have before the production opens, you may not have time to complete it.

  • I'd suggest you start with the regular 'ol [u]Blink Example[/u] to test your relay design & concept with one real theatrical lamp.

  • Then, you can add a number of LEDs and develop your sketch (firmware/software) to randomly blink multiple LEDs. Once the software is fully functioning, it should be simple to add more relays.

You'll probably have to adjust the timing a bit after adding real lamps, since they don't snap on & off like LEDs. With incandescent lamps, I typically go with a 1/10th second (100mS) minimum flash time. It seems to take a bit more time to "flash off"... If the lamp is on and it goes-off for 1/10th of a second, it's not quite as noticeable as if it comes-on for 1\10th of a second.

  • For the future (when you have more time), you may want to consider using transistors or MOSFETS instead of relays so that you can add automated dimming. Then, you might want to build a manual 'master" A/B relay box that switches between the programmable Arduino controller and the existing manual controller.

DVDdoug:
If you get one of the relay boards designed to run directly from the Arduino, that's all you need.

This is what I was looking at.. http://www.ebay.com/itm/16-Channel-12V-Relay-Shield-Module-For-Arduino-UNO-2560-1280-ARM-PIC-AVR-STM32-/321298005269?pt=LH_DefaultDomain_0&hash=item4aceda7d15

If you intend to use individual relays directly connected to the Arduino, you need relays with a 5V coil rated at 40mA or less. Note that in addition to the 40mA per I/O pin limit, there is an overall limit of 200mA total.

Ok, so I'm not sure of the draw on these boards.. I know most relays are only a couple mA apiece though.. Plus whatever the circuitry draws. I should be okay though, right, even if all 16 are pulled in at once?

I'm not too sure about the "logic"... The relay will give you 2-states: That could be on/off, or Arduino/Manual. I think you need the Arudino to switch on/off, and you MIGHT need another relay to switch between the Arduino controller and the manual controller.

...Just make sure you've thought-through how it's going to work.

Yeah it will work as-is. Basically each channel on the console outputs an independent value of between 0 and 10 volts that corresponds with the dimming percentage of the slider (0V=0%, 1V=10%, 2V=20%... 10V=100%). Each channel sends that voltage down a separate wire to the dimmer unit (the scrimmer), which then does a linear proportional scale of the voltage of a 120V edison socket for that channel.

So what I am going to do is insert the SPDT relays inline between the console and the scrimmer on each channel. The common contact goes to the scrimmer, and the NC goes to the console. That way when the relays are at rest, it works totally normal. Unless a relay coil gets physically stuck, this would be fail-safe because if the Arduino went rogue and would not release the relays, all I would have to do is cut the Vcc to the relay board.

Then I am going to feed the NO contacts of each relay with 10V - which when the relay activates will flash that channel to 100% regardless of its slider setting. Once the relay releases it goes back to whatever the slider is set at. As I said my original intent was to just make matrix of momentary switches to activate the relays, and just rake it randomly with my hand... But the thought of using the Arduino is much cooler! :smiley:

taz420nj:

Pady:
Try and look at the arrays.
Then hook it up "random" and you got it :wink:

I don't follow..

look at the [u]Blink Without Delay Example[/u].

Modify the sketch to use a [u]random()[/u] delay time.

Then, modify the sketch again to add more LEDs/lamps.

(The blink without delay method allows you to have independent timers without one delay/timer affecting the other.)


This isn't a difficult project, but depending on much electronics and/or programming experience you have,and depending on how much time you have before the production opens, you may not have time to complete it.

  • I'd suggest you start with the regular 'ol [u]Blink Example[/u] to test your relay design & concept with one real theatrical lamp.

  • Then, you can add a number of LEDs and develop your sketch (firmware/software) to randomly blink multiple LEDs. Once the software is fully functioning, it should be simple to add more relays.

You'll probably have to adjust the timing a bit after adding real lamps, since they don't snap on & off like LEDs. With incandescent lamps, I typically go with a 1/10th second (100mS) minimum flash time. It seems to take a bit more time to "flash off"... If the lamp is on and it goes-off for 1/10th of a second, it's not quite as noticeable as if it comes-on for 1\10th of a second.

  • For the future (when you have more time), you may want to consider using transistors or MOSFETS instead of relays so that you can add automated dimming. Then, you might want to build a manual 'master" A/B relay box that switches between the programmable Arduino controller and the existing manual controller.

Ok I'll look into those.. Let just say I have much more experience with the electronics side than with programming. I learned a little BASIC in high school, made the little birdie flap its wings and make a tune, and that's about it. :slight_smile: Building circuits doesn't scare me. Programming a microcontroller does.

I have about a month to mess with this (Opening Night is April 8), which should be plenty of time. As far as doing other things with it like full dimming, I'd need to mess with it more first before I'd trust the whole show to it. But if I could train it to say, read DMX commands from a PC program and translate it to the lights, that would be very cool and something I'd be very interested in experimenting with!

So what board should I be looking at for this? Would this one work? http://www.ebay.com/itm/US-2012-Version-UNO-R3-Development-Board-MEGA328P-ATMEGA16U2-USB-Cable-f-Arduino-/251445187465?pt=LH_DefaultDomain_0&hash=item3a8b4d1389

The Arduino I/O pins aren't capable of driving enough current to operate a typical relay and I assume you will want to use readily available relays - this means you will need to have a driver circuit between the Arduino and the relay. There are plenty of motor drivers and relay shields with four channels but you'll obviously need more than that so I think you should be looking at something like the Freetronics I2C stackable relay shield.

For the relays themselves, I'd plan to use stackable relay sockets and pluggable relays. These are readily and cheaply available for 12V operation in an automotive environment but there are plenty of non-automotive options too.

Once you have the hardware side sorted out, the Arduino software itself will be very simple so I suggest you focus on the hardware for now.

Incidentally, these drivers will cope with enough current to drive the analog voltages directly i.e. using the driver to pull up one end of a pot which you use to set the brightness. You could quite feasibly eliminate the relays completely. but for what it's worth I think the relays provide a level of robustness and ensure you have an absolutely bomb proof workaround if it all goes pear shaped - I think that using a relay to intercept the existing sliders is entirely reasonable.

I had linked to this above but the link is not hot for some reason..

This is what I intended to use:

It says it can be driven right from an Arduino.. I assume that means it has that driver board built-in (or else what is the circuitry below the relays for)? It has 16 individual header pin inputs to trip the relays, and I thought that meant they could be hooked directly to the digital pins on the Arduino board.. The two-terminal block next to the header is the 12v coil power (I did not see that until I looked at the specs).

taz420nj:
I had linked to this above but the link is not hot for some reason..

This is what I intended to use:

It says it can be driven right from an Arduino.. I assume that means it has that driver board built-in (or else what is the circuitry below the relays for)? It has 16 individual header pin inputs to trip the relays, and I thought that meant they could be hooked directly to the digital pins on the Arduino board.. The two-terminal block next to the header is the 12v coil power (I did not see that until I looked at the specs).

That picture looks like its from one of NYPlatform's eBay auctions. He has both 5v and 12v relays. I use their relay boards all the time. Those have built in opto-isolators and resistors, so you can connect them directly to an arduino pin. You will want to measure the power draw of each pin though, to ensure that you do not exceed the Arduino's total current capacity.

Quote from: taz420nj on March 02, 2014, 09:19:55 pm
Quote from: Pady on March 02, 2014, 08:47:00 pm
Try and look at the arrays.
Then hook it up "random" and you got it :wink:

I don't follow..
look at the Blink Without Delay Example.

Modify the sketch to use a random() delay time.

Then, modify the sketch again to add more LEDs/lamps.

(The blink without delay method allows you to have independent timers without one delay/timer affecting the other.)

Something like that DVDdoug :slight_smile:

Or

used that for some Tivoli Lights at my farthers model railroad.
Pretty easy and took me around 10 minutes :slight_smile:

/*Alittle something for my dad's H0 modeltrain
*this is the light for a swing from the '50s
*based on a 8 LED kit from some web retailer.
*the code is simple, as were the Tivoli light in the '50s
*/
 
//LED Pin Variables
int ledPins[] = {2,3,4,5,6,7,8,9,10,11}; //An array to hold the pin each LED is connected to
                                   //i.e. LED #0 is connected to pin 2, LED #1, 3 and so on
                                   //to address an array use ledPins[0] this would equal 2
                                   //and ledPins[9] would equal 11
 
/*
 * setup() - this function runs once when you turn your Arduino on
 * We the three control pins to outputs
 */
void setup()
{
  
  //Set each pin connected to an LED to output mode (pulling high (on) or low (off)
  for(int i = 0; i < 10; i++){         //this is a loop and will repeat ten times
      pinMode(ledPins[i],OUTPUT); //we use this to set each LED pin to output
  }                                   //the code this replaces is below
 
  /* (commented code will not run)
   * these are the lines replaced by the for loop above they do exactly the
   * same thing the one above just uses less typing
  pinMode(ledPins[0],OUTPUT);
  pinMode(ledPins[1],OUTPUT);
  pinMode(ledPins[2],OUTPUT);
  pinMode(ledPins[3],OUTPUT);
  pinMode(ledPins[4],OUTPUT);
  pinMode(ledPins[5],OUTPUT);
  pinMode(ledPins[6],OUTPUT);
  pinMode(ledPins[7],OUTPUT);
  pinMode(ledPins[8],OUTPUT);
  pinMode(ledPins[9],OUTPUT);
  (end of commented code)*/
}
 
 
/*
 * loop() - this function will start after setup finishes and then repeat
 * we call a function called oneAfterAnother(). 
*/
 
void loop()                     // run over and over again
{
  oneAfterAnotherLoop();
}


void oneAfterAnotherLoop(){
  int delayTime = 350; //the time (in milliseconds) to pause between LEDs
                       //make smaller for quicker switching and larger for slower
 
//Turn Each LED on one after another
  for(int i = 0; i <= 9; i++){
    digitalWrite(ledPins[i], HIGH);  //Turns on LED #i each time this runs i
    delay(delayTime);                //gets one added to it so this will repeat 
  }                                  //8 times the first time i will = 0 the final
                                     //time i will equal 7;
 
//Turn Each LED off one after another
  for(int i = 9; i >= 0; i--){  //same as above but rather than starting at 0 and counting up
                                //we start at seven and count down
    digitalWrite(ledPins[i], LOW);  //Turns off LED #i each time this runs i
    delay(delayTime);                //gets one subtracted from it so this will repeat 
  }                                  //8 times the first time i will = 7 the final
                                     //time it will equal 0
                                     
                                     
}

Here it is, for now it's only 10 channels but could be more...

Ok I think I get it now.. So what you're saying is use a 'chase' array (the knight rider example) but hook the channels up in a way that they would flash seemingly randomly instead of in order 'scanning' across the lighting truss?

You'll have to forgive me, even what you guys consider simple code looks like Chinese to me.. :smiley:

I'm now thinking of picking up this Due board, because it has plenty of IO for me to play with in other things later.. Any problems with these?

http://www.ebay.com/itm/DUE-R3-Cortex-M3-SAM3X8E-with-USB-Cable-for-Arduino-US-SELLER-FAST-SHIP-/181282263003?pt=LH_DefaultDomain_0&hash=item2a3543cfdb

I really appreciate you guys' help!

Hi, me again!

Ok so I've received my Mega, and I've been playing around with it.. I think I am getting close to what I want by simply using a modified "Knight Rider" code.. It looks great with the constant timing versus random.

int buttonPin = 2;
int pin22 = 22;
int pin23 = 23;
int pin24 = 24;
int pin25 = 25;
int pin26 = 26;
int pin27 = 27;
int pin28 = 28;
int pin29 = 29;
int pin30 = 30;
int pin31 = 31;
int pin32 = 32;
int pin33 = 33;
int timer1 = 150;
int timer2 = 5;
int buttonState = 0;

void setup(){
pinMode(buttonPin, INPUT_PULLUP);
pinMode(pin22, OUTPUT);
pinMode(pin23, OUTPUT);
pinMode(pin24, OUTPUT);
pinMode(pin25, OUTPUT);
pinMode(pin26, OUTPUT);
pinMode(pin27, OUTPUT);
pinMode(pin28, OUTPUT);
pinMode(pin29, OUTPUT);
pinMode(pin30, OUTPUT);
pinMode(pin31, OUTPUT);
pinMode(pin32, OUTPUT);
pinMode(pin33, OUTPUT);
}

void loop() {
buttonState = digitalRead(buttonPin);
if (buttonState == LOW) {

digitalWrite(pin22, LOW);
delay(timer1);
digitalWrite(pin22, HIGH);
delay(timer2);

digitalWrite(pin23, LOW);
delay(timer1);
digitalWrite(pin23, HIGH);
delay(timer2);

digitalWrite(pin24, LOW);
delay(timer1);
digitalWrite(pin24, HIGH);
delay(timer2);

digitalWrite(pin25, LOW);
delay(timer1);
digitalWrite(pin25, HIGH);
delay(timer2);

digitalWrite(pin26, LOW);
delay(timer1);
digitalWrite(pin26, HIGH);
delay(timer2);

digitalWrite(pin27, LOW);
delay(timer1);
digitalWrite(pin27, HIGH);
delay(timer2);

digitalWrite(pin28, LOW);
delay(timer1);
digitalWrite(pin28, HIGH);
delay(timer2);

digitalWrite(pin29, LOW);
delay(timer1);
digitalWrite(pin29, HIGH);
delay(timer2);

digitalWrite(pin30, LOW);
delay(timer1);
digitalWrite(pin30, HIGH);
delay(timer2);

digitalWrite(pin31, LOW);
delay(timer1);
digitalWrite(pin31, HIGH);
delay(timer2);

digitalWrite(pin32, LOW);
delay(timer1);
digitalWrite(pin32, HIGH);
delay(timer2);

digitalWrite(pin33, LOW);
delay(timer1);
digitalWrite(pin33, HIGH);
delay(timer2);

}
}

Now the first thing I have not been able to figure out is that I need to add four more relays to the program that do not 'cycle' with the rest.

Relay 13 will override the 'blackout' switch on the console. It needs to engage 500mS before the cycle runs, and then release 250mS after it finishes.

Relay 14 will activate a strobe light. It needs to engage at the same time as the first relay in the program and needs to release at the same time as the last relay in the program (before the 'blackout' relay 13 releases)

Relay 15 will control a telephone ringer. It needs to run its own cycle of 2000mS on, 4000mS off, starting at the same time as the first light relay in the cycle. So as the lights are doing their thing, the telephone is ringing as it would in the real world.

Relay 16 will trigger a solenoid that drops a picture off the wall. It just needs to hit once at some time during the light cycle.


And the other thing that's throwing me is I need the lights (Relays 1-12) to cycle a few times, while relays 13-16 are once per button push. I have no clue how to make it run as a 'program within a program'.

Oh and one more thing.. I don't know why, but when the Mega is reset, it turns on all of the relays, and they stay on until the program runs through once (they turn off in sequence as the program runs). After that it's normal. Is there an error in the code that's doing that?

Thanks so much for your help! :slight_smile:

Oh and one more thing.. I don't know why, but when the Mega is reset, it turns on all of the relays, and they stay on until the program runs through once (they turn off in sequence as the program runs). After that it's normal. Is there an error in the code that's doing that?

It looks like you digitalWrite(LOW) to turn a light on. Low is the default state of an output, so all of them will be on to start. Put a for loop in setup to set all your pins high to start with.

wildbill:

Oh and one more thing.. I don't know why, but when the Mega is reset, it turns on all of the relays, and they stay on until the program runs through once (they turn off in sequence as the program runs). After that it's normal. Is there an error in the code that's doing that?

It looks like you digitalWrite(LOW) to turn a light on. Low is the default state of an output, so all of them will be on to start. Put a for loop in setup to set all your pins high to start with.

Got it! Thanks! And now I sorta understand how the for loop works.. I was able to use the example to do the pin initialization as outputs too!

I have already tested it, and it works, but before I commit it to my memory, is this the 'correct' way it should have been done? I am really excited to learn how to do this and I don't want to be learning it wrong! :smiley:

for (int thisPin = 22; thisPin < 34; thisPin++)  
    pinMode(thisPin, OUTPUT); 
for (int thisPin = 22; thisPin < 34; thisPin++)  
    digitalWrite(thisPin, HIGH);

is this the 'correct' way it should have been done?

It gets the job done. Personally, I'd just use one for loop with the pin mode and digitalWrite statements controlled by it.

You also have the pin numbers defined e.g. pin22. Better to use those than the literal numbers. Better to give them more meaningful names too :stuck_out_tongue:

Ok so instead of pin22, I should have

int Relay1 = 22;
pinMode(Relay1, OUTPUT)
digitalWrite(Relay1, LOW);

Etc?

This is my first steps into something that requires raw programming, so I tend to stick to using known examples (even if bloated and inefficient) that work as-is until I learn what can be changed and made more efficient. :slight_smile: