I'm looking to use an Arduino Duemilanove to monitor the audio output from an MP3 player (iPod shuffle). Essentially I would like the Arduino to sense whether or not the iPod is outputting sound.
My ideas include:
Using an AnalogRead pin to constantly sample the line. I'm not sure how an ADC works when sampling an audio signal.
Using a comparator with a threshold set between 50-500mV, and then have the Arduino do an analog read on the output of the comparator.
I've examined the output waveform of the iPod and it seems to produce an output of 50-1200 mV wave depending on the volume.
Does anyone have any experience with working with audio signals or perhaps have any suggestions?
I am not sure how you would go about connecting the sound to the Arduino itself, I believe you would have to rectify it somehow. Though, this would be easy to do in the code. The analogRead function returns a value between 0 and 1023. If the Arduino is getting audio, it obviously won’t return 0, so you could use the < and > etc operators to set how high the input voltage is (0-5v) before the arduino does something.
If you bias the analogue input to half way with two 33K resistors to the 5V and ground. Then couple the audio in through a capacitor. With no audio you will get a steady reading of about half. With audio there will be values above and below this. As long as you don't have more that 2.5V of audio signal you will be OK.
I've been playing with Sparkfun's MEMs Microphone breakout board lately. Might that fill the bill for you?
To those interested in how I solved the problem:
I full wave rectified the audio signal with two op-amps, set with a large gain such that the Op-amp would essentially saturate to the positive rail when a 50mV signal or larger was applied. The arduino's ADC was able to easily differentiate when an audio signal was present on the line or not.