Audio Input

Hey guys,

searching for hours to find out how send an audio signal to my arduino. the results I've found sound too complex for me. (in between I'm a newbie)
I need only an idiotproof and easy way (or a cheap module) to send an audio signal from a PC phones-output(or CD/mp3-player) to the "analog in" pin of the arduino uno. At the end a servo should get it's rotation depending on the mVs of the analog in pin.

Any ideas?
thanks in advance

The Arduino analog input pins can only safely read voltages between 0 and +5vdc, nothing negative or over +5vdc allowed, without damage to chip. Audio is AC voltage that has a negative and positive value changing with the signal. Therefore an Arduino can NOT read a audio signal directly. Even if you can offset the audio AC signal to fit in a 0-+5vdc voltage range, it still not clear that an Arduino can do anything useful with an audio signal, it lacks memory and A/D speed capabilities for most usefull audio applications.

What did you have in mind for the Arduino to do with the audio signal?


I think you're going to want something like this.
An op amp circuit to boost your mp3 levels to 0-5V range, and an envelope follower circuit to smooth out the level and not drive your servo totally batty.
I recommend you get some oscilloscope capability so you can capture the output be able to tweak the values. has a very nice little USB scope for not very much money that will work great.

it should act like a vu-meter.
i have in mind to make a guitar playing card-board puppet. the picking arm should rotate. actually thats a all.
just need a simple solution to send my audio to the arduino.
i will take a closer look to the scope. maybe that's ist...or maybe not :wink:

Back and forth, or just faster/slower?

back and forward would be great. acceleration in addition would be greater.
the last time I saw a real analog VU-meter in action is years ago. But I can remember that the movement was very smooth...and kind of laid back.
I can imagine... if the servo get as minimum 0V and than all the peaks of the sound, it could maybe act like this.

in between... does anybody has experience with this shield:

maybe that's what i need.
at the end i would like to send a stereo sound to the arduino. in the left channel should be the guitar, in the right the voice. so ... than i can use one servo for moving the guitararm and one servo for moving the mouth. each servo is getting values from the left and right channel.

interested too.
my project of open-source synth would involve an additional audio input that could be process by the little fx unit :slight_smile:

First I think that all of the answers above hold validity and should already give you some ideas about audio capability/ levels, etc.

To give you another simple implementation, I've linked to a post I wrote (including the electronics and code) on my blog here..

Basically, as mentioned, the arduino ADC reads 0-5V signals. The signal you are passing it would swing +/- about 0V. This means feeding it directly will clip the negative values; you'll just get the positive ones (not recommended, but you could go with it depending on your application).. An op-amp (also mentioned above will help - I think that one may also have a 2.5V bias on it, as I will describe..) if you tune it properly to scale the analog signal can also help to get maximum resolution (feeding in a larger analog signal that does not clip lets you take advantage of your full 10 bit sampling precision). Alternatively (simpler, but not quite as good) you can just turn the volume all the way up. You won't be using all 10 bits since it won't swing all the way up to 5V, but you will get enough to do something.

Anyways, without DSP related considerations to sampling/ anti-aliasing, etc, the key is that you want to bias the ADC pin to 2.5V using a voltage divider, and isolate that point from your audio source using a capacitor that will pass audio frequencies (4.7-10uF should be sufficient). That's three components; two resistors and a coupling capacitor. This lets you feed in both the positive and negative parts of the waveform. Input signals that are negative will swing the bias between 0 and 2.5V; Input signals that are positive will swing the bias between 2.5 and 5V.

In software, you can then subtract 512 to get your "negative" values. You can print this to the serial monitor to verify what's going on.

*Note: The code I included also has an "offset" value. You can calibrate this manually. You want to choose it such that after subtracting 512 you get 0 (the case when input signal is 0, so you just get the bias voltage). It may deviate from this if the voltage divider between the resistors is not exactly 2.5V (because there are inherence tolerances in the resistor values). Using larger resistors is fine - you are trying to establish a voltage bias; this helps to limit current and therefore power drawn from the supply... and given a fixed tolerance will result in less deviation of the bias point from Vcc/2 or 2.5V..

I could go a bit further, but I hope this will help, along with the posts above..

Have fun!

ooooooohkaayyyy.... your link sounds nice. thanks. gonna check it out tommorow.

by the way I'm working on an other solution using processing.
I'm capturing my audio in real time with processing and sending the volume-values throught the serial port.
the arduino is reading the serial (pos = Serial.port) and writing it to my servo.
I'm not sure if it's a better solution. but at least i've got my first movemnt depending on audio :wink:

The Shifty VU shield you asked about should work fine, especially if you can adjust the input volume from your sound source. It acts like a VU meter.

well... finally the Shifty VU Shield arrived, but somehow it doesnt work the way i expected^^
i just plugged it to my arduino. The RFSEL is "open" and the PWRSL too.( no jumpers)

I'm using this code that I've found here in the forums to read out the values but it's always 0.
any ideas what's wrong?

int sensorPinA = 2;
int sensorPinB = 3;
int sensorValueA = 1;
int sensorValueB = 1;

void setup() {

void loop() {

for(;:wink: {

// pinMode(sensorPinA, OUTPUT);

sensorValueA = analogRead(sensorPinA);
sensorValueB = analogRead(sensorPinB);


Serial.print("A 2");

Serial.print("B 3");


I think the code you pulled from the forum here was corrected later in that same thread. In any case, a delay of 200ms is probably too much to see a lot happening. You should also try analogReference(INTERNAL); in the setup() section. Also play with the level adjustment trimpots and the volume of whatever device you're using for an audio source.

You soldered the passthrough headers to the shield, right? You'd be surprised how many people try it without doing that.

Additionally, the endless for loop structure is not needed. The loop() function is already run repeatedly.