Automatic Synchronized Musical (Christmas) Lights Version 2 Ft PCB, Arduino and MSGEQ7
by justbarran in Living > Christmas
4950 Views, 56 Favorites, 0 Comments
Automatic Synchronized Musical (Christmas) Lights Version 2 Ft PCB, Arduino and MSGEQ7
Last year I did my first version of my Automatic musical (Christmas) Lights which worked super great but It came with some drawbacks.
2020 Project: https://www.instructables.com/DIY-Automatic-Musica...
v1.0 Problems:
- broken audio jack after a year.
- Loud Mechnical Relays, these were also slow.
- Boring design.
-
Control only three (3) light banks, Lows, Mids and Highs
So this year I wanted to fix that with
- Printed circuit board - Christmas Style
- Solid State Relays
- Control seven light banks based on the msgeq7
- Easily control the level at which the lights are triggered
2021 Project Demo and Guide
Supplies
1x MSGEQ7 IC: https://www.sparkfun.com/products/10468
2x Audio Jack(PJ-307): https://www.sparkfun.com/products/8032
1x DC Barrel Power Jack (PJ-202A): https://www.sparkfun.com/products/119
1x PRO Mini: https://amzn.to/3hefxJD (FTDI programmer https://amzn.to/3qe2xZu)
1x 12v or 9v PowerSupply https://amzn.to/3EbBSBy ( you mostly have one of these around)
1x Resistors: https://amzn.to/3FcIFfR
2x 22K ohm
1x 200k ohm (I only had 220K so I used that)
1x 0ohm (basically a wire, this is for something else I want to test in the future)
1x Capacitors: https://amzn.to/2Zzhgoo
2x 0.1uF
1X 0.01uF
1X 33pF
1 x 10K Trim-Pot: https://www.sparkfun.com/products/9806
1 x Mini MP1584EN DC-DC Buck Converter: https://amzn.to/3Ebco7t
1x 8x8 LED Display Modules https://amzn.to/3EaW1YG
2 x Solid State Relay: https://amzn.to/3Fc84Gd
1x M2 Standoffs: https://amzn.to/3Ff4hYL
1x Male Header Pin https://amzn.to/3qdKF0K (4 for DC-DC converter, 5 for 8x8 matrix, 12 optional for relay header but you would need females for the relay wire
or
2x JST Connectors 6 pin male and female https://amzn.to/3e5FACj
(should get a crimp tool also if you don't have one https://amzn.to/3yFJmeW and decide to go with this)
AC voltage control Side - Warning seek help for an electrician when dealing with AC voltage
2x 4"x4" PVC electrical box
2x 4"x4" PVC electrical Socket holder
4x dual plug female sockets
2x male plug end
2x 4"x4" socket cover
2x 2 feet of electrical 3 core cable 10A
(Optional) PCB order: https://www.pcbway.com/project/shareproject/Automa...
(Optional) Bluetooth Receiver https://amzn.to/3yH46mu
(Optional) Speaker with AUX input
A lot of Extension cords
A lot of Christmas Lights
Tools:
Solder Iron
Repair Kit
Pliers and Cutters
Desoldering tool
Solder
PCB holder
glue gun
This post contains affiliate links, which help support my channel.
If you purchase through one of my links, I may earn a small commission; at no extra cost to you.
Circuit Diagram
So the main component of this project would be the MSGeq7. This is a seven-band graphic equalizer CMOS chip that divides the audio spectrum into seven bands, 63Hz, 160Hz, 400Hz, 1kHz, 2.5kHz, 6.25kHz and 16kHz. The seven frequencies are peak detected and multiplexed to the output to provide a DC representation of the amplitude of each band. No external components are needed to select the filter responses. Only off-chip resistors and capacitors are needed to select the on-chip clock oscillator frequency. The filter centre frequencies track this frequency.
Datasheets: https://www.sparkfun.com/datasheets/Components/Ge... So all in all a really easy to use IC.
This year, I rearranged the GPIO so that we can control 7 relays. I added a potentiometer so that I can adjust the level at which the lights are triggered without having to edit the code.
For the PCB design, I am using KiCad. I wanted it to look like a Christmas present after much deliberation. I also went a bit overboard with the silkscreen as I was so excited to put the Justbarran logo on a PCB for the first time.
Order the PCB from: https://www.pcbway.com/project/shareproject/Automa...
Or Get
Gerbers: https://github.com/justbarran/Automatic-Musical-L...
The Board can also be used to control programmable LED strips like the WS2812B.
the PCB is not required, this project can be done on a breadboard or a protoboard.
To order the board I used PCBway but you can use your own preference
Assemble PCB / Circuit
Before adding anything to the PCB two things needs to be done first.
1. Using a power supply or battery and multimeter. Set the DC to DC converter MP1584EN, to 5v. Use the glue gun to drop a bit of glue on the potentiometer.
2. Remove pins from the 8x8 LED matrix and replace them with straight pins going down. This can be done with a desoldering tool and pliers. You can glue gun the matrix to the board and use wires and solder the hole to the pins also if desoldering is not your thing.
Once this is done, it's a puzzle game. Use the schematic annotation to know what goes were.
For the Trim-Pot I added a bit of glue gun to the underside to stick it down before soldering.
For the relay pins, you can use straight male 2.54 headers or right-angle headers but I went with JST headers so that the connector would be polarized.
Happy Soldering.
After this, you can use M2 standoffs to keep the board off the ground. This also helps it to stand upright. I used hot glue to stick it on a metal base.
Code
If you don't know anything about Arduino, you can check out my getting started guide:
https://youtube.com/playlist?list=PL1vbJjS91-vTXzd...
Project Code- Musical_Lights_Controller_V2 (Arduino) : https://github.com/justbarran/Automatic-Musical-Li...
A few changes to the code based on the new schematic. More GPIOs are allocated to the 7 relays and A1 is connected to the Trim-Pot.
The code works by first checking the set level on the Pot. It then updates the 8th column on the LED matrix so you can visually see the set point at which the lights would come on once the frequency amplitude hits that level.
Then it runs a loop, polling the MSGEQ7 for the bands and then updating the display and the state of the lights.
This code allows no need to update the code depending on if music is extra-loud and the trigger level is too low and vice versa.
You can update in code the minimum time the lights need to stay on for. This is important for mechanical relays as they can be slow and can not be switched as fast as solid-state relays.
Lastly when uploading you need an FTDI adaptor for the Arduino pro mini. When selecting board, it is a Arduino nano and you need to select "Old Bootloader" under processors
Relays
*I recommend you seek help from a licensed electrician for this part*,
Electrical codes vary from place to place and AC voltages can be very dangerous, more so when they are wired incorrectly.
I live in Trinidad and Tobago, where we use US plugs. When using the dual plugs, you would need to break off the piece of metal joining both hot sides to split up the plugs. This would allow each one to be independent powered. The neutral and earth can be connected as normal. (see diagram)
The 4"x4" box can hold 4 plugs, so we are doing 4 relays in box one, and 3 relays in box two, with the last plug being always on to support the power supply for the Arduino.
I am using 2 CAT5 cables to connect the relays to the Arduino.
Warning: each solid-state relay can only handle 2A, so if your country uses 110V like mines then no more than 200W should be connected per plug. And depending on the breaker the plugs are connected to also try to mainly lower than the current rating of your electrical system. I also recommend using LED Christmas lights to bring the overall power of the system down.
If you are like me also, you are going to need a lot of extension cords.
Done
Next year I am thinking of maybe adding WiFi, and google/Alex support. Maybe do some 3D printed stuff too.
All in All, a really fun project and the light show looks awesome with Christmas music and EDM. I did not put any music in my youtube video because last year I got a copyright strike for the music so this year I am playing it safe.
Let me know what you think, I am definitely open to constructive criticism and future ideas/updates.