Initially I thought this would be a pretty simple problem, but I'm just getting started learning electronics so I would love some assistance.

This is my circuit: circuit

I calculated the values based off this calculator: http://www.daycounter.com/Calculators/Transistor-Switch-Saturation-Calculator.phtml

This the photdiode I am using

Basically I want to detect when the light is on, I have a visible light photodiode, and when it is on, I want it to send a HIGH signal.

Maybe I am naive, but I thought the transistor would be "ON" or "OFF", but I'm reading 1.4V at the output. I am not sure why this is, maybe to do with such a low Rc resistor value, but the reason why I chose that is because of the calculator, I didn't want a too high base resistor because otherwise it would be a too high threshold to switch. But in any case, it doesn't detect the light very well so I'd really like to understand what's going on before I just try some random values.

EDIT: Thinking about this some more, doesn't the photodiode generate current, so if I change the circuit to be like this.... random values chosen because I haven't calculated it. Would this work? It didn't when I just tried, though I'm not sure what values I need. Am I totally wrong here?

Also to clarify, the long leg of the photodiode is the end with the higher voltage?

circuit 2

  • \$\begingroup\$ Can you provide the part number/datasheet for the photodiode that you're using? It would help a lot in figuring out what's happening. \$\endgroup\$
    – justinrjy
    May 8, 2015 at 6:34
  • \$\begingroup\$ Here is a link to it. The datasheet link doesn't seem to go anywhere. THanks! au.rs-online.com/web/p/photodiodes/6548154/… \$\endgroup\$
    – areth
    May 8, 2015 at 6:48
  • \$\begingroup\$ Take a look at buildcircuit.com/… experiment 3 \$\endgroup\$ May 8, 2015 at 9:41

2 Answers 2


I believe the polarity of your photodiode is incorrect. Typically, you want to use a photodiode in photoconductive mode with a BJT, which means that the photodiode should have an external reverse bias. Increased optical power causes a linear increase in reverse current through the device. This reverse current can then be amplified by the BJT transistor. Also note that increased photocurrent will cause the output voltage to decrease in this case, since the current and thus the voltage drop across the 100 Ohm resistor will increase. This is an easy fix if undesirable, another transistor or inverter can be used to reverse the polarity, or it can be reversed in software if you are going into a microcontroller.

EDIT: Your circuit is still not correct, try this instead. Note that R2 is not strictly required, but should be inserted to limit base current in case you have D1 backwards.


simulate this circuit – Schematic created using CircuitLab

  • \$\begingroup\$ Okay, thanks for that! I switch the polarity of the photodiode and now it's reading HIGH at the output, which is good. Although that means there is no base current right? I dropped that base resistor value to 100 ohm because even in darkness the transistor was not switching, but even now it's still not switching. So this doesn't seem to be working how I'd like. Can you provide any insight? I'm just getting started with this stuff so I really appreciate your help! :) \$\endgroup\$
    – areth
    May 8, 2015 at 7:30

As said by Zuofu the polarity is incorrect shown in your diagram. Also the collector resistor is too low in the first diagram.

Consider the photocurrent stated in the data sheet. It's 80uA for a light of 1000 lux. This means for 1000 lux (not too bright but not dull either) there is 80uA going into the transistor base. The transistor will have (say) a current gain of 100 and this lux will cause (approximately) 8mA to flow in the collector.

With a resistance of 100 ohms for R2 the collector voltage will drop from 5V to about 4.2 volts with a 1000 lux and this cannot be regarded as switching.

Unknowns - what light level are you using and how much do you expect the transistor to switch? If you expect it to switch to 0V you are going to be dissapointed because as the BJT approaches saturation, the current gain might reduce to only 20 thus causing collector current to decrease for the same light level.

Try increasing R2 to 1kohm is my suggestion.

  • \$\begingroup\$ I would like to switch it to 0V (or close to). I want to tell digitally in a microcontroller if the light is "ON" or "OFF". I'm using a teensy 3.1 (which is 5V tolerant) for this, though I have no idea what the threshold voltage would be on it's digital input pins. Could you possibly comment on my second diagram? I took the resistor R1 out completely, and made R2 100k and it seems to work fairly well. \$\endgroup\$
    – areth
    May 8, 2015 at 9:19
  • \$\begingroup\$ 0V threshold will be stated in the data sheet but getting below 0.5 volts would probably be OK. \$\endgroup\$
    – Andy aka
    May 8, 2015 at 9:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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