Introduction: Music Reactive Mood Lights
Intro and Background.
Back in freshman year (Spring of 2019), I wanted to spruce up my dorm room. I came up with the idea of building my own mood lights which would react to the music I listened to on my headphones. Frankly, I had no particular inspiration, I just thought they looked cool. In the heat of finals season, I cobbled together an LED strip controller that could react to audio. It worked, but it was just a breadboard setup, far from anything complete or permanent. Time passed, homework piled up, and that project sank deeper and deeper into my box of unfinished things.
Then the quarantine struck.
I gained enough time to pursue the things I like and the energy to complete projects of days past. Thus, that lonely breadboard was rescued from the bottom of my pile and this project was finally (well, mostly) completed.
This is not a full fledged product, evident by the cardboard and shoddy programming, but a fun little decoration nonetheless.
(This Instructable is not as detailed, mostly due to how long ago this device was made.)
Basic circuit knowledge and experience programming Arduino.
Note to Maker (You):
The mood lights that you will make will almost certainly not match what I have. Treat this Instructable more as a suggestion and put your own spin on it!
- Teensy++ 2.0 (or whatever Arduino you have)
- Various resistors
- Various switches
- Various capacitors
- 3.5 mm jack (male or female)
- Potentiometers (or Encoders)
- Audio Amplifier IC
- Addressable LED strips
- Headphone Splitter
These are Amazon affiliate links so I earn a little commission with each sale. If you don't already have these supplies and want to support future projects of mine, follow these links! :)
Step 1: Plan Out and Breadboard
The first step for any good project is to set up your requirements. This step is fairly open ended. It's up to you to make it as simple or complex as you want.
- Control an addressable LED strip for mood lighting
- Have an Audio reactive mode
- Have a Static RGB mode - when I just want to see still lighting
- Have a selector switch for swapping between modes
- Have potentiometers for controlling RGB mode
- Have a screw terminal to attach a 5V supply to
Once you've defined your requirements, the next thing to do is to determine what components you need and breadboard them out. Take my system diagram above as a guide! Testing is a critical step to work out bugs, to ensure the components work together, and to avoid time consuming mistakes.
Why a voltage divider for the audio input?
You might have noticed that there is a voltage divider on the audio signal input line. This is to account for one of the limitations of the ADCs of Arduinos: The ADC can only read voltages between 0 - 5V. Since an audio signal is AC, it will have parts where it goes negative. We obviously don't want this negative voltage reaching the input pin, therefore we offset the signal with the voltage divider and keep it centered at 2.5V.
Why an amplifier?
I discovered that, when I used headphones or speakers with my breadboard setup, the signal was too weak to be processed by the Arduino. Adding an amplifier solved that issue. As you can see, testing beforehand is important!
Step 2: Program
This code provided is what I used in my mood lights. You will definitely not use this code without tweaking it, due to differing hardware and board layouts. Take it more as an example to see how the libraries are utilized.
Fastled.h (For addressable LED control)
fix_fft.h (For an even faster fourier transform. This was necessary since other fourier transform libraries were too slow. The speed problem could possibly be circumvented with a faster microcontroller like an ESP32.)
Step 3: Perfboard It
If you got the knowledge, I highly recommend designing a PCB instead of a perfboard. It's a far less tedious soldering process. I can't detail every solder joint I made, but here are a few key tips:
Lay out your components on your perfboard to pre-fit them. This will save you a lot of headaches.
Put a bypass capacitor on your power rail to mitigate the effects of spikes in power draw.
Take advantage of the extra lead length offered by the through-hole capacitors and resistors. Use them to connect other points on your board.
Use female PWM connectors and male header pins for easy removal/attachment of components.
Use solid core wire when you can. It's easier to put into through-holes.
Step 4: Build Enclosure
It's time to build the enclosure for your new perfboard/PCB. I used cut cardboard because it was the best thing I had on hand. If you have a 3D printer or some other method, that's also good!
Use calipers to measure out the dimensions of your board, especially if you're cadding a case.
If using cardboard
Always leave a little bit of leeway when cutting. You can always cut more, but you can never reattach.
Use a small knife or exacto knife. A small blade is key for making precise, well-fitting holes.
Step 5: Enjoy
Have fun with your new mood lights!
Things to expand on:
Making a proper case?
More patterns or modes?
A faster microcontroller?
Participated in the
Finish It Already Speed Challenge