PDA

View Full Version : Fairchild semi H21A



jeromelab
05-16-2006, 07:17 PM
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

Chris Savage
05-16-2006, 10:10 PM
What are the electrical specifications of the switch?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com (mailto:csavage@parallax.com)

jeromelab
05-16-2006, 10:35 PM
The complete datasheet is here:

www.fairchildsemi.com/ds/H2/H21A1.pdf (http://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 Savage
05-16-2006, 10:56 PM
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 (mailto:csavage@parallax.com)

jeromelab
05-17-2006, 07:24 PM
Thanks a lot !

jeromelab
05-18-2006, 11:20 PM
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 Savage
05-18-2006, 11:33 PM
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 (mailto:csavage@parallax.com)

Chris Savage
05-18-2006, 11:46 PM
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 (mailto:csavage@parallax.com)

jeromelab
05-19-2006, 07:14 PM
Thanks! I replaced the 220 ohm resistor with another one and it works.