3
\$\begingroup\$

Full schematic is at https://cdn.hackaday.io/files/1667667134916544/Evil%20Simon%20v1_3_1.pdf

This system has a pair of AA batteries, a P MOSFET for soft power and a boost converter to make 3.3v. The problem is that with the system ostensibly "off" the gate of the MOSFET is still being pulled down by... something... Presumably the microcontroller. It's enough that the gate is something like 2.1v even if the pull-up resistor is reduced to 1 kΩ.

The microcontroller's BOD has been programmed to hit at 2.7v (which is the minimum safe supply voltage for it's clock speed), so you'd think that it would be held in RESET if it had enough juice to even notice.

When the firmware starts (after someone presses one of the buttons, which causes the power MOSFET gate to be brought low), that pin is immediately brought low and held there until it's time to power off, whereupon it is made hi-Z (by turning it into an input). None of the pull-up or pull-down options are selected for that pin.

So if that pin is leaking, what's there to do? The smaller I make the power MOSFET's gate pull-up, the more power it's going to waste when turned on. What else might I try? I'm tempted to use a BJT in front of the MOSFET so that some sort of current flow (presumably leakage wouldn't be enough) would be required to positively turn on the power MOSFET, but I'd like an actual plan before I spin another board.

\$\endgroup\$
5
  • 2
    \$\begingroup\$ This has been covered a number of times here before. The simple fact is that you need a switch with at least two active elements, not just one, because an inverting switch will inevitably partially re-power your circuit through the keeper resistor and protection diodes. You need a non-inverting switch (ie, high input to enable a high side switch) and that requires two transistors/fets, not one. \$\endgroup\$ – Chris Stratton Sep 9 '19 at 5:25
  • \$\begingroup\$ Your design requires a high (Vbat) pin to be connected to the unpowered MCU, as Chris said this is not workable. \$\endgroup\$ – Drew Sep 9 '19 at 6:03
  • \$\begingroup\$ Is it enough to use an N channel MOSFET for the microcontroller to pull !PWR low (gate to pin, source to ground, drain to !PWR)? \$\endgroup\$ – nsayer Sep 9 '19 at 6:17
  • \$\begingroup\$ Yes, that should work. Keep the PMOS in place and add the NMOS as you described. May want to add a pull down resistor (~100k) to the gate of the NMOS (between the GPIO and the NMOS gate) since you said it'll be Hi-Z at some point. It would also be a good idea to increase the pullup you already have with the PMOS to something like 100k too. That way you can get more life out of the AA batteries. \$\endgroup\$ – Big6 Sep 9 '19 at 13:31
  • 1
    \$\begingroup\$ I can have the software force the power pin low rather than float it to power-off. In !RESET it will be floating anyway, but we'll see if power-down becomes unreliable. Hopefully not. I'll post an answer recapping the changes once the new boards arrive and are tested. Thanks everyone. \$\endgroup\$ – nsayer Sep 9 '19 at 18:16
2
\$\begingroup\$

Sure enough, it was leakage from the power MOSFET pull-up resistor through the controller's pins, though those pins' protection diodes and then to the rest of Vcc.

The new circuit uses a common cathode diode array for each button and an N MOSFET on the controller's pin all of which isolate the !PWR net from any potential leakage paths.

\$\endgroup\$

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.