Shop OBEX P1 Docs P2 Docs Learn Events
IR opto switch and propeller — Parallax Forums

IR opto switch and propeller

Brian CarpenterBrian Carpenter Posts: 728
edited 2010-07-12 01:14 in Propeller 1
I have a micro ir opto switch that i want to use for a position sensor with my propeller project. I thought this would be an easy solution but it is proving not so. Attached is the schematic of the device.
My plan was to monitor it with waitpeq command. However, i did not realize that i would not get a square signal as i turn the encoder. i have tested by connecting an LED to the output and as i turn the wheel, it goes from of to dim to bright and back to dim and them off. what external hardware or software do i need to create a square (on-off) signal from this device?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


It's Only A Stupid Question If You Have Not Googled It First!!
173 x 317 - 4K

Comments

  • mparkmpark Posts: 1,305
    edited 2010-07-08 06:06
    One solution would be a Schmitt trigger. Check out this thread for a clever implementation by PhiPi: http://forums.parallax.com/showthread.php?p=688624
  • LeonLeon Posts: 7,620
    edited 2010-07-08 08:14
    I had to use a Schmitt to get a clean signal, when I used one for speed control some years ago.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Leon Heller
    Amateur radio callsign: G1HSM
  • Brian CarpenterBrian Carpenter Posts: 728
    edited 2010-07-11 16:13
    I have read the wiki about Schmitt triggers. So how do i select one and how do i implement it. I have tested my opto switch and this is what i am noticing. When reading the white area of my wheel, i am getting just at 3 volts. maybe 3.03v. and in the black area i am getting 2.5v Not much of a swing. Can i make this work with a schmitt trigger?
    I was thinking that i would get a lower voltage on the white area. Maybe i need to try a different type of paper. I am open to all suggestions.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    It's Only A Stupid Question If You Have Not Googled It First!!
    717 x 480 - 78K
    717 x 480 - 53K
    717 x 480 - 80K
  • LeonLeon Posts: 7,620
    edited 2010-07-11 16:19
    Try a 74HC14:

    www.nxp.com/documents/data_sheet/74HC_HCT14.pdf

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Leon Heller
    Amateur radio callsign: G1HSM
  • Brian CarpenterBrian Carpenter Posts: 728
    edited 2010-07-11 16:19
    Leon,
    will that voltage range be acceptable?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    It's Only A Stupid Question If You Have Not Googled It First!!
  • LeonLeon Posts: 7,620
    edited 2010-07-11 16:46
    Maybe not, you need to check the transfer characteristics in the data sheet. You might not have enough difference in IR reflectance between the light and dark areas. I've usually used a slotted disk and an emitter/sensor pair on either side, but I think I once tried reflective tape with your arrangement, and it worked very well.

    You could always design your own Schmitt using an op amp, or a comparator chip. I've done that in the past, as well.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Leon Heller
    Amateur radio callsign: G1HSM

    Post Edited (Leon) : 7/11/2010 5:04:15 PM GMT
  • kwinnkwinn Posts: 8,697
    edited 2010-07-12 01:14
    A 555/6 timer can also be used as a schmitt trigger if you need only one or two.
Sign In or Register to comment.