3
\$\begingroup\$

I'm trying to get an ATtiny26l MCU to detect a very short signal produced by a IR led + detector couple (I don't know if it's a photodiode or a phototransistor buit i think it's a diode) and the setup works if i let something fall through the couple or block it by hand but when i try to detect a fast moving object (a flying airsoft BB) i'm not getting any response. The time the IR detector is obscured is around 78μs. I'm not sure if the response failure is caused by the detector not having fast enough response time or the MCU not detecting the produced signal, but since the MCU is detecting it using a edge triggered interrupt and i also tried to check for the signal state on it's each cycle at 1 MHz i'd say it's the first option. Also is it possible for the detector to increase it's reaction time let's say in case of overload or damage?

EDIT: I also have a BJT PNP transistor invering the sensor's output (which is high at negative result and low at positive result). Could this be the problem?

\$\endgroup\$
2
  • 4
    \$\begingroup\$ We love schematics. Hit Ctrl-M in the editor. \$\endgroup\$
    – Transistor
    Apr 10, 2016 at 15:20
  • 1
    \$\begingroup\$ You'd have to look at the detector output with an oscilloscope. \$\endgroup\$
    – CL.
    Apr 10, 2016 at 18:36

2 Answers 2

2
\$\begingroup\$

If you cannot test as arielCo suggests, (or even if you can) you should look at the specs for your device. If you search digikey for optical sensors - transistor output the candidates will have response times listed from 20 nsec to 1 msec. If you search for optical sensors - photodiodes the listed response times range from 30 psec to 2 msec.

Turn off when you block the light will be slower than turn on, and won't really start until the light is completely blocked.

\$\endgroup\$
1
\$\begingroup\$

First check that the pellet blocks enough light at the distance it passes. Disregard if it's one of those "slot" type switches.

To really test the photodetector, drive your IR LED with a square wave or pulse train, and reduce the off time until the detector stops working. But use a scope, a frequency meter or an astable (the first would be optimal) to "see" the detector's output, in case there's something wrong with your MCU routine.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.