Skip to content

cdeluca3/SparkFun-RGB-LED-Music-Sound-Visualizer-Arduino-Code

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 

Repository files navigation

SparkFun RGB LED Music & Sound Visualizer

This repository holds the Arduino program featured in the SparkFun tutorial on creating a music visualizer with a strip of addressable RGB LEDs.

Required Materials

The wish list for all these parts can be found here.

The resistor and capacitor are not required, but they will help prevent possible damage to the LEDs.

Hookup

This project requires virtually no soldering! The few exceptions will probably be soldering some pins to the sound detector, and if you've cut a roll of addressable LEDs in the middle you'll have to solder some wires to the starting LED's pins. If you've never soldered before, I highly suggest taking a look at this guide.

Below is also a general chart for how the pin(s) on each component should be routed, and an accompanying diagram. But before you begin, here are some things to keep in mind:

  • Be conscious of the orientation you think would allow the sound detector to take optimal readings for your intentions. Bending the pins to hold the sound detector perpendicular to the breadboard is a recommendable option.
  • Electrolytic capacitors are polarity-sensitive, so how they are oriented is important. Make sure to place the side with a white stripe and a negative symbol into a negative current (ground) and the other into positive current.
  • Resistors aren't polar, but it's good practice to be consistent with their orientation relative to the current.
  • Trimpots are not polar either, however their middle pin is the analog output so don't power that directly.
  • Pushbuttons are not polarity-sensitive and also do not need to be powered directly, just a ground connection will suffice.

The pins used in the diagram and the code are in parentheses. If you use a different pin, don't forget to change it in the code as well:

Sound DetectorAddressable LED stripTrimpotPushbutton1 mF (1000 µF) Capacitor300–500 Ω Resistor
Envelope → Analog (A0)Digital/Analog (A5) → Resistor → DIN5V → left or right pinGND → Either sideBetween ground and 5VBetween Digital/Analog (A5) and DIN on LED strip
3.3V → VCC5V → 5VMiddle pin → Analog (A1)Other side → Digital (4, 5, 6)
GND → GNDGND → GNDRemaining left or right pin → GND

Sound Detector Notes: The microphone used is not a sophisticated, logarithmic sound receiver like your ear; it is only measuring compressional waves in the air. Consequently, the microphone is more likely to detect and/or prioritize lower-frequency sounds since they require more energy to propagate, and therefore oscillate the air more intensely. Also, a resistor can be placed in the "GAIN" slots to modify the gain. Standard gain should be sufficient for our purposes, but for more info check here.

**Diagram of a possible circuit:** ![diagram](http://i.imgur.com/Po12eSI.png)

Compiling

Things to remember before you compile:

  • If you didn't use a potentiometer, don't forget to remove all references to the variable knob in the code (ctrl+F will come in handy for that). Otherwise, the program will think you still have a potentiometer that is set to a very low value (i.e. everything will be very dim).
  • If you didn't use buttons, change the initialization bool shuffle = false; to bool shuffle = true;. The code should compile and run properly, but for good practice you should remove all blocks the code says to delete since they reference the BUTTON constants.

About

SparkFun Music Visualizer Tutorial

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 100.0%