# Battery-powered 3-5 V MCU, but 12 V solenoids. How to power?

I'm building a battery-powered safe cabinet hobby project. It uses the 32L152CDISCOVERY board. I plan to charge it with a solar panel. I should operate at least 6 months without maintenance.

The MCU board takes 3-5 V input (the board has a regulator). I also need solenoids, which are available only in 9-12 V voltages. Smaller 3-5 V electric locks or solenoids that I can find are too puny in construction.

The MCU is alwats active, and solenoids are driven very rarely, a few times per day maximum.

I think I have three options:

1. 3.7 V Li-ion + boost converter to drive solenoids
2. 12 V lead-acid + buck converter to drive MCU
3. 3.7 V + 12 V dual-battery system

How to decide between these options?

• You could use a single battery solution by incorporating a 3.3V->12V step-up converter. These can have enable lines - this allows them to be powered down when no solenoid is active. The solenoids can be driven via an NPN low-side switch Dec 24, 2022 at 12:04
• Additional details based on given answers: size is not issue, box is very large. Cost optimization is not issue, it is one off hobby project. I care mainly about simplicity and elegance in terms of design. I.e. working smart, not hard. Dec 24, 2022 at 18:59

I think I have three options:
(a) 3.7 V li-ion    + boost converter to drive solenoids
(b) 12  V lead-acid + buck converter to drive MCU
(c) 3.7 V + 12 V dual-battery system
How to decide between these options?


I've named your options (a)..(c). I've also deduced that these are in order of preference: (a) would be best because the battery's smallest, then (b) then (c) least.

The below explanations don't account for falling battery voltages as they drain down. You'll have to factor that in yourself from the battery manufacturer's data. But the calculation results will each be distinct enough to select your option before that anyway.

For (a), the 3.7 V battery 'batt3V7' has to be large enough for 6 months of the MCU anyway. So you're looking at the additional battery capacity needed for the solenoid.

This extra capacity is: (Isol x 12/3.7 x (100/boosteff) x ton x 3600) Ah

Where: Isol is solenoid average current drawn, across pull-in current to hold-in current (best measured with scope, while loaded with your actual mechanics); 12/3.7 is the step-up voltage ratio; boosteff is the boost converter efficiency as a percentage; ton is the on-time in seconds; 3600 is number of seconds in an hour.

You can then decide if the new capacity of batt3V7 is suitable and practical.

For (b), it's a similar method in reverse, with the MCU loading 'batt12V' and the capacity being the sum of the solenoid and MCU capacity requirements.

The solenoid capacity needed is: (Isol x ton x 3600) Ah

The MCU capacity needed is: (Imcu x 3.3/12 x (100/buckeff) x 3600) Ah

Where: ton is the solenoid on-time in seconds; 3600 is number of seconds in an hour; Imcu is MCU average current drawn including any use sleep modes; 3.3/12 is the step-down voltage ratio; buckeff is the buck converter efficiency as a percentage.

For (c), the size of each battery can be determined by applying the methods shown above.

Definitely the second option: cheaper, smaller, requires a single battery charger. A DC-DC converter to power the MCU is smaller because the MCU takes less power than the solenoids. Also, the DC-DC converter that powers the MCU isolates from the MCU the voltage dips as a solenoid is turned on and the high voltage spikes as a solenoid is turned off. (In the first option, when you turn on and off a solenoid the MCU power supply is affected, which may reset it.)

• Thank you. In that option I have been worried about two things: 1. I cannot find low-power 12V solar charger (that does not consume power by itself all the time, when not enough sunlight) 2. Quiescent current of buck converter in low load operation all the time. Dec 24, 2022 at 19:06
• I have been able to find some 3.7V solar chargers that do not consume 1-3mA all the time. I don't have sunlight that much, and small panel, so 12V chargers end up consuming more than produce. Dec 24, 2022 at 19:32

If you are considering charging a battery with solar panel, your safe cabinet seems to be assuming outdoor exposure.

the outdoor environment will also affect battery selection. For example, Lead acid batteries can be charged at minus 20 degrees Celsius, but Lithium ion batteries are not allowed to be charged below 0 degrees Celsius.

If there are restrictions on battery selection, it will also affect your power system design.

• True, thanks. I plan to use the safe mainly when it is not freezing outside. Dec 24, 2022 at 19:08
• @Tuppe Sounds good. additionally, If you're interested in a 12V lead acid battery, the lead acid battery charging circuit is much simpler than you think. old designs based on LM317 (It can be configured with only 10 parts), or newer chips supporting MPPT, likes LT3652, etc. Dec 24, 2022 at 19:30