I have a project (doorlock) with MCU / LCD / Keypad and solenoid (lock) connected together. MCU, LCD and Keypad runs at 5V while solenoid runs at 9V.

I'd like to provide the power with a battery, so I was initially thinking about getting a 9V battery to provide power to the solenoid, and use a LM7805 regulator to provide 5V to MCU, LCD and Keypad. Problem is, on idle, the 5V components draw about 100-130mA of current and the solenoid will draw about 500mA on activation (for about 5 seconds), so that's 630mA of current being drawn. I imagine the battery will get either extremely hot or limit the current.

What's a good strategy of providing a consistent 9V/5V voltage with a high current while minimizing the battery size? Something like a car battery may work here but they are way too large to fit in the box.

Edit: The components are normally powered by AC/DC wall adapter. I'm trying to make a battery backup system pretty similar to shown here (http://www.electroschematics.com/6279/battery-backup-circuit/), so that the doorlock is kept in operation if the AC power dies out for whatever reason.

  • \$\begingroup\$ How often do you activate the solenoid? 5 seconds every ??? Also, does it have a different operating voltage once started? \$\endgroup\$
    – jonk
    Oct 27, 2016 at 0:25
  • \$\begingroup\$ Does the solenoid have to be powered for the whole 5 seconds? ISTR solenoids that you just power them to switch between states ... \$\endgroup\$
    – Tom Zych
    Oct 27, 2016 at 0:29
  • \$\begingroup\$ Is this actually is a solenoid motor? Those things are funny to watch in operation. \$\endgroup\$
    – jonk
    Oct 27, 2016 at 0:30
  • \$\begingroup\$ @jonk It is indeed a solenoid motor. adafruit.com/product/1512 \$\endgroup\$
    – Xiagua
    Oct 27, 2016 at 0:50
  • \$\begingroup\$ This is for a doorlock, so the solenoid is only activated when the user wants to open the lock, so it won't be very often. When it is activated though, the lock will stay opened for 5 seconds. \$\endgroup\$
    – Xiagua
    Oct 27, 2016 at 0:51

3 Answers 3


If AC doesn't work for you, I remember Radio Shack used to carry some rechargeables that were capable of unusually high current.

Another idea would be to simply use multiple batteries in parallel.

Edit: Actually, a better idea might be to put a supercapacitor across the battery, to handle the load when the solenoid actuates. Put a resistor between battery and cap to limit battery current. Figure the LM7805 needs at least 7.5V input voltage for 5 seconds, so we have:


where t = 5. Solving for RC:


For half an amp and 9V, R = 18Ω, so C = 1.5 F.

Someone check my math and reasoning? I'm just getting back into electronics, haven't done this stuff in years.

  • \$\begingroup\$ Normally, you assume there is some necessary voltage below which you cannot go and also that the battery itself isn't a perfect 9 V all the time -- even one built up from C or D cells. But that's another topic. So if you assume you can accept a droop of half a volt, then \$C\approx \frac{I \Delta t}{\Delta V}\$ or about 5 F, I think. It's not really necessary to work the exponentials for something like this. It's 22.5 Joules for the solenoid for 5 s. A 5 F cap will have about 202 Joules at 9 V and about 180 Joules at 8.5 V. \$\endgroup\$
    – jonk
    Oct 27, 2016 at 0:37
  • \$\begingroup\$ I've decided to just go ahead and use 6-pack AA rechargeable battery pack for this. At 2500mAh @ 100mA idle current draw, it'll last for about 24 hours, which is good enough for me. \$\endgroup\$
    – Xiagua
    Oct 27, 2016 at 3:20

For a minimum 100 mA continuous current, I think the only practical way to power the system is from AC power, with a suitable power supply to produce 9 volts at 1 amp, and a DC-DC converter to reduce the 9 volts to 5 volts for the MCU, etc.


If I understand the project correctly, your device will normally be powered by AC mains. If the power cuts out, the battery backup will temporarily power the system so you can still get in the door.

A 9V battery will work fine. A rechargeable LiPo or LiIon battery is better.

  • Detect whether the device is being powered by AC or battery backup.
  • If the device is being powered by battery backup, disable the display and put the MCU into a low-power sleep mode. This should reduce your power consumption to the microamp range if you're using a modern MCU.
  • Nearly any alkaline 9V battery or lithium cell can safely provide 500mA to power your solenoid.
  • Switching regulators are more efficient than linear regulators (up to 40% in this case) and will massively improve battery life.
  • To improve reliability, use a rechargeable lithium cell that's recharged by AC when power is on. That way, you never need to remember to replace the battery.

Just remember that battery backup is an emergency fallback. You can live without the display and use interrupts to conserve power. Hopefully, your AC mains are reliable enough that the system will rarely need to tap the backup.


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.