# Simple phototransistor circuit to turn on P-channel MOSFET

I'm trying to fully understand how phototransistors work and was wondering if this circuit would work to turn on a P-channel MOSFET when the phototransistor isn't detecting light.

This is powered by a 3.7 V lithium battery and will be driving ~125 mA of LEDs for a night light.

Inspired by the circuit here.

Phototransistor - KDT00030ATR

P-channel MOSFET - NTA4151PT1G

• Look at the MOSFET's body diode – it's forward-biased already so even without any gate-drive signal the LED_PWR will be 3.7 minus one diode drop. Flip Q3 vertically (i.e. pin-3/S should connect to 3.7V and pin-2/D should connect to LED_PWR). Commented Nov 22, 2023 at 17:40
• The schematic in the question is wrong because regardless of the gate drive signal (light, in your case) your LEDs will be on (all the current will flow through the MOSFET's body diode). That's what I'm trying to say. First, correct the schematic by making the change I mentioned in my comment above. Commented Nov 22, 2023 at 17:46
• In this configuration the P-Channel will switch on when light strikes the photo-transistor. Is that what you want? The question seems to require the opposite function.
– Nedd
Commented Nov 22, 2023 at 18:11
• That is generally correct now, though you may need to increase the value of R18 depending on the amount of light and the gain of the photo-transistor. The gate needs to reach very close to the 3.7 V supply to fully turn off the p-channel MOSFET.
– Nedd
Commented Nov 22, 2023 at 18:18
• @tufelkinder Okay, but I think my question is, what happens when there IS a gate drive signal? ... I do not see those words in your post ... please update your post Commented Nov 22, 2023 at 18:18

The circuit looks correct in principle. But you missed some details:

simulate this circuit – Schematic created using CircuitLab

Your thinking is: When there's no light the Vgs of the MOSFET is -3.7 (the gate voltage is zero and the source voltage is 3.7V) which is sufficiently lower than the threshold (-0.5 ~ -1.2V). When the phototransistor gets light it'll draw current from 3V7 (sourcing towards R18), so the gate voltage will increase and finally turn the MOSFET off.

However, since the threshold voltage can be as high as -0.5V, the gate voltage (the voltage across R18) should approach 3.0 ~ 3.3V (or above) to turn the MOSFET off. So the light current should be at least 0.6 mA.

If you check the datasheet, you'll see the light current information:

The light sensor seems to be colour-sensitive: The light current is relatively small for cool/daylight white light (0.25 mA for cool/daylight white, 1 mA for warm white).

6500K 1000 lux: If you can't imagine what 1000 lux of light intensity is, here's a reference: A T35 35W 6500K fluorescent tube's luminous flux is about 3000 lumens. About 1.7 metres of distance, you'll get ~1000 lux:

$$I_V = \frac{\Phi_V}{d^2}=\frac{3000 \ \text{lm}}{2.89 \ \text{m}^2}\approx 1040 \ \text{lx}$$

Now let's take 0.22 mA as a reference.

Under 1000 lux of light intensity from a 6500K source, the voltage drop across R18 will be around Vg = 5k9 x 0.22m = 1.3V, making the Vgs of the MOSFET Vgs = 1.3 - 3.7 = -2.4V which is still more than enough to keep the MOSFET on because it's way beyond the threshold. So the MOSFET will NOT turn off.

To get 0.6 mA to turn the MOSFET off the light intensity should be around 2000 lux. For the same light source (6500K T35 35W fluorescent tube), the distance between the tube and the sensor should be no longer than 1.2 metres to turn the MOSFET off.

3500K 1000 lux: If your light source's CCT (colour temperature) is about 3000K (warm white e.g. ordinary incandescent bulb) then the light current at 1000 lux of light intensity (60W incandescent bulb, ~1 metre distance) will be around 1 mA. This will be enough to turn the MOSFET off because the voltage across R18 will hit 3.7V.

The requirement was at least 0.6 mA. To get 0.6 mA under a 3000K light source, the light intensity should be ~700 lux. For the same bulb (~900 lumens), the distance between the bulb and the sensor should be no longer than 1.1 metres to turn the MOSFET off.

As you can see, using the phototransistor with the configuration in your question appears to be light-dependent. To decrease the light dependency:

• Increase R18. This is the simplest solution. Take the dark current (leakage) and your light threshold into account, and select a high resistance so the MOSFET remains on under the dark.
• Use a current amplifier to drive the MOSFET (This configuration can be useful for low-light environments and higher source-sensor light angles):

simulate this circuit

• Yes: Increase R18 to 100K. As is Q1 and R18 act as a voltage divider which may result in a voltage at the gate just at the threshold or just above or just under, which is bad. Commented Nov 23, 2023 at 13:55

An alternative solution is to put a Schmitt trigger in series between the photodiode and the gate. It will gives a perfectly contrasted signal instead of fluctuating and unpredictable voltages.

The only minus is that it will trigger only when there is a lot of light and turn off when it's perfectly dark. That will depends much on the photodiode exposition to light.

simulate this circuit – Schematic created using CircuitLab