Electronic – Why won’t the phototransistor interrupt the microcontroller

gpiogpio-external-interruptinterruptsmicrocontrollerphototransistor

I bought a couple of phototransistors. They all have one lead shorter than the other. I assume that, like normal diodes, this means that the longer lead goes to V+ and the short end goes to GND.

I set the phototransistor up like so:

Pull Down Circuit

I put the output line into my interrupt pin on my microcontroller. When I shine a bright light on the phototransistor, the microcontroller doesn't interrupt.

BUT!!

When I put the same output into my ADC my microcontroller says it reads 5V with the light shining on the phototransistor. It also reads 0.8V when the phototransistor is covered.

Why would a multimeter and ADC read the output as Low/High but it won't trigger an interrupt on my microcontroller. (I know the problem isn't the code because I can take a straight wire from 3.3V to the interrupt pin and it will interrupt.)

EDIT

The logic level is 5V. I put the output pin to a green LED which then goes to ground. When I shine the light on the phototransistor, the green LED lights up. So I'm confident I have enough current.

I want it to trigger when light shines on it and pulls the pin high.

SOLUTION

I had two problems here that combined into a really annoying problem. The first problem was the one stated above. The other problem was that there wasn't enough current flow. I solved both problems by stacking four phototransistors in parallel in a pullup configurations and reversing the leads.

Thanks to Nedd for the suggestion to switch from pulldown to pullup. That made them much more sensitive. I also realized I had my phototransistors pointing the wrong direction.

For this reason I've marked Nedd's answer as the most correct.

I know my solution is not ideal. It's pretty hackish, which is why I didn't answer my own question and mark it as correct. In the future I will probably opt for a different solution, such as the TI OPT-101.

Best Answer

The residual 0.8v shows that the photo transistor has current leakage even when dark. Using a lower value Re may help. Better yet, reverse the positions of the resistor and photo transistor, then detect a low going signal when shining the light, (a higher value resistor could be used in this case)..

Related Topic