I started with someone else's code and wiring first. I went back and found that project, so I could include it here now. https://www.instructables.com/id/DIY-Arduino-Battery-Capacity-Tester-V10-/
There is not much in the original code that has stayed the same, but starting with something working was a head start. I still need to attribute it yet.
- The math was simplified, fully switched to integers, and then largely switched back as I was just being anal about using so many floats. Works fine, why mess with it.
- A logical state now controls operational state. This prevents cells from restarting a cycle by recovering, and clears the associated math bits when it does restart one.
- Display and serial code was gutted and re-written.
- PWM current control was added.
- Converted to do 4 channels.
- The hardware was stripped down to just what was needed, but was basically already exactly the way I would have done it. The original is no safer, and does little better at protecting the Nano. It also sacrifices half the ADC resolution to do it. Minimal it is. :)