Shop OBEX P1 Docs P2 Docs Learn Events
Playing with light sensors out of an old mouse — Parallax Forums

Playing with light sensors out of an old mouse

Thomas FletcherThomas Fletcher Posts: 91
edited 2009-09-01 20:58 in Propeller 1
I ripped out two what I believe to be light sensors and infrared leds from an old computer mouse. I have used the light sensor from parallax but this one only has two pins. I tried hooking it to a propeller pin as an input and the other pin to ground, but the pin keeps alternating 1 to 0 no matter its light exposure.

   dira[noparse][[/noparse]24]~ 
   repeat
       lighton := ina[noparse][[/noparse]24]



Tried this code with nothing attached to the pin and have tried several pins. Each time the variable lighton just keeps alternating 1 to 0.

I am wondering if I have blown something or if I am not understanding the code.

Comments

  • Agent420Agent420 Posts: 439
    edited 2009-09-01 17:21
    I've hacked many mice for their encoders - mice are like a grab-bag of hacker parts ;-)

    Most mice use photodetectors that require a pullup resistor, and they will conduct when exposed, pulling the signal to ground (1=no light, 0 = light).· They are polarity sensitive, but probably won't be damaged if hooked up backwards.· However, they may be burned out if you powered them without the resistor - likewise the led's.

    Scroll down a bit to the schematic on this page for an idea.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • Thomas FletcherThomas Fletcher Posts: 91
    edited 2009-09-01 17:35
    Thank you very much. I am getting it to stay on 0 when exposed to light, but it still wants to skip back and forth in the dark.

    I haven't even tried the emitter yet, still not sure why it has three pins.
  • Agent420Agent420 Posts: 439
    edited 2009-09-01 17:43
    Not to sound silly, but you are shure you have not mistaken the led and detector?· I've seen both 2 & 3 terminal detectors, but a 3 terminal ir led seems a bit odd.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • Thomas FletcherThomas Fletcher Posts: 91
    edited 2009-09-01 17:49
    It is possible. The one I am thinking is the detector is two pins, flat clear plastic with metal plates similar to an led. The other is three pins and dark plastic. Larger but still a flat square shape.
  • LeonLeon Posts: 7,620
    edited 2009-09-01 17:56
    The detector is the one with three pins. It's probably a photo-transistor - it should be easy to identify the connections with a DVM.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • Thomas FletcherThomas Fletcher Posts: 91
    edited 2009-09-01 17:58
    Three pins. Is it ground/power/output?
  • Agent420Agent420 Posts: 439
    edited 2009-09-01 17:59
    Examine the board where they were placed and trace the leads...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • LeonLeon Posts: 7,620
    edited 2009-09-01 20:22
    If it's a photo-transistor the pins will be base, emitter and collector. The base connection isn't usually used.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • Brad_HBrad_H Posts: 35
    edited 2009-09-01 20:58
    Hi Thomas,

    I believe the 3 pin one is the detectorS, you need 2 per axis so you know which direction you are moving.
Sign In or Register to comment.