Introduction: DIY Automatic Musical Christmas Lights (MSGEQ7 + Arduino)

About: Just about anything you can do yourself.

So every year I say am going to do this and never get around to doing it because I procrastinate a lot. 2020 is a year of change so I say this is the year to do it. So hope you like and make your own musical Christmas lights. This is going to be a simple guide but next year I plan to do a lot more with this project.

Full project video:

Supplies

Bluetooth Receiver https://amzn.to/34UlsPt

Arduino Nano https://amzn.to/3piiJHb or

PRO Mini https://amzn.to/3hefxJD

(going to need https://amzn.to/2WGa19q to program it)

MSGEQ7 IC https://www.sparkfun.com/products/10468

MSGEQ7 Module https://amzn.to/3pcxJGk

MSGEQ7 Shield https://amzn.to/2JeDMep

Resistors https://amzn.to/37G0Cou

Capacitors https://amzn.to/2Zzhgoo

Relays - Mechanical https://amzn.to/3pm2WXF or

Solid State https://amzn.to/2KOVqFU X3

Solid State 4 channel https://amzn.to/38rqqnA

8x8 LED display https://amzn.to/2JepwSN

Solder-able Breadboard https://amzn.to/3azjMhF

Hook Up Wire Kit https://amzn.to/37G2Zry

JST Adapters https://amzn.to/3peqH47

3.5mm Stereo Jack Socket https://amzn.to/38AcCr8

Power Supply Module https://amzn.to/3haMN4C

9V 1A Power Supply https://amzn.to/3puMC7p

AC Plug, AC sockets and electrical box from any local hardware

Tools used (not bought for this video just general stuff I have):

Solder Iron: https://amzn.to/2VWtUsf

Repair Mat: https://amzn.to/37IwpUw

Lead-Free Solder Wire: https://amzn.to/3oHIcJB

Magnetic Helping Hands: https://amzn.to/2W5q3ZX

Multimeter: https://amzn.to/3oQrgB5 (my next buy)

Circuit Board Holder https://amzn.to/3mJY3WW

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

Step 1: How This Works - MSGEQ7

So the main component of this project would be the MSGeq7. This is a seven-band graphic equalizer IC is a 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 an off-chip resistor and capacitor are needed to select the on-chip clock oscillator frequency. The filter centre frequencies track this frequency.

Datasheets: https://www.sparkfun.com/datasheets/Components/Gen...

So all in all a really easy to use IC.

Step 2: Test Circuit

The datasheet for msgeq7 provides the typical application circuit diagram which I followed and used to design the circuit for this project.

Take note of the values of the specific resistors and capacitors. I have 2 x 3.5mm stereo audio jacks to allow for a Bluetooth module to input audio to be sensed by the msgeq7. You would need two 22k resistors and a capacitor to isolate the MSG and allow the other jack is to output to a speaker via an AUX cable.

Also, I replaced the LEDs later with relays (they are basically the same thing in the realm of this project) to then control some Christmas lights.

The LEDs represent the audio "lows" "mids" "Highs". The plan is to sense the frequency amplitudes and determining a trigger point which will then turn on the light.

I also added an 8x8 led matrix to give a nice audio visualization of the audio frequency as they are being played.

The code can work with any Arduino board but I am using nano for testing and Pro Mini in the finial board.

Step 3: Code

So the code again is pretty simple.

Full code: https://github.com/justbarran/Automatic-Musical-Li...

The code needs the LedControl library https://www.arduino.cc/reference/en/libraries/ledc... for the 8x8 display MAX7219. Other than that no other extra library is needed and the code is stand alone.

In the loop, I check the different bands from the MSG and scaling the values between 0 and 7 to be displayed on the 8x8 matrix. I then store the values into an array to be quickly processed right after.

These amplitude values are then checked to see if they cross a set value. If they do I put on the light.

band 0,1,2 = LOWs (63Hz to 400Hz)

band 3 = MIDs (400Hz to 2500Hz)

Band 4,5,6 = HIGHs (2.5KHz to 16KHz

This was more of a personal choice based on observations which gave the best lighting effect in my opinion. This can be tweaked and changed to suit any type of music or light show.

Since I ended up using mechanical relays cause that is all I had at the moment I added a flag system to allow the replays to stay on for a minimum amount of time as to not cause over switching/fast oscillations that may damage the relays and affect the musical lighting.

Once the time is passed and the amplitude isn't triggered again the led would come off and the process continues.

I am using millis(), not delays for this to not have the code blocking with delays. So the code runs really fast and efficient.

Step 4: Adding Relays

WARNING: Please be careful when dealing with AC voltages. Please get help from a professional/Electrician if you are unsure. Note I am a licensed wireman.

For this project, I am using mechanical relays cause the Solid-state relays I had are only for DC voltages/

Sigh.

I recommend you get a set of SSRs if you don't already have mechanical relays and plan to do this project.

They are faster and more importantly quieter. Note SSR have lower current levels than mechanical relays to take note of how much lights you want to put on one plug and gauge the current draw.

Step 5: The Board That Does It All.

After getting everything to work how I wanted I placed everything on a solderable breadboard.

Its the same circuit diagram as before just this time I used an old laptop audio jack for the audio in and out.

I have an Arduino pro mini and a breadboard power supply so the board can be powered from a 12v dc jack/

The 8x8 display is attached to one of the screws holes.

The relay has as 6 pin JST connector that would supply Gnd, 5v, and 4 GPIOs to control the 4 relays. For this project, I am only using 3 of these relays while the 4 plug is normal close and would be used as a hard reset for the future and to power the board.

Step 6: Done + Future

Full project video:

You can Like share and subscribe.

Next year I want to add wifi and an RTC to allow remote and time control. Also, an FM transmitter so cars would be able to tune into the audio. Most importantly I would switch the relays out for SSRs. I could also switch the MSGEQ7 for a DSP and do a proper analysis of the audio for better lighting effects.

Hope everyone has a Great Christmas and a Happy new year.

Anything Goes Contest

Participated in the
Anything Goes Contest