The result was this rather simple circuit:
Somehow a relay with two sets of switches had made it into my sparkfun inventor's kit, So I used that second set to switch between two status LEDs, just for the heck of it.
The only thing not contained my (somewhat older) Sparkfun Inventor's kit was a suitable load resistor. I found a 15 Ohms resistor that looked like it could dissipate a few watts. For the 3.7V lithium cell I wanted to test, that should result in a current of approx. 250mA and around 1 Watt of heat that has to be radiated off.
If you want to build this, I'd strongly recommend to use thicker, shorter wires, because the lousy jumper wires and breadboard add an awful lot of resistance.
The sketch cuts out at 3V to protect the cell from deep discharges. That is very safe, but it leaves some capacity in the cell. Keeppower's protection circuits cut off at 2.75V.
I then fed the Time/Volts (the first two columns) to LibreOffice Calc:
Gaaaah! This is one ugly graph. I suppose it is mainly because of contact issues. Thermal effects might also contribute.
On the other hand, the capacity measured is 776 mAh. Not far off for a 800 mAh cell. This is because the current is derived from the voltage drop over the 15 Ohms resistor. And that stays valid, even if the surrounding wiring is poor and adds extra resistance.
Warning: If you need to measure cells over 5V, you need a voltage divider. Otherwise you'll damage your Arduino board. Or at least the microcontroller chip.
Here is the link to my video: https://youtu.be/0tYB6HedLyE
Edit: 20150401 Corrected circuit diagram.
If you want to build this, I'd strongly recommend to use thicker, shorter wires, because the lousy jumper wires and breadboard add an awful lot of resistance.
int sensorPin = 0;
int sensorValue = 0;
int time = 0;
int rel = 13;
float cur = 0;
float cap = 0;
void setup()
{
analogReference(DEFAULT);
Serial.begin(9600);
pinMode(rel, OUTPUT);
digitalWrite(rel, HIGH);
delay (1000);
}
void loop()
{
sensorValue = analogRead(sensorPin);
float voltage= sensorValue * (5.0 / 1023.0);
if (voltage > 3)
{
cur = voltage / 15; //current through the 15 Ohms Resistor
cap = cap + (cur / 60);
Serial.print(time);
Serial.print(";");
Serial.print(voltage);
Serial.print(";");
Serial.print(cur);
Serial.print(";");
Serial.println(cap*1000);
delay(60000); //1 minute delay between readings.
time++;
}
else
{
digitalWrite(rel, LOW);
}
}
The sketch cuts out at 3V to protect the cell from deep discharges. That is very safe, but it leaves some capacity in the cell. Keeppower's protection circuits cut off at 2.75V.
I then fed the Time/Volts (the first two columns) to LibreOffice Calc:
Gaaaah! This is one ugly graph. I suppose it is mainly because of contact issues. Thermal effects might also contribute.
On the other hand, the capacity measured is 776 mAh. Not far off for a 800 mAh cell. This is because the current is derived from the voltage drop over the 15 Ohms resistor. And that stays valid, even if the surrounding wiring is poor and adds extra resistance.
Warning: If you need to measure cells over 5V, you need a voltage divider. Otherwise you'll damage your Arduino board. Or at least the microcontroller chip.
Here is the link to my video: https://youtu.be/0tYB6HedLyE
Edit: 20150401 Corrected circuit diagram.