# Raspberry Pi LED Spectrum Analyzer

## Introduction and Ingredients

http://www.youtube.com/watch?v=AMPJH1LOu50

A Spectrum Analyzer shows the loudness of different frequency bands (low, mid, high) in real-time, letting you visualize music. Using a RasPi, RGB LED Strip and some wire, make yourself a dynamic display and media player. This project is based on some great python xmas light code from the [LightShowPi project,](https://plus.google.com/communities/101789596301454731630) and advanced users can even configure it for song voting via SMS!  
  
The project runs in Python, even including the audio processing. It's just able to play and analyze mp3s in realtime as long as your Pi isn't doing anything else.

![](https://cdn-learn.adafruit.com/assets/assets/000/013/626/medium800/raspberry_pi_spectrum_analyzer_display_raspi_rgb_led_strip.jpg?1389556742)

 **Hardware**

- RasPi -- this guide is built on one running wheezy, Raspbian, ver 3.10.19
- [5m RGB LED strip](http://www.adafruit.com/products/306), (~160 leds) controllable via SPI, built in PWM control. This guides shows using one strip wrapped around to form 5 columns, and writing to different segments of the strip. Only three wires connected to the Pi: ground, SPI Clock and SPI Data.
- [10A 5V power supply to drive the LEDs](http://www.adafruit.com/product/658)
- Miscellaneous:
  - [USB WiFi adapter](http://www.adafruit.com/products/814) (RTL8188CUS chipset drivers are built in to wheezy OS!) if you don't want to use Ethernet. I used these [instructions](http://learn.adafruit.com/adafruits-raspberry-pi-lesson-3-network-setup) to get it working.
  - [SD card 4GB or larger](http://www.adafruit.com/products/102)
  - [USB Power speakers](http://www.adafruit.com/product/1363)
  - Powered USB Hub to plug in keyboard, mouse, wifi,
  - Some cell phone charger to power the Pi via it's USB power connector
  - USB keyboard, mouse, HDMI monitor
  - wire, some female to female jumpers or some [JST connectors](http://www.adafruit.com/products/578) if you don't want to solder to the RGB strip.

**Software** :

- This project is mostly based on the [Pi-based xmas lights controller code](https://plus.google.com/communities/101789596301454731630) from Chris Usey,Todd Giles and Ryan Jennings. It's a full command center for orchestrating xmas lights to audio (wav, mp3, etc). Their code and hardware lets you setup playlists and turn on and off 120VAC power based on frequency bands. You can even vote on songs through SMS messages! We're going to control an RGB strip instead of output pins on the Pi. Grab the attached [synchronized\_lights\_LED\_strip.py](http://www.instructables.com/files/orig/F8J/J4J8/HQCWG0FE/F8JJ4J8HQCWG0FE.py) file.
- [Python control of LPD8806 RGB LED strip](https://github.com/adammhaile/RPi-LPD8806) via SPI.
- This isn't specific to this project, but I used the [Geany](http://www.geany.org/) IDE for coding right on the Pi.

If you have any questions, check out the [LightShowPi github repo](https://github.com/shatteredsword/lightshowpi)

- [Next Page](https://learn.adafruit.com/raspberry-pi-spectrum-analyzer-display-on-rgb-led-strip/led-strip-and-rgb-led-software.md)

## Featured Products

### Digital RGB LED Weatherproof Strip - LPD8806 32 LED 5m

[Digital RGB LED Weatherproof Strip - LPD8806 32 LED 5m](https://www.adafruit.com/product/306)
These LED strips are fun and glowy. There are 32 RGB LEDs per meter, and you can control each LED individually! Yes, that's right, this is the digitally-addressable type of LED strip. You can set the color of each LED's red, green and blue component with 7-bit PWM precision (so 21-bit...

In Stock
[Buy Now](https://www.adafruit.com/product/306)
[Related Guides to the Product](https://learn.adafruit.com/products/306/guides)
### Raspberry Pi Model B 512MB RAM

[Raspberry Pi Model B 512MB RAM](https://www.adafruit.com/product/998)
Adafruit ships the **Raspberry Pi Model B 512MB RAM** as of 10/18/2012.  
  
The Raspberry Pi® is a single-board computer developed in the UK by the Raspberry Pi Foundation with the intention of stimulating the teaching of basic computer science in schools. The Raspberry...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/998)
[Related Guides to the Product](https://learn.adafruit.com/products/998/guides)
### 5V 10A switching power supply

[5V 10A switching power supply](https://www.adafruit.com/product/658)
This is a beefy switching supply, for when you need a lot of power! It can supply 5V DC up to 10 Amps, running from 110V or 220V power (the plug it comes with is for US/Canada/Japan but you can use any plug adapter for your country, or just replace the cable with a standard computer/appliance...

In Stock
[Buy Now](https://www.adafruit.com/product/658)
[Related Guides to the Product](https://learn.adafruit.com/products/658/guides)
### 5V 4A (4000mA) switching power supply - UL Listed

[5V 4A (4000mA) switching power supply - UL Listed](https://www.adafruit.com/product/1466)
Need a lot of 5V power? This switching supply gives a clean regulated 5V output at up to **4 Amps** (4000mA). 110 or 240 input, so it works in any country. The plugs are "US 2-prong" style so you may need a plug adapter, but you can pick one up at any hardware store for $1 or so,...

In Stock
[Buy Now](https://www.adafruit.com/product/1466)
[Related Guides to the Product](https://learn.adafruit.com/products/1466/guides)
### Female DC Power adapter - 2.1mm jack to screw terminal block

[Female DC Power adapter - 2.1mm jack to screw terminal block](https://www.adafruit.com/product/368)
If you need to connect a DC power wall wart to a board that doesn't have a DC jack - this adapter will come in very handy! There is a 2.1mm DC jack on one end, and a screw terminal block on the other. The terminals are labeled with positive/negative assuming a positive-tip configuration...

In Stock
[Buy Now](https://www.adafruit.com/product/368)
[Related Guides to the Product](https://learn.adafruit.com/products/368/guides)
### USB Powered Speakers

[USB Powered Speakers](https://www.adafruit.com/product/1363)
Add some extra boom to your audio project with these powered loudspeakers. We sampled half a dozen different models to find ones with a good frequency response, so you'll get quality audio output for music playback. Simply connect the standard 3.5mm stereo plug into your Raspberry Pi model...

In Stock
[Buy Now](https://www.adafruit.com/product/1363)
[Related Guides to the Product](https://learn.adafruit.com/products/1363/guides)
### USB 2.0 Powered Hub - 7 Ports with 5V 2A Power Supply

[USB 2.0 Powered Hub - 7 Ports with 5V 2A Power Supply](https://www.adafruit.com/product/961)
Add lots more USB capability to your Raspberry Pi or computer using this powered USB 2.0 hub. It adds a full **seven powered ports** , all at USB 2.0 speeds so you can use video cameras and other high speed devices (cheaper hubs are v1.1 and not as fast!)  
  
The extra sauce...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/961)
[Related Guides to the Product](https://learn.adafruit.com/products/961/guides)
### PIHUB - USB Hub for Raspberry Pi with US Power Adapter

[PIHUB - USB Hub for Raspberry Pi with US Power Adapter](https://www.adafruit.com/product/1516)
![Raspberrypi](https://www.adafruit.com/images/madeinuk.jpg) **A high-power, reliable, USB 2.0 hub ideal for the Raspberry Pi®  
 Fast, Fiesty and Fruity - Comes with a US-plug 5V 3A power supply, plenty of power for your...**

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/1516)
[Related Guides to the Product](https://learn.adafruit.com/products/1516/guides)

## Related Guides

- [LPD8806 Digital RGB LED Strip](https://learn.adafruit.com/digital-led-strip.md)
- [CircuitPython BLE Controlled NeoPixel Hat](https://learn.adafruit.com/circuitpython-feather-ble-neopixel-hat.md)
- [DotStar Belly Dance Fans](https://learn.adafruit.com/dotstar-belly-dance-fans.md)
- [How we designed an injection-molded case](https://learn.adafruit.com/how-we-designed-an-injection-molded-case-for-raspberry-pi.md)
- [LED Neon Signs with NeoPixels](https://learn.adafruit.com/led-neon-signs-with-neopixels.md)
- [Rumi Sword - KPop Demon Hunters](https://learn.adafruit.com/rumi-sword.md)
- [Sitcom SFX Door Trigger](https://learn.adafruit.com/sitcom-sfx-door-trigger.md)
- [Cosplay Glow Fur Raver Bandolier](https://learn.adafruit.com/cosplay-glow-fur-raver-bandolier.md)
- [Cheerlights Holiday Wreath with Animations](https://learn.adafruit.com/cheerlights-led-animations.md)
- [DotStar Pi Painter](https://learn.adafruit.com/dotstar-pi-painter.md)
- [Holiday Icicle Lights with Flair](https://learn.adafruit.com/holiday-icicle-lights-with-flair.md)
- [LED Neon Selfie Spot](https://learn.adafruit.com/led-neon-selfie-spot.md)
- [Adafruit's Raspberry Pi Lesson 12. Sensing Movement](https://learn.adafruit.com/adafruits-raspberry-pi-lesson-12-sensing-movement.md)
- [AstroPrint 3D Printing](https://learn.adafruit.com/astroprint-3d-printing.md)
- [MAX31855 Thermocouple Sensor Python Library](https://learn.adafruit.com/max31855-thermocouple-python-library.md)
- [Garden Path Lights with WLED and a Sunset Timer](https://learn.adafruit.com/garden-path-lights-with-sunset-timer.md)
