Shop OBEX P1 Docs P2 Docs Learn Events
Interfacing a Sharp IR distance sensor to a Basic Stamp — Parallax Forums

Interfacing a Sharp IR distance sensor to a Basic Stamp

Martin_HMartin_H Posts: 4,051
edited 2013-01-03 21:03 in Robotics
I received a Sharp IR distance sensor In my Parallax Mystery stocking. These are small and handy, but they require A/D conversion to interpret their output. This isn't a big deal for an Arduino or PropBOE. But not for a Basic Stamp or vanilla Propeller chip because they're not amenable to RC time without some additional circuitry. But this page provides a nice summary of how to do it:

http://www.noisemantra.com/BASICStampAnalogInput.htm

I need to put this on my list of projects to try shortly.

Comments

  • WhitWhit Posts: 4,191
    edited 2013-01-03 15:59
    I think that these sensors are a favorite of erco's. He might have some input too. Good find Martin!
  • ercoerco Posts: 20,256
    edited 2013-01-03 16:57
    This old hard-to-find document shows how to easily use an ADC0831: http://www.parallax.com/dl/docs/prod/acc/SharpGP2D12Snrs.pdf

    For my balance bot, I just used a resistor ladder to bracket the sensor's analog output into 8 different zones. Simple, but requires many I/O pins: http://forums.parallax.com/showthread.php/126312-Balancing-Bot?p=961523&viewfull=1#post961523
  • WhitWhit Posts: 4,191
    edited 2013-01-03 18:02
    I knew you'd come through erco! You da man.

    This would be good for Gordon's new Quikstart Volume 2! :-)
  • Martin_HMartin_H Posts: 4,051
    edited 2013-01-03 18:07
    I suppose that the serial ADC is faster and more accurate than RC time, but I really like only using a single pin with the transistor technique.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2013-01-03 18:13
    I have used the GP2D12's output as the freq. adj voltage for a 4046 (CD_ or 74HC) configured as a VCO, and reading that with PULSIN. (The VCO output is a square wave.)
  • Martin_HMartin_H Posts: 4,051
    edited 2013-01-03 20:26
    PJ, that's clever too. It allows for a single pin interface but I imagine that it is faster than RC time.
  • ercoerco Posts: 20,256
    edited 2013-01-03 21:03
    Tracy Allen's site is an invaluable reference worth reviewing periodically: http://www.emesys.com/BS2index.htm

    He covers ADCs, and also measuring various voltages using RCtime. "One pin, many switches" is required reading where I come from.

    Hmmm. Tracy Allen, PJ Allen, Allen Wrench. Ethan Allen, Woody Allen, Tim Allen. Mere coincidence? I think not...
Sign In or Register to comment.