enter image description here

The image above is referred from this SO link. My use case is the following:

A latching solenoid valve, which would be run using 4 AA batteries (6V)

Solenoid Valve (9 Ohm) operates at 6V under 40ms pulse. I'll be running a microcontroller (ESP 12E), which would go into deep sleep to save power. Since this is to be used in remote places, hence latching solenoid powered by AA was chosen.

I don't want a scenario where if battery dies after some weeks or months of operation, one day if the solenoid was turned on, and remained like that, will end up wasting water for a long time (since someone would inspect site only once in a day) before being noticed.

So I looked at the above circuit diagram, and I was thinking how to minimize the power wastage in the voltage divider (R1/R2) circuits. Of course I could increase the R1/R2 such that they are in 100K ranges.


Is it possible that due to extremely low input current the GPIO IN would not be able to detect the falling pulse? Is there any minimum current for a GPIO (ESP 12E) to detect the falling voltage?

Also, I'm planning to use AMS1117 to step down 6V to 3.3V needed for ESP 12E. What kind of energy loss can I expect when the ESP is in "Normal" mode and when in "Deep-Sleep" mode?

The reason to use the voltage divider power off detector circuitry is because of its simplicity (I'm no electronics expert) and and cause its cheaper than other solutions.

  • \$\begingroup\$ Using a linear regulator to go from 6V down to 3.3V will waste a huge percentage of the energy in your battery over its lifetime. Since you are concerned about battery life for long term remote operations you should look at using a small switching voltage regulator. Such regulator circuit can achieve much better efficiency than the nominal 66% you will get with the linear regulator. \$\endgroup\$ Mar 8, 2019 at 12:02
  • 1
    \$\begingroup\$ First thing I would do is rethink your battery supply. 4xAA is 6V right? Your solenoid needs 6V? As soon as those batteries start depleting, you're going to run into trouble. As soon as the solenoid gets powered, there will be a drop due to the internal resistance of the batteries and the load resistance of the solenoid. I think you will find yourself facing some problems after a very short time there \$\endgroup\$
    – MCG
    Mar 8, 2019 at 12:02
  • \$\begingroup\$ @MichaelKaras What is example of small switching regulator? \$\endgroup\$
    – Ouroboros
    Mar 8, 2019 at 12:12
  • \$\begingroup\$ @MichaelKaras Since the ESP would wake up only to turn ON/OFF post the initial setup, so would the loss be substantial even if the ESP is in deep sleep mode most of the time (99.9%). \$\endgroup\$
    – Ouroboros
    Mar 8, 2019 at 12:15
  • 1
    \$\begingroup\$ @Ouroboros well, if your solenoid needs 6V to operate, after a while 4xAA will be under 6V, then your solenoid fails to work. Unless it can work down to a lower voltage. The discharge curve on a AA battery means you won't get much use out of them. Unless of course your solenoid can work down to..... say 4V? If not, again, as I said, you will be facing trouble \$\endgroup\$
    – MCG
    Mar 8, 2019 at 12:44

1 Answer 1


Looks like the AMS1117 is a LDO. A TPS62840 which is a switching regulator is better solution for a low power application. Below an application circuit that might be helpful. Connect V_Batt from battery to Vin. Vout from the switching regulator which is 3.3V should be wired to the microcontroller (ESP 12E)

enter image description here

Use a GPIO pin to enable circuit below that can be connect to the ADC (Pin 2).

enter image description here

Below example circuit to use to measure the V_Batt, via ADC (Pin 2).


simulate this circuit – Schematic created using CircuitLab

Finally the micro controller should not have any issue providing sufficient current the GPIO pin. Most latching solenoids currently in the market has a minimum voltage around may be 4V-5V.


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.