Introduction: Bass Responsive RGB Leds Using Arduino
This tutoiral will show you how to use Arduino and to control a set of leds using music played from your computer. This tutorial requires:
-Arduino (I used a leonardo)
-small breadboard w/ jumper wires (kit is the best deal)
-rgb led strip (I used these)
- 12v 6A power supply for the lights (something like this will be fine)
-3 N-Channel mosfets (here)
-A computer with processing 2.2.1 installed with the proper libraries
-and Arduino IDE
Step 1: The Circuit
For this project to work, we will be using the PWM(Pulse Width Modulation) pins on the Arduino. These allow the signal being sent from these pins to change rapidly, which are detected by the mosfets, either completing or opening the circuit to the lights. Here, each strand is connected to it's own mosfet and PWM pin on the Arduino to allow for each strand to be controlled in dependently. Although the pictures are somewhat sloppy, you can use them as a guide of how you can fit the circuit on the breadboard.
Be sure the proper lead from the arduino are connected to the proper pins on the mosfet. The orientation should be the same as in the diagrams, so use the pictures are guides. Also ensure the 1K and 10K resistors are in the correct locations, as this will make the lights too dim.
Step 2: Installing Processing With the Necessary Libraries
When I wrote the program, I was using processing 2.2.1. You could try to use the newest version, but there are very good odds the libraries will have changed and the functions used in this code will no longer be applicable. If you know what you're doing, you can try to get them working. But you will need to install these libraries (check my file paths above ignoring, all besides the 3 below):
Download the processing .pde file and open it. Once the program is run, assuming the libraries are installed correctly, it will load the gui and start listening from your default audio device (probably a mic).
You will also need the Arduino IDE installed in order to load firmdata, code loaded onto the Arduino so it can talk to processing. I used 1.0.1, but you should be fine using a newer version.
The last setup step on the computer is to enable stereo mix. This is basically what your sound card is producing, so it will be a nice clean audio signal for processing to read.
Please try the following steps to enable the stereo mix and check if that help.
a) Right click on the audio icon in your system tray and select “Recording Devices” to open the Recording device settings in the “Sound” window.
b) In the pane, right-click on a blank area, and make sure both “View Disabled Devices” and “View Disconnected Devices” options are checked. You should be able to see the “Stereo Mix” option appearing. c) Right-click on “Stereo Mix” and click “Enable” to be able to use it. This should enable the “Stereo Mix” on Windows 8.
If this doesn't work, then you will need to install audio drivers that have stereo mix enabled. I used these, but it may vary depending on your OS.
Step 3: Getting Everything Going
-Plug you arduino into your computer
-Load AnalogFirmata to the Arduino (ensure you select the correct COM port and device from the settings)
-Ensure the wiring between the arduino and breadboard is correct, stereo mix is enabled and the default audio device, and all connection are secure.
-When you play music you should see the light respond to bass signals and the EQ visualized in the gui. You can mess around with values on the gui to your liking.
That's it. I made a 3d printed enclosure for my setup so it's nice and safe under my desk.