Arduino + Microphone how to grab values

arduinomicrophonesound

I have a simple microphone. How can I send some "volume" or "oscillation" values via serial to the computer?

I built a simple preamp but it does not respond, any hints?

Best Answer

If you are just trying to sample a microphone, then an Arduino might not be necessary. The computer has all of the tools required to sample and process data.

For example, if you have the data acquisition toolbox on MATLAB:

ai=analoginput('winsound');
addchannel(ai,1);
start(ai);
data=getdata(ai);

Or if you prefer something a little more free, you could use PyAudio, which is a simple way of getting audio off of your sound card and into an array of samples.

If you are dead-set on using the Arduino, you want to make sure that the output of your pre-amp is under 5V peak-to-peak, which you can check on an oscilloscope or multimeter. You then need to use a DC-block capacitor in series with the output of the pre-amplifier, and then shift the signal up to 2.5V using a simple resistor divider.

The effect that this has is biasing the entire signal up by 2.5V, so that it varies between 0 and 5V (the range of inputs for the Arduino).

After that, it is a simple matter of sampling the analog input, and then removing the bias (should be around 512 ticks) from the sampled signal.