Go Down

Topic: Mic amps (Read 1 time) previous topic - next topic

baum

I have tried that, but I still get the constant reading. I'll try again.

baum

nvrmnd. transistors were in backwards. Now, I get some fluctuation from 170~250, which you can see on a pwm'd led.


Edit: Just ran a high/low program:
Code: [Select]

int low = 1023;
int high = 0;
void setup() {
  Serial.begin(9600);
}

void loop() {
  int sensorValue = analogRead(A3);
  if (sensorValue < low) {
    low = sensorValue;
  }
  if (sensorValue > high) {
    high = sensorValue;
  }
  Serial.print("h: ");
  Serial.print(high);
  Serial.print("\t");
  Serial.print("l: ");
  Serial.println(low);
}



And if I clap ~5 inches from mic I get h:939, l:40. So it works! yay!!

Si

Thats probably it working fine :)

As I said before, the fluctuation is the signal. If you want to get the overall level, you need to do some Integration / low pass filtering / averaging.

The sketch I pointed you at for the book, has an algorithm in it to LP filter.
--
I write books about Arduino and Electronics: http://simonmonk.org

baum

OK. Thanks! But I only care about amplitude, why would I need filtering?

Si

A 1 KHz sound wave is an oscillation at 1000 times per second. Lets say a sine wave. So if you sample the amplitude you may hit it when its at a peak, or when its in a trough. But unless you do something like find the highest value, or low pass filter it to obtain the envelope, you will not have a measure of the 'volume' of the sound.

Words to lookup on Wikipedia: low pass filter, signal envelope, sine wave
--
I write books about Arduino and Electronics: http://simonmonk.org

baum

So I should make a hardware lowpass filter? What should I do?

Si

Download the sketches for my book from http://www.arduinoevilgenius.com and have a look at the sketch for project 21. This has code for detecting the maximum level - if I remember right.

Then buy the book ;)
--
I write books about Arduino and Electronics: http://simonmonk.org

baum

Where do I download the sketch?

Si

its on the downloads page ;)

You can just download the zip of all the sketches for the book.

--
I write books about Arduino and Electronics: http://simonmonk.org

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!

Arduino
via Egeo 16
Torino, 10131
Italy