Seamlessly switching between batteries

crutschow

Joined Mar 14, 2008
34,452
Mind pointing me in the right direction?
I think to do what you want would require the addition of an op amp to detect the relative voltage differences between batteries, and I don't think you want to add the complexity to save a few hundred mV.

Have you looked for higher voltage, micropower regulators that might fit your requirements, which would eliminate the need for any diodes?
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,253
Have you looked for higher voltage, micropower regulators that might fit your requirements, which would eliminate the need for any diodes?
I have, but as you might have already noticed, I'm not exactly an expert in this field. All of the regulators I found had an unacceptable quiescent power draw.

My guess is that it's probably best to keep the diodes, for simplicity's sake.
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,253
What's the maximum you can tolerate, based upon expected battery life from the load?
What is the battery Ah capacity?
Batteries are 1.5V "C" size, about 6500 mAh according to my estimate. The MCU will draw about 15 µA (I know that from experience). And the solenoid will draw about 4.3 Amps for 70 ms twice a day. I haven't really done the numbers, but my guess is that the system will work for close to 5 years before changing the batteries becomes necessary.
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,253
I calculated 195k hours or about 22 years, which is likely longer than the battery shelf life, so I think you don't need to be that concerned about the regulator efficiency. :)
Maybe I've been too greedy, then ... battery shelf life claimed by the brand I'm using is 10 years. That's why I expect about half of that ... do you know of any high efficiency regulator out there capable of accepting an input of up to 15V?

EDIT: Never mind, I just remember that I'm also using a component to which the 6VDC input is being directly being fed to. The component in question being a GPRS module that needs quite a bit of punch (about 500 ma) when it activates, which is about twice a week for about 30 seconds.
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,253
Here's a question about something that's been bugging me about this arrangement.

I need to measure the batteries' voltages so as to know when it's time to replace them. I'm measuring those voltages at the 6V level, and not 15V, because those batteries not only participate in the solenoid's activation, but are constantly feeding the regulator and MCU and the rest of the circuit as well.

For that purpose, I've used the following circuit (I'll be using an nFet for Q1 instead of a bipolar transistor, though) that was generously drafted by the late @OBW0549:

Battery Level Circuit.png


The result is the following circuit:
1668649938514.png

My question has to do with Battery Bank A. You see, when Battery Bank B is connected, then Bank A is disengaged by Q1. But I'd like to measure the voltage level in Bank A too, even though it is not active while Bank B is connected. That is why R7 is connected to Bank A's "negative" side, and not directly to ground.

Is this right? Because even though I can see that there is current path through R6 and R7 when [Enable 2] is pushed high, said "high" is being provided by one of the MCU's pins. And the MCU does not share ground with Bank A when Bank B is connected, and thus Q1 is inactive.
 

crutschow

Joined Mar 14, 2008
34,452
Is this right?
No, since there is no path for the Bank A battery to the micro.
To measure Bank's A voltage when it is not connected, some type of ground connection to Battery A's negative side is needed.
This could be provided by momentarily connecting Q1 to ground during the measurement (Enable 2 high).
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,253
No, since there is no path for the Bank A battery to the micro.
To measure Bank's A voltage when it is not connected, some type of ground connection to Battery A's negative side is needed.
This could be provided by momentarily connecting Q1 to ground during the measurement (Enable 2 high).
I was thinking along the same lines. Thank you very much for your help.
 

crutschow

Joined Mar 14, 2008
34,452
I just realized there appears to be a problem with the design.
The current through Q1 is source to drain, so the substrate diode will conduct whenever the drain voltage is more negative than about -0.6V.
This can occur if the Bank A voltage becomes more that about 1.5V above Bank B voltage.

Using 2 MOSFETS in series, source-to-source should solve that.
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,253
Using 2 MOSFETS in series, source-to-source should solve that.
Thanks, I saw the problem as soon as you mentioned it. Here's my most recent interaction:

1668697369923.png

What bothers me now is that Q7 and Q8 must be used to activate Bank A whenever one wants to make a measurement while Bank B is connected. But I can't see how to take advantage of Q1 and Q6 to do just that.
 

crutschow

Joined Mar 14, 2008
34,452
What bothers me now is that Q7 and Q8 must be used to activate Bank A whenever one wants to make a measurement while Bank B is connected. But I can't see how to take advantage of Q1 and Q6 to do just that.
I assume you don't need to make the measurements very often, so how about just momentarily turning on the bank you want to measure?
It shouldn't take more than a second for the measurement.
That would also eliminate Q7 and Q8.
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,253
I assume you don't need to make the measurements very often, so how about just momentarily turning on the bank you want to measure?
It shouldn't take more than a second for the measurement.
That would also eliminate Q7 and Q8.
Why, sure. That is exactly what I'd like to do. But here's a recap of how the circuit is supposed to work:
  1. Bank B should be used before Bank A. That is, Bank B can be considered as the main battery bank, and Bank A as the reserve battery bank.
  2. Bank A only kicks in when Bank B is disconnected
  3. Bank B provides all power while it is connected
  4. Measurement of Bank A should be possible regardless of Bank B's connection state.

Then again, here's a thought. Maybe it is best if Bank A's connection state can also be controlled by the MCU. This because Bank B will eventually discharge to an unpractical level, but won't let Bank A go active (according to my circuit in post #55) until it is disconnected.

So the following circuit should let the MCU switch to Bank A when Bank B has discharged to an unacceptable level:

1668721898743.png
This circuit allows the MCU to enable Bank A for measurement purposes, and keep it enabled if it meets programmed criteria. I know it has a lot of parts in it, but (unless I'm mistaken) it does exactly what I want it to do.

What do you think?

EDIT: I've just corrected a fatal flaw in my original schematic, having to do with Q3 and Q5 connection to ground.
EDIT: Batteries polarity orientation corrected.
 
Last edited:

drjohsmith

Joined Dec 13, 2021
852
Thanks, I saw the problem as soon as you mentioned it. Here's my most recent interaction:

View attachment 280907

What bothers me now is that Q7 and Q8 must be used to activate Bank A whenever one wants to make a measurement while Bank B is connected. But I can't see how to take advantage of Q1 and Q6 to do just that.
A nit pick

You show the battery symbols up side down,
the large horizontal line is the Positive.

C1, a big cap,
when you connect the battery pack to the capacitor, what's limiting the instantaneous current

the solenoid, what stops the back EMF ?

The ssr,
is the control input "logic" level, is it referenced to ground ?
when the solenoid "fires" what will the voltage on the lower level of the SSR be ?

This circuit is growing by the post,
it seems a long way from seamless battery switching,

Do you have an actual specification as to what you want to do ?

Have you considered separate power for the MCU and the solenoid ?
The requirements of the two parts are very different,
The MCU will need micro amps,
the solenoid, many amps,

The solenoid will drop out almost immediately the power is glitched,
its easy to keep he MCU working

All very different needs.
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,253
Thanks for chiming in, Dr. I hope I can answer your concerns properly:


You show the battery symbols up side down,
the large horizontal line is the Positive.
You're right. Thanks for pointing that out. Editing and correcting immediately.


C1, a big cap,
when you connect the battery pack to the capacitor, what's limiting the instantaneous current
Nothing stops the inrush current to the capacitor. But my "big fat cap" is only about 220 µF. That's much more than enough to keep the circuit stable during bank switching. I've already tested it and it works fine. Remember that the MCU only draws about 14 µA


the solenoid, what stops the back EMF ?
There's an inverse parallel diode connected to the solenoid. And it's not shown in the diagram.


The ssr,
is the control input "logic" level, is it referenced to ground ?
when the solenoid "fires" what will the voltage on the lower level of the SSR be ?
The SSR is also properly connected. Not sure what you mean by asking what the SSR's voltage on the lower level will be.


Do you have an actual specification as to what you want to do ?

Have you considered separate power for the MCU and the solenoid ?
The requirements of the two parts are very different,
The MCU will need micro amps,
the solenoid, many amps,

The solenoid will drop out almost immediately the power is glitched,
its easy to keep he MCU working

All very different needs.
Yes, I have a very clear map of what I want to do, but it's for a private project and unfortunately I can't disclose all of the details. What I can tell you is that space requirements make it necessary for the batteries to be arranged as they are. If I were use separate batteries for the solenoid and the MCU then the required amount wouldn't fit in the enclosure. Other than that, the system does not glitch when the solenoid is activated due to the extremely low power draw from the MCU, the fat cap, and a 2.2 µF and 100 nF decoupling caps placed very close to the MCU.


This circuit is growing by the post,
it seems a long way from seamless battery switching,
That is true. The battery switching schematic I wanted was accomplished quite a few posts ago. But I decided not to open a new thread for the voltage level measurement requirements because it's part of the same problem I'm trying to solve.

Personally, I find it fascinating how a simple requirement using basic discrete parts can sometimes grow in appreciable complexity, such as in this case.
 
Top