I'm using a Picaxe 28X1. I have seperate shunts for charge & discharge, & sample every 1/2 second. I have 2 buckets, one for charge, and one for discharge. Each bucket rolls over at 1/2 AHr, at which point the battery capacity is increased or decreased by 1/2 AHr, and remaining capacity calculated as a percentage of total battery capacity. All the math constants are neatly arranged so the whole thing runs on integer math. The rollover number for the charge bucket is increased slightly to allow for less than 100% charge/discharge efficiency. I'm not doing any averaging. The serial port also allows logging to a PC. Logging time is user adjustable in one minute increments.
Here's a sample from an old log file;
It shows time (PC time), battery voltage, discharge current, charge current, remaining capacity, and status.
07:23:02, 12.82, -0.4, +0.3, 92, DisCharging
07:33:02, 12.84, -0.4, +0.3, 92, DisCharging
07:43:02, 12.84, -0.4, +0.3, 92, DisCharging
07:53:01, 12.86, -0.0, +0.4, 92, Charging
08:03:01, 12.86, -0.0, +0.3, 92, Charging
08:13:01, 12.86, -0.0, +0.4, 92, Charging
08:23:01, 12.88, -0.0, +0.4, 92, Charging
08:33:01, 12.88, -0.0, +0.4, 92, Charging
08:43:01, 12.98, -0.0, +1.7, 92, Charging
08:53:01, 13.16, -0.0, +3.0, 92, Charging
09:03:01, 13.26, -0.0, +3.7, 92, Charging
09:13:01, 13.32, -0.0, +4.0, 92, Charging
09:23:01, 13.34, -0.0, +4.3, 93, Charging
Amanda