View Single Post
Old 08-09-2018, 02:14 AM
tachyoncatcher's Avatar
tachyoncatcher tachyoncatcher is offline
Senior Member
Join Date: Jun 2012
Location: Counterspace
Posts: 414

Originally Posted by axxelxavier View Post
This is my first test of battery swapper. I was using small wires and clip leads && small batteries, just to see if setup is working.
So, the good news: it's working, so this project can be done; the bad news: as I suspected, when one batteries is on lower limit, the setup is going in a loop...
Any ideas?
I haven’t done any Arduino programming, however I am proficient in 15+ programming languages. So I would do something like this. Instead of switching on a less than or greater than voltage reading, I would switch on a differential. For example .5 volt. You can make it anything you want. diff = voltage1-voltage2. Two if statements in the loop, should do it.
If (diff > .5)
Switch to batt1
If (diff < -.5)
Switch to batt2
// everything else will be ignored

This assumes you are switching to the battery with the higher voltage and the load battery is going down. If the battery is going up, with this logic it will stay on the higher voltage battery. If that is incorrect, you can still apply the logic to your situation.
Have Fun!

Last edited by tachyoncatcher; 08-09-2018 at 01:07 PM.
Reply With Quote