Tuesday, September 11, 2012

Labor Day Weekend: LED Audio Meter

Two weeks ago I received some MAX7219 samples from Maxim. So this past labor day weekend was the perfect opportunity to try one out. I started out by assembling another Atmega Lite from Gizmoz USA. I have three of them, of which this is the second to use. My friend bought me two and I bought another one while I was visiting Portland, OR last year. These are great, cheap and breadboard usable, or good to embed in a project like I have done with my Smart Outlet. Plus you can use the Arduino bootloader. So the first thing was to get one LED to light up, which I thought would be easy. Ha!


I started on Saturday afternoon by gathering my components and my large breadboard setup. Originally, it didn't occur to me that there might be more than just powering the IC. Good thing I found this: http://arduino.cc/playground/Main/MAX72XXHardware. Also, good thing, I had bought some capacitors a while back for building my own Atmega328, which I ended up not doing. They were the ones I needed for the MAX7219. Once I wrote a quick sketch using this library, http://arduino.cc/playground/Main/LedControl  , is when the trouble began. I couldn't get just one LED to light as it should. Reversing the LED kind of worked, it would light up, but not how it should. Something wasn't right. Not knowing what it was, I was moving things around like the power source knowing that the capacitors should be as close as possible. Finally it worked! It wouldn't be until the next day that I realized why. 
Atmega Lite and MAX7219

Closeup of LEDs


Saturday evening I decided I would borrow some LEDs from my fiance's LED Nametag kit and at least get one row of LEDs working. Now the question was what to do with these LEDs other than just blinking them in some random pattern which could get boring rather quickly. Then I remembered I had a leftover sound sensor from DFRobot which would be perfect to get the LEDs to react to sound. I spent the rest of the evening trying to get it to work but all I got was random analog readings that didn't make any sense. It was almost as if the sensor wasn't powered. Hmm...

Sunday afternoon I decided to revisit the breadboard. In testing the power to the sensor, I realized that I had forgotten that the power rails of a breadboard are not continuous all the way across. D'oh! Just like that it worked!
LEDs reacting to music

All LEDs lit

LED with Audio Sensor from DFRobot.com


The last part was getting a scale that worked well with various sound levels. I ended up trying two ways, either using a set scale or a scale that adjusts with the sound level. The latter being kind of weird because I have it reset every 5 seconds because otherwise loud sounds will cause most other sounds not to register. I am not sure which I like, but the set scale seems to work quite well. This was a fun little weekend project and, besides, who doesn't like playing with LEDs?! Enjoy the video below.


In the video the LED scale is fixed at a ADC reading of 25 being the 8th LED. 

No comments:

Post a Comment