Arduino + Mic + Pre-Amp = crap (SOLVED!!!)

i've been working on this project for two days non-stop and all i got now is frustration.

i'm making a sound trigger for high speed photography.

mic : electret mic

preamp : http://www.sparkfun.com/datasheets/BreakoutBoards/Amplified-Mic-v10.pdf , got no OPA344 and used LM324N instead. Using 9V to power it, and output measured using multimeter as 3.87V. Tested with PC speaker and it works.

rectifier : http://itp.nyu.edu/physcomp/sensors/Reports/CondenserMicrophones

result : 36 27 195 503 489 50 0 34 217 542 399 24 0 91 417 541 311 0 33 260 625 604 113 57 337 661 567 56 7 95 405 696 392 27 24 389 735 443 66 10

i've played with the A2D pin of my Arduino, using potentiometer. GND on the left pin, middle pin goes to A2D pin of Arduino, and 5V goes to the right pin. My Arduino is fine, it returns result from 0-1023, very stabil.

what else did i do wrong?

not enough gain?

already got 100x gain. it's now 3.8V, if i double the gain, wouldn't it be 7.6V?

my code :

int analogPin = 0;
int x;
void setup()
{
  Serial.begin(9600);

}

void loop()
{ 
  
  x=analogRead(analogPin);
  Serial.println(x);
  delay(200);


}

What do you get if you disconnect the microphone and ground the input of the amp?

refering to http://www.sparkfun.com/datasheets/BreakoutBoards/Amplified-Mic-v10.pdf, the other terminal of the mic as already attached to ground, so to test the scenario you gave i just unplugged the mic and short the 2 wire...

after the rectifier, it gives 4.02V

without rectifier, after the amp, it gives 4.46V

please note that regarding to schematics in http://itp.nyu.edu/physcomp/sensors/Reports/CondenserMicrophones I only take the rectifier part.

thank you for willing to help.

i think you were talking about the A2D reading,

here it is with the rectifier : 346 485 272 0 0 23 240 469 369 0 0 0 86 385 464 168 0 0 184 455 405 63 0 9 121 421 384 34 0 0 149 436 426 97 0 34 258 482 335 0 0 2 120 463 389 37 0 17 236 477 362 0 0 35 262 495 152 0 0 47 367 505 223 0 0 65 293 485 209 0 0 70 382 436 107 0 0 168 451 432 95 0 0 94 330 477 79 0 0 109 471 410 66 0 11 215 477 393 0 0 0 70 380 481 198 0 0 89 318 497 186 0 0 91 323 475 184 0 0 104 404 471 179 0 40 268 490 350 0 0 7 108 472 425 83 0 6 115 417 466 70 0 9 100 269

and here it's with amp only, no rectifier :

59 97 316 435 188 0 0 0 132 445 313 0 0 0 40 262 450 146 0 0 31 329 399 62 0 0 36 252 452 255 0 0 0 88 382 409 91 0 0 12 163 303 0 0 0 0 0 6 52 86 0 0 0 0

both case is with mic wire shorted and grounded.

Using a preamp and a rectifier gives you an unipolar voltage but it is still changing rapidly. If you want a continous voltage or at least a slow changing voltage you should add some filtering (the last part of the workshop). You must adapt the capacitor value to your need. The higher the capacitor will be the slower the voltage will change. Beware that this introduce some time delay in the system.

Well, if we take a look at this schematic, http://itp.nyu.edu/physcomp/sensors/Reports/CondenserMicrophones, there's already a low pass filter, isn't it?

should i make the capacitor value bigger and resistor smaller? (maintain the corner frequency value, yet have bigger capability to smoothen wave).

ok, i think i got it solved...

here is what the rectifier + filter part looks like before :

and here is how it is now :

can someone please explain how it is not the same?

the A2D reading is now very stabil, fluctuating only one unit (eg. 780-781), after some testing i now supply only 5V to the preamp, using a voltage regulator. The result is more delighting, i have more space between the ambient reading and max value (1023) allowing me to put higher threshold trigger value. At 5V supply, the ambient reading is now 508-509.

One more thing, how can i be sure that a very loud noise won't push the sound signal voltage beyond 5.5v?

thank you to those who have already helped earlier...

Well D4 is doing absolutely nothing both ends are connected to ground so you might as well take it out.

The second circuit looks like it has a common ground with the arduino, without one you can't expect to have a stable measurement.

As you only have a 5V supply the audio can't get any bigger.

i've read many of your post grumpy_mike, i have great respect for you :D.

is it always important to "commonize" the ground between multiple "sub-system"?

is it always important to "commonize" the ground between multiple "sub-system"?

Yes it is. Have a look at this page:-http://www.thebox.myzen.co.uk/Tutorial/Power.html

It explains why from the point of view of an arduino driving an output but the reasoning applies just the same for an input.

If you have ever used an oscilloscope you will know that you do need a ground connection as well as a signal connection before you get any readings that have not got large pickup voltages of the mains frequency on them.

Hope that helps.

Sorry wrong link, you actually want to read:-
http://www.thebox.myzen.co.uk/Tutorial/Power_Supplies.html