Activating lights/lamps to turn on and off

Hey all you lovely people!

I am working on a quite interesting project. I own a portable wand shop that travels to conventions and parties. It’s inspired by Harry Potter. I made my shop “interactive” meaning that when customers come into the shop, they “test” out several wands until the right wand chooses them. To achieve this, I’ve created a control box with an MP3 module that creates the illusion of magical effects.

The control box has a 18 channel Pololu maestro, a Robertsonics MP3 module, 4 buttons, and 10 leads to control servos and other hardware.

Here’s what each of the 4 buttons is intended to perform.

  1. Plays an MP3 of the wand “failing” to fire.
  2. Plays an MP3 of thunder and lightning, activates strobe lights, then turns off after 8 seconds.
  3. Plays an MP3 of wand firing, richocheting and causing havoc, activates 4 servos which move, shakes, and “breaks” props. Props “repair” after 16 seconds.
  4. Plays an MP3 of the wand “choosing” customer, servo lifts sign reading “Chosen One” then goes back down.

What I am seeking assistance is on how to turn on a plug connected to a strobe light (Button 2). I essentially need to build a powercord/light switch that can be controlled by my Pololu maestro. I’ve read that it can be done with a relay switch. Is there a compatible relay provided by Pololu that can achieve this? I’ve been looking at the 5v relay, but I’m concerned that it would not be able to handle power coming from a wall plug.

Here’s a tutorial I found on Sparkfun that explains what I am trying to achieve.

Another similar tutorial.

ALSO, very importantly, what would be the code to activate and de-activate the relay?


Hello, Carlo.

That sounds like a really fun project! We do carry a few relay modules that would work with the Maestro (specifically something like the RC Switch with Relay or one of the variations of the Basic SPDT Relay Carrier with 5VDC Relay). However, as noted on each of their product pages:

This product is not designed to or certified for any particular high-voltage safety standard. Working with voltages above 30 V can be extremely dangerous and should only be attempted by qualified individuals with appropriate equipment and protective gear.

Working with mains voltage as shown in those tutorials can be very dangerous; if you are not qualified to do so, you might consider looking for someone who is to help you.

You might also be able to use something like this PSC01 Powerflash Burgular Alarm Interface from X10 along with one of their Appliance Modules for a safer method of handling mains voltage.

As for controlling a relay from the Maestro; it would depend on which relay module you are using. The RC Switch with Relay accepts RC hobby signals, so the Maestro can control it with a channel configured as a servo output. For the Basic SPDT Relay Carrier with 5VDC Relay, you will need to configure the channel as an “Output” to have it send digital high and low signals. You can find more information about this in the “Channel Settings” section of the Maestro User’s Guide.


Wow, thanks for the tip on the alarm modules. I think I’ll go with those!

As for the output pin, would I wire the dry contact screws to GROUND and VIN or GROUND and VSRV?

Would the output for that channel be a servo output and what would the highest and lowest values for that output be?

For example, with high value at 5000 and low at 0, output on pin 2, I want the lights to turn on for 7 seconds:

5000 2 servo
7000 delay
0 2 servo

I’m really basic with coding, so any examples are greatly appreciated!

Thanks so much!

To use the Maestro to trigger the dry contacts on the alarm module, you will probably still need to use one of the relay modules (e.g. one connected to COM and one connected to NO).

As I mentioned in my previous post, if you are using the basic SPDT relay carrier, you can configure one of the Maestro’s channels as an “Output” to send digital high and low signals. To do this in a script, you would use the servo command; 1500us (6000 quarter microseconds) is the threshold for setting the output high or low (e.g. a higher target corresponds to a logical high output, and a lower target to a logic low).

Using the RC Switch with Relay would require the Maestro channel to be configured as a “Servo” output, and the RC switch has a threshold of 1700us for the switch to activate (by default).

For either case, the Maestro script below would toggle the output on channel 2 every 7 seconds, but the channel would need to be configured for the appropriate output in the “Channel Settings” tab of the Maestro Control Center:

  4000 2 servo
  7000 delay
  8000 2 servo
  7000 delay


Brilliant! Thank you so much! I will get working on this soon. When everything is finished, I’ll be sure to post the results in the forum.

Thanks again so much!