Switching between two batteries as power sources

Hi all,

I have two power sources, each power source contain:

  • 1 rechargeable lithium battery 3.7v
  • charge controller
  • battery protection
  • buck converter to 5v

Basically I measure the voltage level of the lithium battery, when it reaches to threshold (lets say 3v), I will send command to the switch in order to switch between the power sources (meanwhile, the rechargeable battery will be charged- the one that not powering the Arduino)

This is the schematic drawing:

My question is which switch should I use? fast enough so the Arduino will not restart.
I was reading about the LTC4412 but im not sure how it will solve the problem
also, its package (TSOT) not hobbyist friendly :expressionless:

Maybe there is other solution..

Ill be happy for guidance.

Thanks

Hi, @dudir
Welcome to the forum.

How much current will you be drawing from the batteries?

A simple capacitor across the Nano power terminals would possibly be able to provide the current needed during change over.
Also a smaller cap from ADC pin to gnd to prevent a glitch in readings.

Tom... :smiley: :+1: :coffee: :australia:

2 Likes

The capacitor idea should work. Consider using some super caps. 2 super caps wired in series will handle the 5V's and 2 sets of series wired pairs will hold a good charge during switching. I use 3 pairs to hold power to my Raspberry Pi during power switching.

1 Like

You probably want to separate the switch on the ADC (or just use two ADC pins) so you know the voltage of the other battery before you switch over! :face_with_raised_eyebrow:

Thanks :slight_smile:
Im planning irrigation system, once in at east about 90 minutes the Arduino will wake up for checking the soil, so most of the time the Arduino will be in sleep mode.
when it wakes up and the soil is dry, the Arduino will enable the water pump (that drawing current from other power source, not those lithium batteries.
so I guess that most of the time the Arduino will draw current equal to current in sleep mode..

thanks for the tips!

Would th Nano resetting really be a bad thing ?

If this irrigation system controller is going to be sleeping most of the time then you may consider the following to minimise battery drain:

  1. Instead of a Nano, use a raw ATMega328P chip and a crystal oscillator. The Nano is OK for a prototype to get the software right but, for production use, it is too power hungry.

  2. Drive the chip directly from the (protected) LIPO cells and best would be at 8MHz instead of the normal 16MHz so it can better tolerate running at 3 volts. Also, do not run the boost converter all the time. Start it only when (if) a peripheral device needs 5 volts.

I'd also question the concept of the automatic switch over. Why not put everything in parallel. Or do you intend to physically remove a battery for charging while leaving the system running ?

1 Like

No, use a Pro Mini (8 MHz). Ready built, no design problems. Remove the "pilot" LED and useless regulator.

Schottky diodes.

Yes, you can hack bits off a Pro Mini to get the power consumption down but (a) you may be still left with a poor accuracy resonator (depending on the clone) and (b) apart from the raw chip, only few components are anyway required: (1) a decoupling capacitor (2) a 10k pullup on reset (actually optional) (3) a crystal and (4) 2 crystal load capacitors (c) again depending on the clone you may not be able to bring all the pins onto a standard 0.1" prototype board because of the weird pin spacing.

If you out diodes across each

no, but its good practice to make it run without restart (for future projects)

Thanks you for the advice! I will certainly consider using raw ATMega chip on my next project, for first projects ill stick the Arduino :slight_smile:

im not sure putting everything in parallel is ok because what will happen in case the battery need to be charged ? the Arduino will get power from the photoelectric cell? I guess its output is not stable enough for the Arduino. correct me if I wrong but disconnect the charging circuit from the running circuit its more stable and safer

Does your original diagram not suggest that each battery system incorporates a switchmode "buck" converter to provide the needed 5 V for the Arduino?

If so, it does not matter what the battery voltage is at any given time.

And it would not be a "buck" converter if it is boosting a 3.7 V battery. :grin:

If solar power is available, it makes sense to use that to power the Arduino directly, since you lose some energy in the battery charge/ discharge cycle.

Maybe say a bit more about the 2 power supplies. Are these ready made modules or are these individual components which you are connecting together. In any case supply a link. Also show how you intend to connect the photoelectric cell(s).

To your original diagram, you don't need to switch the 3.7 volts battery monitoring circuit. Just use two separate analog pins. That switch for the 5v has to be carefully thought about. If only one battery/power supply is present at system start that switch has to select the that power supply automatically because, at that time, the Arduino is not running.

According to your diagram, the supply which is not currently selected will still have its battery powering its boost converter, which will needlessly draw current. Logically, it seems there should be one boost converter and you would switch the battery which is to supply it. But even more logically, just connect the batteries in parallel, and you wouldn't need to measure or switch anything.

The solar supply complicates things. I'd like to see a drawing of how that's connected. Also, as said, more information about these power supplies, including the chargers they use.

I meant to ask- what happens when you connect two power sources in parallel, one 5v stable and the other not stable- solar power.

in side note, im about to connect the photoelectric cell to MPPT (im still in the design phase, haven't got to the MPPT stage)

Maybe say a bit more about the 2 power supplies

ok, the power supply is battery + charge controller + the boost to 5v, those modules are combined together to one device, this is the link for battery shield.

the plan is to switch between them. when one battery shield feeds the Arduino, the other will be charged by solar panel connected to MPPT

To your original diagram, you don't need to switch the 3.7 volts battery monitoring circuit

agree :slight_smile:

If only one battery/power supply is present at system start that switch has to select the that power supply automatically

right, ill take it in mind when Ill get to the coding phase.

will needlessly draw current

why is that? if the module not connected (the relay disconnects it) why will it draw current? the battery supposed to be charged at that moment

just connect the batteries in parallel

what about the battery protection + charge controller? how would you connect them?
Im not sure connecting two "raw" batteries in parallel to solar panel module (with MPPT) without protection is ok..

as I wrote in other comment (and not in my original post), Im planning to use battery shield as power source to Arduino

I'd like to see a drawing of how that's connected

I still in the design phase, but the plan is to switch between the two battery shields. when one battery shield feeds the Arduino, the other will be charged by solar panel connected to MPPT

I think we are having some considerable difficulty, and all the more so the more we think of it - as to why that might be in any way beneficial? :roll_eyes:

I repeat what I pointed out before; if solar power is available, it makes sense to use that to power the Arduino directly while it is operative and what remains beyond that to charge the battery, since you lose some energy in the battery charge/ discharge cycle.

Code is not going to help if the Arduino isn't running because neither power source has been selected.
Measuring the battery voltage with the Arduino will serve no purpose if the Arduino can't switch the power sources.

Have a look at this example of a solar powered battery charging circuit. DIY Solar Battery Charger for 18650 Li-Ion Batteries - ElectronicsHub Maybe that, or something similar, could be the basis of your solution. If you do use that circuit, post your design here for review. At least the choice of diode is odd.

I'd probably power the Arduino the whole time, make use of sleep mode, and switch the boost converter on if/when needed.