Pages: [1]   Go Down
Author Topic: Analog Read the same for all pins  (Read 787 times)
0 Members and 1 Guest are viewing this topic.
Melbourne
Offline Offline
Jr. Member
**
Karma: 2
Posts: 83
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

Melbourne
Offline Offline
Jr. Member
**
Karma: 2
Posts: 83
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

0
Offline Offline
Tesla Member
***
Karma: 145
Posts: 9685
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Melbourne
Offline Offline
Jr. Member
**
Karma: 2
Posts: 83
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 634
Posts: 34535
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: May 15, 2011, 07:55:13 am by Grumpy_Mike » Logged

Melbourne
Offline Offline
Jr. Member
**
Karma: 2
Posts: 83
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Pages: [1]   Go Up
Jump to: