Interpreting output of Electret microphone breakout board

I am very new to Arduino and I’m trying to light up a strip of analog, non-addressable LEDs based on a microphone input.
I am driving the LEDs with N-channel MOSFETs as in this diagram:

I have successfully made the LEDs fade smoothly through ROYGBIV. I also have this Sparkfun Electret Microphone Breakout Board and have wired its AUD to analog 0, its GND to the breadboard alongside the LED grounds, and its VCC to the 3.3v on the Arduino.

I am unable to comprehend the input from the microphone. In relative silence, the input reads at approximately 330, fluctuating between 300 and 360. If I connect VCC to 5v, the output is approximately 512 but the fluctuations are much larger. I read that this is because 5v is a “noisier” input. This is the code I use to read the input.

void setup() {

void loop() {
  int sensorValue = analogRead(0);

My initial idea was to separate the input into bass, middle frequencies, and treble, but since I currently do not have an MSGEQ7 to split the spectrum, I am now trying to drive the LEDs based on the volume of the input, and I’m stuck. How can I get a normalized volume output?

I’ve tried subtracting the apparent average (330) from the signal and taking the absolute value, but I still don’t get readings. Actually, I’m still unclear on what the actual output of the microphone breakout board is. Can anyone help shed some light on this for me? I’ve looked on forums and tutorials but they all seem to be missing key steps.

Thanks – first post!

The microphone outputs a voltage corresponding to the sound pressure level at the instant it is sampled.

You have a print and a delay in the loop that slow down the sampling rate to roughly once every 20 milliseconds (about 50 Hz), which means you won't be able to make sense of signals corresponding to sounds with frequency higher than about 20 Hz. That frequency is below the range of human hearing.

I've looked on forums and tutorials but they all seem to be missing key steps.

So it could be that you are missing some key concept, why don't you ask about that?

I read that this is because 5v is a "noisier" input

No it is not. It is the proper signal you are seeing. The "noise" is the signal the board is producing.

Your board needs to be fed into a circuit called an envelope follower first:-

Thanks for the replies. The idea for noisiest inputs came from this.

Using it is simple: connect GND to ground, VCC to 2.4-5VDC. For the best performance, use the "quietest" supply available (on an Arduino, this would be the 3.3V supply). The audio waveform will come out of the OUT pin.

That the voltage corresponds to the instantaneous sound pressure makes more sense than just reading "the waveform", thanks for the clarification jremington. Also, the print loop was just a sample to get some sense of a range of values, but it makes sense why it wouldn't be very useful for human-level sounds. Earlier I had the Arduino hooked up to LabVIEW and I could see a graph of the full wave, it's just that the output was difficult to work with and LabVIEW can only monitor, not actually deploy.

Grumpy_Mike, by missing a concept I meant that one would use code targeting a different microcontroller, another would use a homemade amplifier instead of the breakout, etc. Thanks for the suggestion of the envelope detector, I will look into incorporating that into my circuit.

I did more researching and I got led to Fast Fourier Transforms. This appears to give me the data that I originally wanted. Also, this git repo has nearly the same setup that I do, though the code is a bit hard to read and is marked fix me. Is this the correct direction to continue?

Is this the correct direction to continue

Yes the FFT is a software way of doing what the MSGEQ7 does.