Shop OBEX P1 Docs P2 Docs Learn Events
Fairchild semi H21A — Parallax Forums

Fairchild semi H21A

jeromelabjeromelab Posts: 31
edited 2006-05-19 11:14 in BASIC Stamp
Has anyone developped code for the Fairchild semi H21A PHOTOTRANSISTOR OPTICAL INTERRUPTER SWITCH with a BS2? Just wanting to know if it is a good choice forr wheel/turn encoder.

Thanks

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-05-16 14:10
    What are the electrical specifications of the switch?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • jeromelabjeromelab Posts: 31
    edited 2006-05-16 14:35
    The complete datasheet is here:

    www.fairchildsemi.com/ds/H2/H21A1.pdf

    Inshort it's a 4 pins sensor, pins 2 and 4 are ground, pin 1 is input +6 V DC and pin 3 is output 0-6 V DC if I am not wrong.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-05-16 14:56
    Whoa!· 6V!· No, that is the reverse voltage...The forward voltage is 1.7V!· Essentially this is an LED and a phototransistor.· This would be simple to connect.· The LED handles 60mA of forward current, so from that we can deduce that if you're running this from a 5V supply you would need a 55 ohm resistor in series with the LED side.· On the transistor side connect the emitter to ground and connect the collector through a 10K resistor to Vdd (5V).· Also connect that pin through a 220 ohm resistor to an I/O pin on the BASIC Stamp.· Now you can read a LOW when there is nothing interrupting the beam and a HIGH when something is.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • jeromelabjeromelab Posts: 31
    edited 2006-05-17 11:24
    Thanks a lot !
  • jeromelabjeromelab Posts: 31
    edited 2006-05-18 15:20
    Just a quick note, without the 220ohm in between the basic stamp pin and the sensor's collector it works, with it it doesn't.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-05-18 15:33
    Are you sure you were using 220 ohm and not a higher value?· There's really no reason it shouldn't work with it, however that resistor isn't required, it is there to protect the I/O pin on the Stamp Module in case you accidentally make it an output.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-05-18 15:46
    Attached is a schematic (based on the part diagram from the datasheet) that should work perfectly.· The LED Ground and the transistor ground do not need to be common, however the transistor ground needs to be common with the BASIC Stamp ground.· 220 ohm resistor should be red, red, brown, gold.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
    617 x 442 - 19K
  • jeromelabjeromelab Posts: 31
    edited 2006-05-19 11:14
    Thanks! I replaced the 220 ohm resistor with another one and it works.
Sign In or Register to comment.