Go Down

Topic: Analog Read the same for all pins (Read 864 times) previous topic - next topic

ajfisher

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 (http://code.google.com/p/arduinoscope/wiki/Usage)
Practical Arduino Analog Code: (https://github.com/practicalarduino/ScopeAnalog)
What I'm building: (http://www.practicalarduino.com/projects/scope-logic-analyzer)

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


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


zoomkat

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.
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

ajfisher

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

Grumpy_Mike

#4
May 15, 2011, 12:39 pm Last Edit: May 15, 2011, 02:55 pm by Grumpy_Mike Reason: 1
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.

ajfisher

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

Go Up