This build was made to address the problems people (like me) have using high voltage lights by using low powered battery operated LED Christmas lights. It is also intended for just a small setup like a Christmas tree or other small scale display. I also only setup to use 6 music channels and used MOSFETs to switch the lights on and off rather than relays. More or less channels can easily be accommodated with some simple code modifications and a little less or more additional hardware.
I also modified the light string wiring somewhat and created a harness using 3.5mm mono audio extension cables to connect the light strings.
My build at this stage is still a bit of work in progress, however, it is in a state that I could put it to use right now.
My work is based on an Instructable by thone (Arduino Powered Musical Christmas Lights) which was my inspiration for this one. The code I am reusing from his project detects the frequency of the notes coming from the MP3 player. Thone’s original project was based on an Arduino Uno, but I wanted to get a smaller footprint controller and ported the code to work on an Arduino Micro.
LM317T Voltage Regulator
N-Channel MOSFET ZVN4306A x 6
· 10k Ohm x 8
· 4.7k Ohm x 2
· 47k Ohm
· 1.5k Ohm
· 680 Ohm
· .1 uF
· 1 uF
· 10 uF
3.5mm Mono Audio Extension cables x 6 – 6-foot
12v DC 2A Power supply
MP3 Player (Any make/model will do)
Powered Speaker (Optional)
Audio cables as required
Heat shrink tubing (1.5mm & 3mm)
Step 1: Light Prep
I found some inexpensive lights at my local go-to shop that fit the bill.
I cut the battery compartment from the light string and set aside for other projects and for testing. Once the battery compartment was removed, test the string of lights to make sure you identify which line is positive and which is negative. Make sure you mark each wire correctly.
Next the 3.5mm Audio Extension cable was cut with the male connector end of the cable left with ~6-8inches of cable. The female connector part has the remainder of the cable. Prep each end of the cable for soldering.
I used stereo cables, since that was all the local shop had, but would recommend using mono cables. They might be cheaper, but either will work fine. The stereo cables usually have 3 colored wires in the bundle – Red, White, & Yellow. White is usually the tip of the male connector. Red is the middle connector. And Yellow is the last sleeve on the pin end of the connector. I used the tip of the connector – the white wire as the positive (+) power connection and the Red and Yellow I joined to make the ground (-) connection.
Before you start soldering, slip a short section of 1.5mm heat shrink tubing over each of the light string wires and slip a short section of 3.0mm heat shrink tubing over cable from the 3.5mm male connector. Solder the light string wire you identified as positive to the white wire from the male connector cable. Next solder the red/yellow wires to the other line of the light string wire. Slide the 1.5mm tubing over the solder joint and use a hot-air gun or lighter to shrink the tubes in place. Next slide the 3mm tubing over the tubing already in place. This second tubing layer is to help strengthen the leads and to try to prevent things coming undone.
These lights normally run on 3xAA batteries (~4.5v). For my setup I used a LM317T adjustable voltage regulator to take in 12v from the DC power supply and output ~4volts. More on this when I get to the board setup.
Step 2: Light Harness Bundle
With the female portion of the cables use some white tape to mark and number them from 1 to 6. You will also want to mark the other ends of the cables with the same numbers to make sure you get the lights in the right sequence. For my setup I put #1 at the top of the string and this will be for the high range of frequencies detected by the code, #6 is the lower set of lights.
At the cut end of the cable bundle, connect all the white wires together and solder onto one solid wire lead to be plugged into the 4volt output from the LM317T voltage regulator. Next I connected each of the six red-yellow sets to one solid wire lead to be plugged into the breadboard.
Step 3: Breadboard Build the Circuit
Here is the diagram for the main parts of the circuit. The MP3 player is plugged into the input jack to feed the music into the Arduino. The code reads the voltage on pin A5 and based on the frequency derived from that will toggle pins 7 – 12 to turn the lights on and off.
LM317 – Voltage Regulator Section
This section is used to provide power for both the Arduino and the light strings.
The main power input is a 12v 3a power supply I had around the house. The 12v feeds the Arduino and the LM317 is used to generate the voltage (4v) required by the light strings.
Researching the LM317 will give you a pretty good idea of how to use it. But basically based on the values of the two resistors you can adjust the output voltage of the regulator circuit. In this case I used - 680 & 1.5k Ohm resistors to have the circuit output 4v. This is a good voltage to use to drive the LED lights that I used.
Audio Input Section
This section of the circuit is made up of two separate parts.
First is the section of the circuit (Stereo-Mono Converter) is used to take the stereo output from the MP3 player and turn it in to a mono input.
The next section is a voltage divider to get the signal down to a level to be ready by the analog input pin (A5) on the Arduino Micro.
I have pulled a number of Christmas songs from my music collection to play on the MP3 player. Instrumentals seem to work best since they usually have a broader range of frequencies vs vocals that may have a bit narrower range of tones. My player is not a real smart device and will basically just play the songs sequentially. But this works fine for me.
This section is used to turn the lights off and on using N-channel MOSFETs. I chose the ZVN4306A since it has an max continuous drain current rating of 1.1 amps – more than enough to handle the load of switching the LED light strings.
Attached is a picture of the working version of my board.
From my MP3 player, I attached a Y-connector to allow me to hear the music over a small powered speaker and the other side of the Y-connector is used to I feed the connector attached to my breadboard.
Step 4: Code
The code I am using came from the Instructable by thone and also from an Instructable by Amanda Ghassaei titled Arduino Frequency Detection.
I modified it slightly based on using only 6-channels vs 8-channels in thone's project. I also had to modify the code since the Arduino Micro has a different port organization than the original code written by Amanda Ghassaei.
I also had to tweak the frequency ranges used to trigger each pin since I am using fewer channels. I have found however, that the ranges I have set may not be the best and am currently working on modifying my code to see how it works.
Step 5: Bring It All Together
Right now I just have the prototype breadboard setup and all is working as I planned.
I don't have the lights setup on my Christmas tree just yet, but I wanted to get this published before Christmas.
Step 6: Next Steps
Right now the breadboard setup I have is working fine but could use a bit more work.
Next thing I have planned is to build an enclosure to allow me to better protect the setup.
I am also looking at building a connector for the cable bundle from the light strings. So maybe an external jack on the enclosure to connect the lights and power.
I am looking at building the circuit on a more permanent perf board to make it more stable and more permanent that I can use year to year.
I also want to look at the frequency break outs I am using to trigger the light strings.
Any questions please let me know.