1
\$\begingroup\$

I’m currently making a board that needs to drive an external 20 mA red LED using a 1.8V GPIO pin. The LED is mounted on an separate board with a resistor as seen in the diagram. My board is supplied with 3.3V from this separate board.

schematic

simulate this circuit – Schematic created using CircuitLab

Can this be done with 1 or 2 transistors? I know that I need to step up the GPIO voltage seeing as the LED has a forward voltage of around 1.8-2V, but I am unsure of how to go about it. Most examples I have been able to find have a transistor on the cathode side of the LED as opposed to this setup, e.g. this post How to blink LED with 1.8V?

\$\endgroup\$
3
  • \$\begingroup\$ If the LED has higher Vf than your Vcc, there will be little to no light. \$\endgroup\$
    – winny
    Jun 2, 2023 at 12:21
  • \$\begingroup\$ The one-transistor circuit will be fine, you just need to invert (in software) the signal coming out of the MCU. (And the 3.3 V rail is shorted to ground in the diagram on the right in the question.) Is the start-up state of the LED important until the MCU has initialized? \$\endgroup\$ Jun 2, 2023 at 12:29
  • \$\begingroup\$ have you tried directly running the LED from the GPIO? it should work just fine, though it won't reach it's 20ma brightness that Vf is specified at. The LED's V-vs-I curve means that you'll likely draw between 1-10ma. It's not a cliff, so if you source under but close to Vf, then there's some wiggle room to non-specifically illuminate the LED. \$\endgroup\$
    – dandavis
    Jun 2, 2023 at 19:42

1 Answer 1

2
\$\begingroup\$

If you don't have headroom between VF,max of your LED to your supply, there will be problems as one batch of boards will have (some) light (lucky low VF batch) and other none (unlucky high VF batch) despite everything working.

Since you seem to have access to 3.3 V as well, I propose to do the following:

schematic

simulate this circuit – Schematic created using CircuitLab

Your M1 MOSFET (N-FET) needs to have <1.8 V Vgth and M2 (P-FET) needs <3.3 V Vgsth.

Alternatively, if your MCU has some output current from its GPIO pins, use an NPN transistor:

schematic

simulate this circuit

Q1 could be just about any NPN. M2 (P-FET) needs to have <3.3 V Vgsth.

\$\endgroup\$
5
  • \$\begingroup\$ The resistor and LED are fixed on a seperate board with the cathode going to ground, and I can only connect to the resistor side (marked EXT.), like in the right side of my diagram. Could I still use a MOSFET to connect to the resistor side of the LED? \$\endgroup\$
    – question
    Jun 2, 2023 at 12:59
  • \$\begingroup\$ Oh, then you need to switch on the high side. Let me modify the schematic for you. \$\endgroup\$
    – winny
    Jun 2, 2023 at 13:14
  • \$\begingroup\$ Thanks, that's exactly what I was looking for. The GPIO doesn't have much output current, so I think the two FETs will be the best solution. How would I go about calculating the required GPIO current for that setup? \$\endgroup\$
    – question
    Jun 2, 2023 at 13:38
  • \$\begingroup\$ (Vcc/R3)/hfe. If you can tolerate slot turn-off, just increase R3 to very high and choose a small signal NPN with high hfe/beta. Adjust your R2 resistor to match. \$\endgroup\$
    – winny
    Jun 2, 2023 at 13:46
  • 1
    \$\begingroup\$ It might be worthwhile to search MCU's data sheet to see if 1.8V_GPIO is 3.3V-tolerant. If so, then a logic-level PMOS will suffice, along with a pullup resistor. \$\endgroup\$
    – glen_geek
    Jun 2, 2023 at 14:20

Your Answer

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

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