Introduction: OLED Spectrum Analyzer W/arduino & MSGEQ7
This was rather simple project build around this article, I didn't write code from scratch:
http://tronixstuff.com/2013/01/31/tutorial-arduino...
and the OLED code is adafruit's library code.
Another credit for user lb-20 for suggestion.
But, the idea is that microphone amplifier signal is fed to MSGEQ7 chip, and that signal from there is handled with microcontoller (used teensy 3.2 as I lacked audio shield, and couldn't figure out yet FFT libraries inner workings....but this project was mainly fooling around with OLED screen. Arduino will do just fine!)
As for screen, it's 128x64 (or 32 seems to be more closer truth.....) i2c controlled.
Buttons on photo are not needed, they are just for menu system built around too, but not in use here now, sorry for confusion!.
Off to items needed. (not much!)
Step 1: Items Needed+schematic
What I used, there are many ways to skin a cat!.
Microcontroller
Teensy 3.2, but arduino pro mini will do just fine, just remember FTDI converter for programming. 5v and 3v3 versions both work, not that picky.
http://eud.dx.com/product/tj-02-pro-mini-module-at...
OLED
128x64 I2C controller. If you can't see anything, or screen is fuzzy, check sda/scl, perhaps they are reversed?
http://eud.dx.com/product/0-96-128x64-i2c-interfac...
Microphone module
MAX9812, was cheap and seems to behave well enough. DON'T hook up this microphone module directly to ADC (analog) input, it is ac output at even thought ADC wouldn't be damaged, it still is AC which ADC doesn't like.
Make sure module is amplifier (uses max9812 or similar) instead of lm393 or similar, latter one types are noise level detectors, and give out either logical 1 or 0, depending on noise level, these are used in like clap (trap) sensors.
http://eud.dx.com/product/max9812-microphone-ampli...
MSGEQ7
Ic that takes care of filtering and such. Also, it converts AC voltage from microphone to safe DC voltage which ADC can read safely.
Step 2: Upload Code
Code could see optimization but there is saying "if it 'aint broke, don't fix it" that said, feel free to tell improvements!
I didn't bother with port manipulation as they weren't needed here
You will need libraries from adafruit, or some other.
code is as file, didn't attach well enough....
well, that's it, ask away and comment!
Small troubleshooting at end:
Nothing on screen/fuzzy screen: sda/scl wires reversed, or possibly wrong library. I use currently up-to-date versions on all libraries & arduino IDE. (1.6.7).
Bars either on or off: this can be due that you have wrong type of microphone amplifier, there are two major types of these modules; other is amplifier, other is comparator (if datasheet mentions lm393 or similar comparator, this is NOT the type you wan't, it gives either logical 1 or 0, depending on settings. What you wan't is like max9812, with or without AGC, doesn't matter (AGC stands for automatic gain control, low noises are amplified much, but high noise levels are compressed to rebel clipping).
Use well regulated power supply, computer USB works fine.
Comments