Shop OBEX P1 Docs P2 Docs Learn Events
Opb706a — Parallax Forums

Opb706a

glasoglaso Posts: 38
edited 2004-11-04 16:56 in Robotics
I've recently bought two OPB706A reflective sensors to make a wheel encoder for a robot. I'm using a BS2 as microcontroller, but i'm not sure how to connect the sensor to the stamp.
The sensor consists in an IR diode (1,7 V) and an NPN transistor bundled together. My question is about the resistors to connect the diode (and how to determine it's value).

Also I need to know if I need to connect the diodes to the BS2 I/O pins or just to the power source (with the apropiate resistors, of course). I think that I can leave the diodes always on, and connect only the transistors to the BS2 pins to get the input from the wheels. Is that correct?

Here is a datasheet of the sensor:

http://www.alldatasheet.co.kr/datasheet-pdf/pdf_kor/QT/OPB706A.html

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-10-22 13:57
    Yes, you'll need to treat the IR LED like any other LED. If, for example, you want to run 10 mA through it you calculation would be:

    (5 - 1.7) / 0.01 = 330 ohms

    Connect the resistor to a pin and turn it on only when you actually need to look at the device; this will save current consumption on your robot.


    For the output you'll want to connect the emitter to ground and pull the collector high through a 10K resistor. Connect the collector to another pin and monitor the output in a test setting. Here's the rub: You're probably going to get a variable voltage out of the collector based on the reflectivity of your targe. You can deal with this through a comparitor (which will let you set the sensitivity of the detector).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • glasoglaso Posts: 38
    edited 2004-11-04 16:17
    How can I use the comparitor to adjust the sensivity of the detector. Actually I use a 100k potentiometer instead os the 10k resistor to pull the collector high. If I change the resistance with the potentiometer, I change the sensivity of the detector.

    thank you!
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-11-04 16:56
    That's one way of doing it, but may not be as clean as what you need to have happen is for the junction (collector - pull-up) voltage to change relative to the input threshold of the BASIC Stamp.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
Sign In or Register to comment.