Shop OBEX P1 Docs P2 Docs Learn Events
Sharp Digital IR Sensors GP2D15 — Parallax Forums

Sharp Digital IR Sensors GP2D15

Scott PortocarreroScott Portocarrero Posts: 72
edited 2009-08-26 00:15 in BASIC Stamp
Yo Yo Yo

I accidentally bought a digital sharp GP2D15 and it only has three leads coming out! Anybody have experience (code) for this sensor for the BS2

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-08-20 05:02
    Read the datasheet for the device (do a websearch ... it's there). It just provides a logic high / low output (with a pullup). It works like a switch to ground with a pullup like shown in "What's a Microcontroller?". The datasheet shows the fixed distance where it goes from high to low and back again. Two of the leads are just +5V and ground.
  • Scott PortocarreroScott Portocarrero Posts: 72
    edited 2009-08-20 05:18
    Hi Mike thanks for the reply

    I will try that
  • PrettybirdPrettybird Posts: 269
    edited 2009-08-20 07:11
    ·· I happened to use sharp sensors for my mini monster boe bot (completed projects). They are analog output so you may have to convert them. They work great. I used a simple circuit using a LM 339 comparitor ic with a an ajustable input pot to ajust input trigger level. It put out a simple TTL hi low output. The range can be ajustable. I have seen them also use an ADC 0831 8 bit analog to digital convertor chip. The compatitor circiit is in the top left of my Boe bot accessory sketch and the adc convertor is includded in attachments below. Crustcrawlwer has some imfo on using the adc chip in their shareware programs.
    3072 x 2304 - 1M
    494 x 440 - 6K
  • Scott PortocarreroScott Portocarrero Posts: 72
    edited 2009-08-21 04:44
    Hey Bird

    I am using the D15s not the D12s. The D12 is the same but analog the D15 are digital.

    Thanks for the reply
  • Scott PortocarreroScott Portocarrero Posts: 72
    edited 2009-08-24 01:36
    I guess what my question is:

    How do I interface this sensor (which is digital) with the BS2. I have three wires Vcc-5v positive, ground, and Vout. I am using a pull up resistor between Vcc and Vout. I am using pin 15 as my input. I am trying to program it just like the BoeBot IR emitter/receiver but using this sensor instead of a emitter on one pin and a receiver on another pin.
  • FranklinFranklin Posts: 4,747
    edited 2009-08-24 01:46
    Here's the datasheet.www.acroname.com/robotics/parts/SharpGP2D12-15.pdf the output goes high when an object is detected within 10cm of the sensor.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • Scott PortocarreroScott Portocarrero Posts: 72
    edited 2009-08-24 02:16
    I wrote a little program to see if that works and it always stays high
  • Scott PortocarreroScott Portocarrero Posts: 72
    edited 2009-08-24 02:16
    do you have a test program suggestion
  • Mike GreenMike Green Posts: 23,101
    edited 2009-08-24 03:03
    Post your schematic and your test program (as attachments to a message).
  • Scott PortocarreroScott Portocarrero Posts: 72
    edited 2009-08-25 03:27
    Mike I have no way of getting a schematic to you. I hooked it up exactly the way it says in the documentation with a 10k pull-up resistor. As for programming here it is
  • Mike GreenMike Green Posts: 23,101
    edited 2009-08-25 04:13
    You're certainly right about the test program being simple. It should work. The only thing I can imagine is that the sensor is connected wrong (like maybe the pins are backwards).
  • Scott PortocarreroScott Portocarrero Posts: 72
    edited 2009-08-26 00:01
    thanks Mike I had the Vout and Vcc pins backwards on the molex connector
  • Mike GreenMike Green Posts: 23,101
    edited 2009-08-26 00:15
    It's amazing how often that happens.
Sign In or Register to comment.