Shop OBEX P1 Docs P2 Docs Learn Events
Millimeter distance using the IR-kit (JBot Code) — Parallax Forums

Millimeter distance using the IR-kit (JBot Code)

johnatworkjohnatwork Posts: 7
edited 2006-05-09 15:11 in General Discussion
Hello,

I managed to get the IR-kit (the one that came with the Boe-bot) working using the attached code (from the JBot project) It seems to work, moving my hand closer to the sensor yields a lower value and further away yields a higher value (~5-15) In a seemingly linear fashion.

The problem is that I don't know what these values mean and I would prefer the them in Millimeters. The first idea I had was to simply use my hand and a ruler to map each value to a given distance, but there has to be a better way.

I noticed another thread posted here, basically asking the same question, however I want to use the code I already got working and not rewrite it using FreqOut or anything similar.

Any ideas?

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-05-08 10:53
    The values 0-15 are used to indicate object presence, with 15 being NoObjectDetected.
    The values 0-14 represent some distance but those are not specified.

    Take some readings and note the distances for readings 0 to 14.
    That gives you a value-to-distance table·which you can
    use in your program to translate values into distance.

    regards peter
  • johnatworkjohnatwork Posts: 7
    edited 2006-05-08 12:05
    Thank you Peter, I will do exactly that.
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-05-08 12:42
    Here is an adapted version for output 0-63 instead of 0-15.
    This should provide 4x better resolution.
    Question is if you can have millimeter resolution with IR.
    Acoustic distance measurement may be more accurate.

    regards peter
  • johnatworkjohnatwork Posts: 7
    edited 2006-05-09 14:50
    I don't know about that... 64 loops with 200 periods pause in each! Sound like it would take quite some time to read one distance.
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-05-09 15:11
    You can try decreasing·the delay. (64*200*8.68uSec = 0.11 sec)
    With only 16 levels and millimeter resolution you would only
    have a distance variation of 16 millimeter, which is in my opinion
    of no use.
    I still think for those resolutions and some larger distances
    that an acoustic solution like the Ping is better suited.

    regards peter
Sign In or Register to comment.