go_away

Author Topic: a2dConvert8bit returning wrong values  (Read 2334 times)

0 Members and 1 Guest are viewing this topic.

Offline silo_xtremeTopic starter

  • Robot Overlord
  • ****
  • Posts: 172
  • Helpful? 0
  • I really love robots, they keep me awake at night.
a2dConvert8bit returning wrong values
« on: February 16, 2008, 12:53:17 PM »
Hi all,

My a2dConvert8bit function should be giving me a value of 30 according to the output voltage and sharp IR documentation.

The function is actually giving me 120, any ideas?

Mike
« Last Edit: February 16, 2008, 04:31:14 PM by silo_xtreme »

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,653
  • Helpful? 21
  • narobo.com
Re: a2dConvert8bit returning wrong values
« Reply #1 on: February 16, 2008, 11:40:42 PM »
is it giving you the same value all the time, regardless of distance?

also, did you set up the analog ports and inputs properly?
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline silo_xtremeTopic starter

  • Robot Overlord
  • ****
  • Posts: 172
  • Helpful? 0
  • I really love robots, they keep me awake at night.
Re: a2dConvert8bit returning wrong values
« Reply #2 on: February 17, 2008, 09:50:06 AM »
Ok, I've been checking this.

Looks like i'm expecting to get 30 (aka 30cm) because the volt meter says my Sharp IR is outputting 2V.  (I measured it).

However, when I get the value back from a2dConvert8bit , it's ~ 120 (it does change) +/- 2

Does this have something to do with my Reference?  I'm a little confused.   ???

Offline silo_xtremeTopic starter

  • Robot Overlord
  • ****
  • Posts: 172
  • Helpful? 0
  • I really love robots, they keep me awake at night.
Re: a2dConvert8bit returning wrong values?????
« Reply #3 on: February 17, 2008, 10:53:42 AM »
Still thinking about this one....

Perhaps what I am getting back is my 2V as a number between 0-255 ?  Even with that assumption, i'm not sure I'm getting the right values.....

am i missing an equation or table lookup for the Sharp IR?

Offline silo_xtremeTopic starter

  • Robot Overlord
  • ****
  • Posts: 172
  • Helpful? 0
  • I really love robots, they keep me awake at night.
Re: a2dConvert8bit returning wrong values
« Reply #4 on: February 17, 2008, 11:44:23 AM »
Hi again,

My N00b brain is still learning, and I read this article:

http://en.wikipedia.org/wiki/Analog-to-digital_converter

Now, I realized that the SOR code for the $50 robot does "obstacle detection";  silly me was thinking that I should be getting back values for distance.

If I wanted distance values I would probably make a look up table and compute it.  right?  ;)


Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,658
  • Helpful? 169
    • Society of Robots
Re: a2dConvert8bit returning wrong values
« Reply #5 on: February 18, 2008, 09:37:15 AM »
Quote
If I wanted distance values I would probably make a look up table and compute it.  right?
yeap :P
(airman00 asked the exact same questions I would have)

 


Get Your Ad Here