Shop OBEX P1 Docs P2 Docs Learn Events
Optical Switch — Parallax Forums

Optical Switch

ArchiverArchiver Posts: 46,084
edited 2000-09-02 19:22 in General Discussion
I ordered an optical switch from all electronics (www.allelectronic.com)
catalog number: OSU-35

I thought it would come with some sort of data sheet but it didn't. Since
I'm new to electronics, I have no idea how to hook it up. I have attached a
drawing of the part. It is U shaped and at the top of eash side it has a
scematic symbol. I'm still learning how to read scematics, so I'm not
exactly sure what they are or how to hook them up. One of them is an LED
(I'm pretty sure) and I know how to hook that to a stamp. But the other one
I'm not sure of. If someone could tell me how to hook this up, I would
greatly appreciate it. And it would be helpful if someone could give me a
code example. I don't know if this will cause a pin to be high/low and I
should check it that way. Or if it is an RC circuit and I have to use
RCtime.

I hope this works the way I'm thinking. Here is what I think will happen:
I turn on the LED side to activate the switch. When something passes
between the two posts it will activate the other side. Sort of a small
compact "electric eye" Is this correct?

Thanks in advance,
Shawn

PS I should mention that I'm using a Basic Stamp II.

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2000-09-02 19:22
    You are right that one side is an LED, the other side is a phototransistor.
    To hook the
    device up to a stamp:

    1) Attach the emitter (leg with the arrowhead) to ground.
    2) Attach a pullup resistor (about 10K ohms) between the collector (the
    other leg) and +5V.
    3) Also attach the collector to a stamp pin.
    4) Drive the LED through a resistor from +5V or a stamp pin.

    When there is nothing blocking the light path from the LED to the
    phototransistor, the transistor will be turned on causing its collector to
    be pulled to ground, i.e. a low input to the stamp. When you block the
    light path the transistor will turn off causing the collector and the stamp
    pin to be pulled to +5V.

    As far as code is concerned think of this as you would any other switch.

    Hope this helps,
    Bob Baxter
    At 12:42 PM 9/2/00 -0500, you wrote:
    >
    >I ordered an optical switch from all electronics (www.allelectronic.com)
    >catalog number: OSU-35
    >
    >I thought it would come with some sort of data sheet but it didn't. Since
    >I'm new to electronics, I have no idea how to hook it up. I have attached a
    >drawing of the part. It is U shaped and at the top of eash side it has a
    >scematic symbol. I'm still learning how to read scematics, so I'm not
    >exactly sure what they are or how to hook them up. One of them is an LED
    >(I'm pretty sure) and I know how to hook that to a stamp. But the other one
    >I'm not sure of. If someone could tell me how to hook this up, I would
    >greatly appreciate it. And it would be helpful if someone could give me a
    >code example. I don't know if this will cause a pin to be high/low and I
    >should check it that way. Or if it is an RC circuit and I have to use
    >RCtime.
    >
    >I hope this works the way I'm thinking. Here is what I think will happen:
    >I turn on the LED side to activate the switch. When something passes
    >between the two posts it will activate the other side. Sort of a small
    >compact "electric eye" Is this correct?
    >
    >Thanks in advance,
    >Shawn
    >
    >PS I should mention that I'm using a Basic Stamp II.
    >
    >
    >
    >
    >Attachment Converted: "c:\eudora\attach\OpticalSwitch.jpg"
    >
Sign In or Register to comment.