Introduction: Arduino Based Light Show
I've build an Arduino controlled light show as my entry for the into the Makers Rock, Album Art Collab. You can learn more for it on the following link: Makers Rock. The cover I choose is from Judas Priest - Painkiller album.
The entire piece is a light show that is enclosed in a wooden frame and the album artwork is put on top so the light shines through.
Tools and materials used in the video:
- Arduino Uno - https://s.click.aliexpress.com/e/_9hf7lv
- 2n2222 Transistors - https://s.click.aliexpress.com/e/_AWf2z9
- Assorted resistors - https://s.click.aliexpress.com/e/_AteDUB
- Assorted Capacitors - https://s.click.aliexpress.com/e/_A2FA7v
- LED Strip - https://s.click.aliexpress.com/e/_A0buT1
- Prototype PCBs - https://s.click.aliexpress.com/e/_AVbT4B
- Electret Condenser Microphone - https://s.click.aliexpress.com/e/_AXljzD
- Soldering Station - https://s.click.aliexpress.com/e/_97iasF
- Palm sander - https://s.click.aliexpress.com/e/_AN0Ddv
- Jigsaw - https://s.click.aliexpress.com/e/_Ao0z9v
- Hot glue gun - https://s.click.aliexpress.com/e/_AZpst9
Step 1: Prepare the Wooden Frame
You can build the frame or the enclosure in any way you would like. I choose wood as it is easy to work with using only basic tools.
I’ve build the frame out of some pallet boards that I’ve salvaged. I marked 4 pieces of the clean parts of the boards that measured 30 centimeters in length, making sure to mark 45 degrees miters for the joints.
I did all of the cutting using my jig saw and it worked OK. If you have access to a mitre saw or a table saw than you can use those and get much better results. The joins were not perfect but with my belt sander I was able to get the pieces to fit nicely.
During the test fit I realized that they are too wide and that they will take a lot of space in the inside of the enclosure so I decided to cut them to 2 cm in width. Again I used my jig saw making sure not to cut inside the line.
The miter joins did not had a lot of support on their own so I’ve cut small triangle pieces to glue in the corners as some extra support. I’m sure that there are a ton of better options to do here but this was the best idea I had at the moment.
I joined the miters with wood glue in the middle of the joins and CA glue at the ends in order to act as a clamp and hold it in place while the wood glue cures. The little support triangles were glued into place using only CA glue in order to make the process faster.
Step 2: Prototype the Circuit
The electronics for the light show inside, consist of an Arduino Uno board with a microphone from a broken headset that listen for the sounds in the room and then it reflects the total sound volume by lighting one of the 5 pieces of led strip inside.
The circuit is made out of two independent parts. The first part is the microphone with its single transistor amplifier while the second part are the drivers for the LED strips. We need them since the Arduino and the microphone amplifier work on 5V while the LED strip runs on 12V.
The microphone is connected to the 5V output on the Arduino through a 10k resistor and through a capacitor to the base of the transistor. The transistor then amplifies the signal with a mid level of 2.5V so we can pick it up on the analog input A0 on the Arduino.
In order to turn on the 12V for the LEDs, the base of the transistors is connected to a digital output through a 10k resistor and the same circuit is repeated 5 times. I’m turning on just 3 LEDs in each of the sections so I’m able to get away using the transistors. If you would like to modify the project to use longer strips than you will need to use some MOSFETs.
Although it might seem as a complicated circuit it is really a very simple one. I’ve tested it all on a breadboard and after I made sure it works as expected, I’ve build a shield to be mounted directly on the Arduino Uno.
Schematic is available at:
Step 3: Build the Arduino Shield
Once I was happy with the circuit, I've build a shield for the Arduino on a perfboard. You can see the full build process in the attached video for the project.
Step 4: Program the Arduino
The main star of the project is the code that is programmed onto the Arduino. This is what does the heavy lifting of analyzing the sound levels from the microphone and turning them into visible light that follows the music. You can download the entire code from my GitHub page and you can find the link to it in the video description along with the schematic for the electronics.
In a nutshell the code has 3 main parts: retrieving a sample of music to analyze, determining the sound levels and then controlling the output to the LEDs based on the calculated value. I know that this might sound like rocket science to some but it’s really easy once you get hold of things.
The sketch at the beginning defines all of the variables and constants that we gonna use. I made sure to provide an explanation to each of them so you can understand it more easily. After that we have the setup function that starts the serial communication for debugging purposes, empties out and initializes the array we gonna use for the peak to peak volume detection and defines the outputs for the LEDs.
In the loop section of the code, we first start the sampling of the audio so we can detect it’s peak to peak volume. In a regular sound wave, the absence of any noise is a level at the midpoint of the minimum and maximum voltage the amplifier can produce. In our case that is 2.5V.
Once a sound is detected, we get a wave that moves up and down so to detect high noises, we are interested in the combined amplitude in that wave. So instead of a moving wave, we map the values from 0 to max in a sort of inverted state to easily distinguish high from low volume sounds.
The next two sections of the code do exactly that, first of we measure the peak to peak amplitude and we determine the maximum of that peak for the period. The way the microphone works, the further you are from it, the less volume it can pick so we need to calculate a factor that will either amplify or decrease the measured signal and have the same reaction on the different levels.
As a final step we multiply the measured value from the microphone with the factor that we just calculated and based on the result we turn on specific LEDs.
After the board was all soldered as per the schematic, I made sure to test it before proceeding on preparing the actual album art.
Code on GitHub:
Step 5: Prepare the Front Cover
For the front of the piece I’ve use a sheet of clear acrylic. I’ve cut the printed artwork to dimensions and applied a layer of transparent wood glue to the surface without the protective cover on the acrylic. If you have access to Mod Podge or to some clear acrylic gel medium than it is better to use that instead of wood glue, but it works almost the same.
The trick while applying the image is not to use too much glue as I did in order not to get wrinkles on the paper. Less is better in this case but the surface must be fully covered. With the glue still wet, the artwork is barely visible but after it fully dries it will turn transparent.
I left the frame to cure for 24 hours and then I figured out the placement of the Arduino inside the frame. I want the art piece to be hang on a wall and since it needs to be plugged in for power, I’ve mounted the board on the bottom side so the power adapter wire will come up from the wall socket.
I used a hacksaw to remove most of the material and then worked my way through with a chisel and a file. If you have a hand router, than that will be a lot faster than the chisel. I also drilled a hole through the frame so the microphone can stick out and pick up the sounds from the room.
Before finishing, I’ve sanded the frame up to 240 grit sandpaper and then applied a coat of wood stain lacquer. I used a piece of cloth to wipe the stain on and then wipe it off after some time.
Step 6: Assemble the Light Show
The thickness of the frame was not enough to hold all of the electronics in place so I’ve cut and glued two layers of 5mm black XPS foam insulation to both sides of the frame. Aside from making room for all of the electronics, the foam gave the piece a nice layered look from the sides.
All of the electronics components are mounted inside the frame using hot glue, starting from the microphone and then the main Arduino board.
On the back I’ve marked and cut a sheet of 3mm high density fiberboard that will act as a backer board and a reflector since one of the sides is white. I’ve used small 3.5 by 16mm screws to attach it from the back. I then removed the backing from the glue on the LED strips and stick them on to the fiberboard.
The acrylic front is also attached with the same 16mm screws but I countersink the screw holes with a 6mm drill bit in order for them to sit flush with the front. If you have a router, than you can make a groove in the frame and enclose the acrylic that way.
At the end it was just a matter of removing the other protective layer from the acrylic sheet and testing it all out to make sure that it was still functional. To hang it on the wall, I’ve added a piece of string between two of the screes on the back.
Step 7: Enjoy Your Arduino Light Show
All in all I’m super pleased on how this turned out. The enclosure could have been a bit better if I had the proper woodworking tools but it still is a nice wall decor. Since I build it, we had a ton of fun with it with my kids but it is time for it to find a new home.
I will be giving away the piece I've built so please check out the video on YouTube to learn how you can win it.
If you liked the project, than please consider supporting my work on Patreon!
Schematic is available at:
Code on GitHub: