Analog Read the same for all pins

Hi all,

Okay this is quite a weird effect I'm getting here and I'm interested in seeing if anyone can explain it for me...

I'm building the quick and dirty oscilloscope from Practical Arduino and have hooked it up to the ArduinoScope processing sketch. At the moment I'm using the Analog version.

Relevant links: ArduinoScope (Google Code Archive - Long-term storage for Google Code Project Hosting.)
Practical Arduino Analog Code: (GitHub - practicalarduino/ScopeAnalog: Firmware to read analog inputs)
What I'm building: (practicalarduino.com)

My test circuit is simply a 1.5v battery and I'm measuring the amount of voltage from it (1.37v on my DMM).

I've got the system all up and running and it seems to work okay except for one really odd effect which is this:

I've simplified my code to eliminate the actual oscilloscope body altogether and gone back down to my arduino only. Basically I've got GND from arduino to +1.5v going to Analog pin 0.

Running the code given at the github link above I'm getting 1.37v (281 raw read) but not just on pin 0 but on the other pins as well (although it drops off a tiny bit as I go through each one. (pin1: 279, pin 2: 276 etc all the way to pin 6: 240).

If I connect pin 1 to the +ive terminal then it stabilises exactly as pin 0 does and I get a nice solid +1.37v.

This is replicable across all the pins and I've tried it with a couple of other simple circuits as well (eg lighting an LED etc).

Part of me says I shouldn't care what the other unconnected analog pins are doing however it's something I noticed so I wanted to see if there was something wrong with what I'm doing or else someone has an explanation for what's going on?

Cheers
ajfisher

Another thing further to this that makes this even weirder which is what made me post here to begin with.

If I use my DMM to measure the OTHER analog pins on my shield then I'm getting either 0 or pretty close to it (up to 6mV) on the other pins even though the Arduino is reading and reporting the higher value.

Cheers
ajfisher

The other input pins are "floating" which means they may read most anything. Your meter is essentially grounding the floating pins such that there isn't any significant voltage to mesure. With your meter connected to one of the input pins, see if you then detect any voltage on the pin with the o-scope.

Thanks for that zoomcat - much appreciated and good to see I'm not going mad.

The pins do seem to be "affected" by what is going through whichever one is connected though with random oscillations that get increasingly smaller as the pins get further away - could be an interesting project in taking that oscillation and using it to drive some thing - kind of a combo user input + randomisation thing...

Cheers
ajfisher

Remember there is only one A/D converter in the arduino and the input pins are switched to it in turn. There is a small capacitor on the input of the A/D converter that is charged up by the voltage on the input pins. With nothing connected there is nothing to charge or discharge this capacitor so it reads the same as when the connect pin was switched through.

Thanks Mike - that's a great explanation - much appreciated and good to get a little bit more understanding of what's going on under the hood. And that perfectly explains the decay issue I was seeing too.

Cheers
ajfisher