I am designing a 5V board and i need to read two outputs from the lithium charger using the 3V3-only uP GPIO, while also using them the same output pins to drive user LEDs; charger outputs are either GND or Hi-Z.
While trying to come up with a solution that ticks most boxes (all round optimal for cost, size, footprint, but not best in any regards) i came up with this:
R_LED and G_LED nodes are the charger outputs.
I used these P-mosfets because i already have pleny on the board, thus avoiding an extra part in the BOM.

battery charger IC
P channel MOSFET
LED to drive
Zener diode

My reasoning:
Zener datasheet states PD max = 500 mW: at Zener voltage of 1.8 V that translates to I max of 277 mA; so i think i can pull 20 mA for each led without issues.
When both input nodes are Hi-Z, zener will drop 1.8V allowing 320 uA to flow through R98, creating a 3.2 V reference for the High state of the 3V3 uP GPIO input (although GPIOs will be connected to this reference voltage via R93 and R94, which concerns me).
When either input node transitions from Hi-Z to GND, uP GPIO which is tied to directly will move from 3.2 V to GND; also, the mosfets will start conducting, turning on the LED.

The questions:
Am i correct in assuming that this will work?
Is there a better way to achieve the same?

  • \$\begingroup\$ Don't you have the 3.3 V from the µC? \$\endgroup\$
    – CL.
    Aug 7, 2020 at 10:38
  • \$\begingroup\$ @CL.i do, but the charger IC needs to drive the LEDs even when the µP is off (NXP i.MX6 with embedded Linux) to tell the user battery charging/charge finished, and when µP is off so are its 1V8 and 3V3 regulators \$\endgroup\$
    – Jack
    Aug 7, 2020 at 11:19

2 Answers 2


Low-voltage Zeners have lousy characteristics:

MMSZ4678 VZ vs. IZ

I would replace the MMSZ4678 with an adjustable shunt regulator like the TLV431/TLVH431/AZ431L, or just use an LDO.

And connecting the GPIO to 3.3 V might be able to power up the µC, or, if the voltage falls low enough, to switch on the MOSFETs.

The x_LED outputs of the charger are designed to drive LEDs directly (10 mA is more than enough), so the simplest circuit actually does this.

To get a 3.3 V signal for the µC, use this level shifter, which is commonly used for slow open-drain signals like I²C:


simulate this circuit – Schematic created using CircuitLab

This requires one low-voltage N-channel MOSFET per signal.

When the 3.3 V supply is switched off, the MOSFET is also switched off, and the LED state does not affect the GPIO.

  • \$\begingroup\$ I don't understand: suppose µP is on and 3V3 is present, i see how it works if X_LED is Hi-Z, as LED is not grounded and GPIO is pulled up to 3V3; but if X_LED is low (GND), then VDrain is 0V, but VGate is tied to 3V3 (so it will always be VGS > Vth), what will make VSource go low? \$\endgroup\$
    – Jack
    Aug 7, 2020 at 13:21
  • \$\begingroup\$ X_LED will pull the source to about 0.7 V through the body diode; when this happens, the MOSFET switches on, and the source is pulled to 0 V. (You could exchange source and drain in this circuit, it's bidirectional.) \$\endgroup\$
    – CL.
    Aug 7, 2020 at 13:25
  • \$\begingroup\$ I'm going to accept this as answer because it solves my problem with the least amount of components, although @Spehro Pefhany's answer provides a great insight on digital I/O stages. I'm going to recycle the DMN3731U already used elsewhere on the board: it has slightly different caratheristics (Vth, body diode forward voltage, RDS(ON), gate protection diode), do you think it will work the same? \$\endgroup\$
    – Jack
    Aug 7, 2020 at 14:16
  • \$\begingroup\$ What matters is that it switches on (has an RDS(ON) specification) at a low enough voltage; 1.8 V is more than enough. \$\endgroup\$
    – CL.
    Aug 7, 2020 at 14:22

The voltage after the zener will be very variable with current so you won't get anything like 20mA (which might be a good thing for LED life depending on the copper attached to LED, but by design is better) and one LED brightness will likely drop significantly if the second LED comes on.

It's not entirely clear from the zener datasheet even what the typical variation will be. Figure 8 in the zener datasheet seems to assume Izt of about 2mA rather than the 50uA stated. Making some guesses maybe the dynamic resistance is in the 50 ohm range at 20mA (the highest current shown, a bit ominously for your 20mA application), which is in the same range as one of your LED series resistors.

enter image description here

There are many small LDO regulators that would provide more predictable performance than the zener if you chose to go that way. They would need at least an output capacitor (for stability from oscillation) and maybe an input capacitor, so the parts count would be similar.

Note: If the MCU power is off, the current through your 10K pullup resistors will get diverted so the MOSFET gates will be pulled down to about 0.7V above MCU Vdd (via the protection network in the MCU) unless the MCU has an input structure that allows inputs above Vdd (perhaps 5V tolerant inputs- but then you would not need this circuit at all!) so the LEDs will probably turn on partially (or the MCU will get powered partially and may not reset adequately).

Also the MOSFETs are not specified with -3.3V drive (and they'll get even less as that zener drops more and more voltage).

This is "just" an LED drive circuit so if it puts out 1/4 the LED current and the brightness varies with the number of LEDs it won't likely be the end of the world, but the MCU without power is a significant issue.

Maybe something like this (x2):


simulate this circuit – Schematic created using CircuitLab

You can eliminate the p-channel MOSFET if you reduce the LED current to something reasonable like 8mA:

The parallel 10K is because the LED drops some voltage, but there's enough for the 2N7000 gate, eventually.


simulate this circuit

Edit: As far as the GPIO limits you'd have to consult the MCU datasheet and schematic of the board to be sure. Here's a typical Cortex A7 datasheet from NXP with GPIO parameters, and they are as I expected:

enter image description here

Since you are told not to exceed the Vdd (which could be 0V with power off) by more than 300mV, there is a diode protection network internal to the chip from the input to Vdd (in order to protect the gate oxide at the input from ESD).

If you violate that rule by applying more a few hundred mV with power off, then current will flow from the input to the Vdd rail. This is not a proper mode of operation and other side effects may occur, including permanent damage to the chip, if there is enough current available.

  • \$\begingroup\$ I thought about doubling led resistance, but since abs. max. rating is 30mA, i assumed 20mA would be a good compromise bewteen luminance and current; as also pointed out by CL., charger IC is perfectly capable of sinking currents up to 10mA. Also, it seems only one LED would be active at any given time. As for the µP (NXP i.MX6UL): you're right, i did not consider it would sink when switched off, but i don't understand the part "pulled down to [...] 0.7V above MCU Vdd"; could you provide a link to a sample of the protection network you mention? \$\endgroup\$
    – Jack
    Aug 7, 2020 at 12:46
  • 1
    \$\begingroup\$ See edit. The actual network (simplified) typically looks something like this \$\endgroup\$ Aug 7, 2020 at 13:11

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.