Go Down

Topic: Animating LEDs based on volume from adafruit mic MAX 4466 (Read 1 time) previous topic - next topic

karltinsly

I am trying to animate some LED matrices based on the volume from an adafruit mic/preamp board. The board says MAX 4466 on it, and it has VCC, Gnd, and Out pins.

I connected the VCC pin to the 3.3v pin on my arduino nano, Gnd to ground, and the Out pin to A0.

I would like to read A0 and get a value that I could use to determine which bitmap to display on the LED matrices. Here's my code, but the serial monitor output is pretty much constant around 780-790. It doesn't seem to be reacting to noise at all.

Do I need something more in my code, or in my circuit? Thanks for any help.

Code: [Select]
#define MIC A0

int sig = 0;

void mic(){
  sig = analogRead(MIC);
  Serial.println(sig);
}

void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
mic();
delay(1000);
}

Grumpy_Mike

Remove the delay from the code.

Can you supply a link to the board, just the part number on one chip is not enough?

karltinsly

It is this board: https://www.adafruit.com/products/1063.

karltinsly

I took the delay out, but now it's hard to follow changes in the serial monitor. I have four different animations (bitmaps), and I was hoping to be able to use the volume from the mic to select which bitmap to display.

Grumpy_Mike

Quote
I took the delay out, but now it's hard to follow changes in the serial monitor.
Go to the tools menu and select serial plotter you will get a scope,like waveform.

Have you adjusted the gain to full?

karltinsly

Thanks, I see the output on the serial plotter now.

The gain is currently at full.

How can I use this data to trigger actions based on volume?


Grumpy_Mike

Quote
How can I use this data to trigger actions based on volume?
The if statement used on the data can be used to activate blocks of code.

karltinsly

Okay, I found what I was missing. On Adafruit's website I found an example code for their mic. It shows how to get the peak-to-peak level and convert it into a usable number for my if statements.

Go Up