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);
}
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.
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...
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.