Arduino duemilanove analog I/O

Hello Arduino's Forum! First of all i love the open-source way of thinking and its creativity!

Second I've a problem with my new arduino duemilanove just bought two weeks ago at a Workshop in Italy. ::) I try to use a potentiometer and buttons to make a sound controller but the problem is that the analogue inputs don't read the input from the potentiometer in a right way, i have a very slowly (i mean not in real time) range from 0 to 1023 just in input 3 and the other inputs print casual numbers between 100 to 500 in serial monitor. I use ubuntustudio 10.04 ( I installed the arduino software via PPA), but i tried it in another linux distro and in windows xp too, and in all OS the arduino duemilanove seems to have same behaviour. off course i tried with other potentiometer too. So I don't think that's a software problem or about installation

thanx in advance


Your circuits are probably not connected right. You can snap a picture of your circuit and post it so others can help you troubleshoot. The analog inputs that are not connected to anything are always goint to report random numbers. Try touching the board near those inputs and you'll see what I mean.

Check your grounding.

Also remove any calls to delay() if you want immediate response.

Hi there!

I don't have so much time in these days to make practices but i can answer to you guys.

@leppie: ground checked and delay already removed

@liudr: I was trying to reproduce this easy example unfortunally without success

my goal is to make a synth and controllers to make music.

liudr are you telling me that there's no signal coming in analog inputs if i see random numbers in the serial monitor? (I tried what you suggest)

There is only one input connected in the example, what are 'the other inputs' connected to ?

If they aren't connected to anything, you will get odd readings from them. Do a little searching on 'floating inputs'. Welcome to very high impedance micro-controller inputs, they wander up and down affected by any stray signals in the vicinity.

Hi Pluggy!

I tested with one input at a time in fact and only the N.3 seems to work - and not as it has to do. for example if I connect the N.0 input it return random numbers.

i'll make a search about the "floating inputs"

If you're reading the pin the pot is connected to, it should work the same on any analogue pin. You'll need to alter the code if you move the pot, or allow for the fact that the non connected pins will give weird readings.

If you're working on a breadboard, you could try hooking up the output from the pot to several analogue pins at once, you should get comparable readings from all the connected pins.

Hi Pluggy,

what you describe is what should be, but i have the right opposite situation: the pins not work in the same way - of course i alter the code when i change the pin - and seems that only one analogue pin work approximately (N.3).

I don't use a breadbord, i just plug the cable of the pot into 5v, gnd, and analogue input.

I don't know what to think. at the workshop i just taken one board, not the same on I worked, is it possible that someone have uploaded some wrong information directly to the board? is there a way to reset the chip? is it possible that situation is the sign of a faulty board?

thanx for support

Hey GrG,


Why don't you post the code with a simple pic of your circuit? It sure looks like something is floating? is there some sort of accidental contact between the supply and outputs of your pot? can you try grounding all unused analog inputs and then post the results here?

Cheers, Pracas

Hi Pracas thanks welcome!

I'm very busy in these days but on Thursday I'll post the result of what you asking me and i try to make a simple pic of the circuit ;) Now I can say there's no accidental contact. how can I ground all unused analogue inputs?

thanks in advance


Here is a simple test. Connect the analog input pin you are using to ground and take a reading. It should be zero. Then connect the analog input pin to the 5V pin and take a reading. It should be 1023. If you don't get approximately (+/- 1 or so) those two numbers then the problem is either in your code or the analog channel is bad. If you do get those numbers then it's either you're wiring is wrong or the potentiometer is bad.

Here is a simple test.

Only if he has coded correctly.. Depending on functions like 'map()' for example, the range OBSERVED may be different than 0 - 1023. Just a consideration.

By the sounds of it, though, its likely a wiring problem.