Electronic – Low current power cutoff for microcontroller

batteriescircuit-designintegrated-circuitlatchlow-power

I'm attempting to design a battery-saving circuit for a microcontroller/computer. I plan to hook the circuit up to a raspberry PI and have it cut the power completely once it is fully shut-down.

The circuit and PI will be running off of a battery pack (or power bank) where it could be shut down for long periods of 2+ weeks.

The device should essentially function as a low-current cutoff switch (read current not voltage), and be externally trigger-able (say, 5v from timer circuit wired up to it).

Note: This question is similar, but it is a bit different from Simplest latching circuit with press-ON hold-OFF button that can cut power when Raspberry Pi halts. The switch will power off the controller when long press (possible unwanted behavior).
Correct behavior would be to allow the system to go through the power-down routine however long that takes, and only cut the power once it is below the threshold

It world be extremely helpful to have a trimpot to adjust the cutoff current from about 30-100 mA.

the state diagram is as follows:

State Response
High Current Gate remains closed (allow power)
Trigger & Open Gate closes (allow power)
Low Current Gate opens(deny power)
Trigger & Closed Send polite shutdown request

What kind of circuit could I build to get this kind of functionality?

Best Answer

Use a circuit like this to measure current: enter image description here
https://circuits4you.com/2016/05/13/dc-current-measurement-arduino/

You can measure the current, feed it into the ADC of the micro and then use any manner of logic to shut down the processor.

Many voltage regulators can be purchased with enable lines, you could have the voltage regulator enabled by a push button switch to kick things off. The micro could hold the line high until it needs to go into shutdown. As shown in this question:

Latching power with LDO enable pin enter image description here

Related Topic