0
\$\begingroup\$

To minimize battery power consumption I want the microcontroller only to be powered when a sensor's output is high. After the microcontroller finishes a task, it should cut its power off again.

I found schematics for latching power circuits activated by buttons, as for example this: https://randomnerdtutorials.com/latching-power-switch-circuit-auto-power-off-circuit-esp32-esp8266-arduino/

latching power circuit

Would it be enough to just replace the button in the schematic above with a NPN transistor of which the base is connected to the sensor output? (The sensor has to be powered, of course)

I know that this is an easy question, but I'm a beginner and didn't find any full circuits with the functionality I want so I want to be sure.

Alternatively: For the button-activated auto-off circuits there is a ready-to-use product/module: https://www.pololu.com/product/2808 Do you maybe know if something similar exists for my use-case?

\$\endgroup\$
  • \$\begingroup\$ You could do as you suggest, but keep in mind that the base of your added transistor will need to get to about 2V or so to achieve a power on condition. \$\endgroup\$ – Peter Smith Apr 21 at 15:07
  • \$\begingroup\$ Can you provide a datasheet for the sensor? The circuit you provide has two ways of activating -- one via the GPIO pin on the connector and the other with the PB switch. (Note the two diodes present to allow an "either-or" situation?) You may be able to get by with a simpler circuit. \$\endgroup\$ – jonk Apr 21 at 15:41
0
\$\begingroup\$

It ought to be sufficient to connect your sensor signal to the junction of the 220k and the 10k resistors.

All you need is a high signal to cause the whole thing to switch on.


I hope you realize that the very first thing your processor has to do is to set a high signal on pin 2 of the connector. You also have to do this faster than the length of the sensor pulse.

If the sensor only goes high for 1 millisecond, then your processor has to switch its output high before that 1 millisecond expires.

You must maintain that high state until the processor finishes its task. When you switch it low again, this circuit will shutoff power to your processor.

By itself, this circuit isn't a latch. It lets your processor operate it as a latch, but it isn't a latch by itself.

\$\endgroup\$
0
\$\begingroup\$

If the sensor can provide 100\$\mu\$A or so of current at 3V or more, then just remove the pushbutton switch and connect the sensor output to the 10k\$\Omega\$ resistor. If the sensor's output voltage is sure to be less than 1.4V when it is "low" then the 220k\$\Omega\$ resistor to ground can be removed.

Note that the sensor output must remain high long enough for the microcontroller to power up and drive the GPIO pin high. Also, the sensor output must go low before the microcontroller can power itself down.

\$\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.