1
\$\begingroup\$

What is the lowest current way of inverting the output from a GPIO pin?

I have a solar board that has an add-on that can turn a USB port power off if a LiPO gets below 3.3v. The problem is, they added the ability to control this battery-based switching using a two pin connector for 'Enable' and 'Control' (when Enable is 'high', control is ignored and the USB is turned off [if on] whenever the voltage drops below 3.3v and turned back on [when off] when the voltage rises above 3.8v)

The problem is, I can't turn this mode 'on' when the Raspberry Pi is off. I can only turn it off when the Raspberry Pi is on.

I would like to be able to hook an inverter on the GPIO pin so that it is 'high' when the GPIO pin is 'low' but consume as little additional current as possible to do this. That way I can disable the battery switching as long as the RPi is on, read the voltage and safe-shutdown the pi if it gets to 3.3v. Then, when the Pi is off completely, the battery voltage will turn off via the USB device.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ A CMOS inverter should have extremely low quiescent draw itself; the issue might be more if you need a pulling resistor (probably) and if so if you are driving a signal against that in some mode of operation. Or it may be that you could use a pullup resistor for the pi-is-off case, and an NFET to drive the signal low when the pi is on and sets the GPIO high - you will be spending current in the pulling resistor, but next to nothing compared to that drawn by the pi... \$\endgroup\$ Apr 8, 2019 at 20:10

1 Answer 1

1
\$\begingroup\$

I read your question twice but couldn't figure out how it's all supposed to work. A truth table is so much easier.

Anyway, it seems you want a logic high when the Pi is off and the ability for the Pi to switch the input low when it is powered.

schematic

simulate this circuit – Schematic created using CircuitLab

Figure 1. The interface.

  • R1 is a pull-up and holds IN high when Q1 is off. There is no current drain in this condition.
  • When the Pi is powered the GPIO controls Q1. Set the Pi's GPIO high to pull IN low. (This may require inversion of your existing logic.)
\$\endgroup\$
1
  • \$\begingroup\$ I found out I misread the logic and they use 'low' as the enable. But I would still be curious how to build low power 3.3v inverters. I also built a mosfet switch for another device - went low-side as I had an N-channel. Unfortunately the data line is apparently on a high-side switch USB hub. I was scratching my head until I figured out why it wouldn't turn off. (but only with both cables connected) \$\endgroup\$
    – Scott Wood
    Apr 9, 2019 at 21:03

Your Answer

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

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