Well, having gotten the output of the battery sorted out, now it’s time to turn my attention to the input side, namely managing the battery voltage and two possible charge sources.
Now, I have a second-hand Xantrex 20A charger kicking around that I plan to use for when the sun isn’t around and my battery is getting low. When the sun’s out though, I plan to let that charge the battery. I could do this with a small MCU, and I did briefly consider whether I used an ATTiny24A to do it, or one of my spare ATMega8Ls.
I have a beefy 30A relay that can connect and disconnect the charger as needed, it’s a matter of having a controller that decides when it’s needed. I’m not looking for PWM control, the charger will do that itself.
There are two thresholds I want to consider:
- The low threshold: about 11.5V or so.
- The high threshold: about 14V.
We want to not let the battery get much below 11.5V as the regulators on the compute nodes will drop up to 700mV and the IPMI BMCs will start to get grumpy. Likewise, they complain when they see more than 13.5V. The regulators should look after it, but let’s not stress them too hard.
I could use a single comparator with hysteresis to do the above, by selecting a reference voltage mid-way between 11.5 and 14V, and setting resistors to set the threshold gap. I’ve decided to just use two comparators, so I can use a LM393, or I have a LM339 kicking around. I also dug around in the junk box and found a stack of MM74C76s, some MM74C221Ns.
Some tinkering with a breadboard, and I came up with this:
Now, the beauty of this set-up, is that I’m using half of each IC, so I effectively have two independent controllers on the one board. Thresholds can be tweaked on each one so that one charger starts sooner than the other, maybe I kick the solar in when battery drops below 12V and let it go to 14V, the mains charger kicks in when we get to 11.5V and stops when we reach 13V.
I haven’t decided on a regulator, yes I could use a LM78C05, the low-power version of the LM7805, as the power drain of this is going to be tiny and headroom enormous for 5V. There are probably better options, I’ll have to shop around, although for a quick prototype, I might just use the LM78C05s since they’re on hand.