Author Topic: Analog readings affecting adjacent readings in an Axon  (Read 2586 times)

0 Members and 1 Guest are viewing this topic.

Offline chungungonTopic starter

  • Beginner
  • *
  • Posts: 2
  • Helpful? 0
Analog readings affecting adjacent readings in an Axon
« on: April 03, 2010, 11:31:25 PM »
Hi Fellows,

I'm having a weird problem with my Axon. I built a tactile bump sensor as explained in http://www.societyofrobots.com/sensors_tactbumpswitch.shtml . I made the sensor with the resistance between the GND and Vout.

I connected the sensor pin 0 of the analog I/O of the Axon and uploaded to the Axon a simple program that reads every pin from 0 to 15 utilizing the a2dConvert8bit function from a2d.h

Here is the output of the program. Note that the readings are proportional to the distance to pin 0.   :o

0  0  18  35  48  57  59  59  60  62  64  65  65  65  64  62
0  0  16  35  48  57  59  59  60  62  64  64  64  64  63  61
0  0  17  35  48  57  60  59  60  62  64  64  64  64  63  61

When I turn on the switch of the sensor, the readings change to these
255  200  165  141  124  112  99  87  75  73  72  71  69  68  67  69
255  226  203  185  168  151  133  113  92  87  83  80  76  74  72  78
255  231  211  196  184  170  154  131  105  99  94  89  84  80  78  86

At first, I supposed that there could be some kind of short circuit, so I looked with a magnifier glass to the analog pins, both at the place where they connect to the sensor and at the side of the chip, and they all seem OK.

What could be happening?  ???

Thanks in advance.

Offline cyberfish

  • Robot Overlord
  • ****
  • Posts: 163
  • Helpful? 3
Re: Analog readings affecting adjacent readings in an Axon
« Reply #1 on: April 04, 2010, 12:56:46 AM »
I'm guessing the other inputs aren't connected to anything.

The inputs are "floating", meaning they can take just about any value. Most likely that of adjacent pins.

If you touch it with your finger, or look at it weird, the readings will change, too.

Note that unconnected (high impedance) does NOT mean 0 (ground).

Offline chungungonTopic starter

  • Beginner
  • *
  • Posts: 2
  • Helpful? 0
Re: Analog readings affecting adjacent readings in an Axon
« Reply #2 on: April 04, 2010, 07:47:13 AM »
It's great to know that the situation of my Axon is normal behavior. For a moment, I thought that my Axon was acting weird  ;D

Thanks for the advice!

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Analog readings affecting adjacent readings in an Axon
« Reply #3 on: April 04, 2010, 09:15:53 PM »
Yea, you'll see this happen with all microcontrollers.

I once lost a robot competition because I was accidentally reading the pin right next to the pin with the analog sensor. It seemed to work most of the time, but sometimes it wouldn't, or would be very flaky. The debugging drove me crazy. I didn't realize the dumb mistake until a month or so later . . . all from floating voltage.

There was a moral to that story, somewhere, I think . . .

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
    • Ro-Bot-X Designs
Re: Analog readings affecting adjacent readings in an Axon
« Reply #4 on: April 05, 2010, 07:22:45 AM »
Yea, you'll see this happen with all microcontrollers.

I once lost a robot competition because I was accidentally reading the pin right next to the pin with the analog sensor. It seemed to work most of the time, but sometimes it wouldn't, or would be very flaky. The debugging drove me crazy. I didn't realize the dumb mistake until a month or so later . . . all from floating voltage.

There was a moral to that story, somewhere, I think . . .

Yeah, try to declare all unused analog pins as outputs, then you won't have any floating voltage problem.
Check out the uBotino robot controller!

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Analog readings affecting adjacent readings in an Axon
« Reply #5 on: April 05, 2010, 09:14:33 AM »
Yeah, try to declare all unused analog pins as outputs, then you won't have any floating voltage problem.
Nah, that would have caused a short - pin says 5V and sensor says 2.5V . . . something will give . . .

I always look for this mistake when debugging a sensor that doesn't work.

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: Analog readings affecting adjacent readings in an Axon
« Reply #6 on: April 05, 2010, 09:56:37 AM »
Hi,

Yeah, try to declare all unused analog pins as outputs, then you won't have any floating voltage problem.
Nah, that would have caused a short - pin says 5V and sensor says 2.5V . . . something will give . . .
Nothing will give, as the sensor reading from an unused pin is merely a Hi_Z reception of a neighbour pin.
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Analog readings affecting adjacent readings in an Axon
« Reply #7 on: April 05, 2010, 10:21:38 AM »
Hi,

Yeah, try to declare all unused analog pins as outputs, then you won't have any floating voltage problem.
Nah, that would have caused a short - pin says 5V and sensor says 2.5V . . . something will give . . .
Nothing will give, as the sensor reading from an unused pin is merely a Hi_Z reception of a neighbour pin.
But a pin set to output isn't floating, its either 0V to 5V . . .

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: Analog readings affecting adjacent readings in an Axon
« Reply #8 on: April 05, 2010, 04:19:22 PM »
Hi,

Hi,

Yeah, try to declare all unused analog pins as outputs, then you won't have any floating voltage problem.
Nah, that would have caused a short - pin says 5V and sensor says 2.5V . . . something will give . . .
Nothing will give, as the sensor reading from an unused pin is merely a Hi_Z reception of a neighbour pin.
But a pin set to output isn't floating, its either 0V to 5V . . .
Oh well, who puts sensors on outputs?   :P  ;)
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives