Introduction: Arduino Audio Triggered Power Switch

Ever wanted your home entertainment or sound system to power up itself when plugging in your iPod or other portable MP3 player?

Watch this video to see how it works. Then flip through the steps to find out how to make one using the Arduino controller.



Step 1: Parts and Schematic

This is what the finished instructable looks like. The required circuit is built onto a Arduino Proto Shield that mates to the Arduino Duemilanove microcontroller.

To successfully complete this project, you will need to know how to solder, how to build simple electronic circuits, and have experience programming the Arduino microcontroller.

Pictured are some of the parts you will need. Here's a complete parts list:

1 ea Arduino Duemilanove or equal ( Radio Shack 276-128 Arduino Uno REV3 will work also) with power adapter
1 ea Arduino Proto Shield (Radio Shack 276-140 is slightly different but will work)
2 ea Phone jacks (Mouser 161-3508-E)
1 ea Terminal block, 5.08mm (Mouser 651-1935561)
1 ea Tactile PB switch (DigiKey SW407-ND)
1 ea 10K ohm variable resistor (DigiKey AAS14CT-ND)
1 ea 2N3904 transistor (Radio Shack 276-2016)
1 ea 47mf 16v electrolytic capacitor (Radio Shack 55047407)
1 ea 1K ohm, 1/4w film resistor (Radio Shack 271-1321)
2 ea 10K ohm, 1/4w film resistor (Radio Shack 271-1335)
1 ea 22K ohm, 1/4w film resistor (Radio Shack 271-1339)
1 ea PowerSwitch Tail II (Adafruit .com ID 268 or Sparkfun.com COM-10747)

And finally, the schematic diagram of the circuit.

Step 2: Getting Started

Most of the parts will fit directly into the .1 inch spaced holes in the Proto Shield. The exceptions are the phone jacks, the override pushbutton switch and the terminal block. 

Here I've soldered short pigtail wires to each of the terminals of the phone jacks. (To simplify construction, I cut off the two grounding terminals.) When you have the three wires attached, trim them to different lengths. This will make it easier to insert the wires into the Proto Shield one at a time. In the picture, both jacks sit flush against the Proto Shield. 

Using the same technique, I added the pushbutton switch between the phone jacks. 

Turn the Shield board over and bend the wires over and solder the connections. See the picture in the next step.

Step 3: Building the Circuit.

Positioning of the parts is not critical but with careful placement you can minimize the number of wires that have to be added later to complete the circuit.

In this step, I installed the 10K ohm resistor for the push button switch. Notice the placement allows me to make the needed connections using only the wires on the resistor.

Step 4: Complete Proto Shield Assembly

Here are top and bottom views of the completed Proto Shield board. Install the components from the top side of the board, bend the leads over as shown and solder on the back side. The terminal block fits into the oversized holed pads near the edge of the Shield.

The brown wires are solid #24 AWG hook up wire. These make the connections from/to parts that don't already have wires attached.

The last picture shows the Proto Shield installed on the Arduino.

Step 5: Finishing the Project.

With the unit completed, load the sketch below into the Arduino.

Switching of the ac power is safely accomplished using a PowerSwitch Tail. I used some green/white twisted wire I had left over from another project to connect the Shield to the control signal terminals on the side of the PowerSwitch Tail. You can use Cat5 or other low voltage cable since the control wires are isolated from the power line. See the schematic for polarity. 

The plug end of the PowerSwitch Tail goes into the power outlet in the wall. The power plug from my home entertainment system goes into the receptacle on the PowerSwitch Tail. (Actually, everything is plugged into a power strip that then plugs into the PowerSwitch Tail.)

When the control signal to the PowerSwitch Tail is energized, the relay inside the PowerSwitch Tail closes and provides power to the sound system. A LED on the the PowerSwitch Tail lets you know when the control signal is present.

The output of the iPod can go into any of the two phone jacks since they are wired in parallel. The other phone jack feeds the CD or AUX input on my sound system. I used a long phone plug to dual RCA cable.

Setup and testing:

1. Power up your new Audio Triggered Power Switch by plugging in the power adapter into the Arduino power jack.

2. Connect the output of your portable player to either of the phone jacks. I used my iPod.

3. Connect the other phone jack to your sound system. I choose the "CD" input.

4. Turn the 10K variable resistor to the CCW rotation stop.

5. Put your portable player in the PLAY mode to send audio to the instructable. Adjust the volume slider to your typical setting.

6. Turn the 10K variable resistor clockwise slowly until the PowerSwitch Tail triggers and supplies power to your sound system. (If the LED on the Arduino board (connected internally to output D13) lights up but the PowerSwitch Tail does not energize, try reversing the polarity of the control signal wires to the PowerSwitch Tail. When the polarity is correct, the LED on the PowerSwitch Tail and the Arduino will light at the same time. Also make sure the power switch on your sound system is in the ON position.)

7. Adjust the volume control on your sound system to the desired level.

8. To turn off, place your portable player in PAUSE or STOP.

9. The PowerSwitch Tail will de-energize your sound system after about 20-30 seconds of silence. 

Adjustments:

1. The 10K variable resistor controls the input level of the audio signal to the circuit. Advance the control clockwise far enough to ensure the sound system powers up when there is audio present but not too far so that residual electronic noise triggers the circuit. For simplicity audio from only one channel is sensed. If you want to sense audio from both channels, a simple resistive mixer can be used.

2. The push button switch is an override. Momentarily press the switch to toggle the system on or off when the player is in STOP or PAUSE or not connected.

3. Other digital adjustments such as how quickly the switch turns on when the player is first placed into play, how long a silence period before it turns off and the trigger threshold can be easily optimized by changing various parameters in the Arduino sketch. The sketch is fully commented.

Have fun!

DIY Audio

Participated in the
DIY Audio