Go Down

Topic: Microphone as dB and frequency sensor (Read 290 times) previous topic - next topic



Sorry if this is too basic, but I am very new to arduino and electronics. I come from programming, I am trying to start a project where I can control an RGB led strip, I want to be able to control the light intensity and color of the light strip (something like this), using a microphone.

My goal is for frequency to control de color of the rgb light and the dB (Volume) to control the light intensity. I have found several microphones such as this ones. Can I get both frequency and dB input from this microphones?

Would I need some extra controllers for this project? Again I am very new with this, sorry by the basic questions.



(something like this), using a microphone...

...Would I need some extra controllers for this project?
That particular LED strip has built-in controller & driver chips, so you only have to supply power and you can control it directly with the Arduino.    But, the specs are incomplete.   I suggest you buy from Adafruit.   They specialize in this kind of thing, and they have complete specs and hardware/software examples.

Do you want individually addressable LEDs?   ...Of course its up to you, depending on what kind of effect you want and individually addressable LEDs can be more "spectacular", but with amplitude and frequency you may only need intensity & color.

I have found several microphones such as this ones.
Do you really want to use a microphone that will pick-up all of the sound in the room, or would you rather tap-into a line-level or headphone-level signal?

Can I get both frequency and dB input from this microphones?
Of course a "plain" microphone will convert acoustic level & frequency into electrical level & frequency.  But, the signal from a microphone is only a few millivolts and it needs to be amplified.  Also, electret microphones have to be powered, and the Arduino can't read the negative half of an AC audio signal, so it has to be biased.   The microphone board should take care of all that. 

The specs on the microphone board you linked to are also incomplete.   Someone answered a question saying it has an "analog" output, but it's not clear if that's an audio signal or a proportional varying-DC signal, so that board might loose the frequency information.

Again, I recommend buying from an electronics supplier that provides complete specs such as Adafruit or this one from SparkFun.  The one thing I don't like about the Sparkfun board is that it doesn't have adjustable gain/sensitivity.   (You can adjust the sensitivity of the software to some extent.)

Once you have a signal (from a microphone board or from a line/headphone output) there is a nifty chip called the MSGEQ7 that gives you 7 time-multiplexed DC signals proportional to the amplitude of 7 frequency bands.   If you don't need more than 7 frequency bands that takes a big load off of your software.   Otherwise there is an FFT software library for finding the frequency information.     But, I have a feeling that with neopixels (individually addressable RGB LEDs) your software is going to be "very busy" sending-out the LED information.


Thank you, this helps a lot, some people had told me that arduinos migh not be fast enough for my idea, I intend to put the led strip in the frame of an acoustic guitar, and the microphone pointing at the opening of the acoustic box. I hope that the light shows in light what I am playing, I feel it shouldn't be all that complex for an arduino to pick those signals. What do you think?


I intend to put the led strip in the frame of an acoustic guitar, and the microphone pointing at the opening of the acoustic box.
CNLohr did exactly that. Take a look at his ColorChord project. ColorChord 1 needs a GPU to do the heavy FTT calculations, but ColorChord 2 runs on an ESP8266 SoC (it's a bit more powerful than an Arduino, and has more memory available.
Check out his YouTube channel and GitHub page:
- ColorChord 2: https://www.youtube.com/watch?v=qE3zEM8qM00
- ColorChord 1 on a guitar: https://www.youtube.com/watch?v=o_i6bse7SKw
- ColorChord on GitHub: https://github.com/cnlohr/colorchord

I think he uses the Expressif ESP8266 SDK (C/C++), so it might be a bit harder to program than with the Arduino IDE, but the performance will be much better. And since you have a programming background, this will probably be doable.

Hope this helps!


Jan 08, 2017, 01:50 pm Last Edit: Jan 08, 2017, 02:02 pm by GypsumFantastic
I did a similar project using the MSGEQ7 (as recommended by DVDDoug).

Instead of doing the analysis computationally with digital circuits, it does it all using analogue circuitry, then serves up the information you need in a form that the Arduino can easily digest.

Unless you were particularly interested in learning about digital signal analysis, I'd recommend not going that route. Do it all in analog.

The microphone you pictured will probably be OK, by the way. I needed auto gain control for my project though, so went with one of these https://learn.adafruit.com/adafruit-agc-electret-microphone-amplifier-max9814/overview


Good luck!

Paul Stoffregen

Indeed, for a regular 8 bit Arduino, MSGEQ7 is the way to go.  You probably also want the better APA102 LEDs.

If you're not already committed to 8 bit AVR, there are some dramatically better alternatives that can do all the analysis in software.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131