Category Archives: Arduino

More On Voltage Delay in Lithium Thionyl Chloride Batteries

I found the three year old Tadiran batteries (TL-5101/P) that i described in the previous blog post to have too high internal resistance to be suitable for use in Sportident base stations. The datasheet of those batteries also only talk about a discharge current of up to 2 mA and the base stations use more than that for peak current. Therefore I ordered new batteries of another brand, namely SAFT LS14250 CNA. The datasheet of SAFT LS14250 recommends a maximum discharge current of 35 mA and it has near full capacity at 10 mA of current, so this seems like a much better choice for the application.

Naturally, I was curious as to what the voltage delay looked like for LS14250, so I hooked up my battery tester with the same software as before. I ran two tests on the same battery with about 5 minutes of delay in between. The plots below shows the results.

Voltage vs time during 60 s while loading the SAFT LS14250 battery with 5 mA.
Voltage vs time during 60 s while loading the SAFT LS14250 battery with 5 mA.
Voltage vs time during 3 s while loading the SAFT LS14250 battery with 5 mA.
Voltage vs time during 3 s while loading the SAFT LS14250 battery with 5 mA.

In the first run, which takes place presumably at least many days (perhaps months or years) since the battery was last delivering any current), we see the voltage under load starting out at about 2.95 V and it recovers to 3.45 V after about 15 s.

In the second runt, the initial voltage under load is above 3.4 V and it peaks at almost 3.5 V after 1.5 s. It then sags down a bit, but stays about 15 mV above the first trace between 20 and 60 s.

So the voltage delay phenomenon is (as expected) very evident also in this battery model. Also, the SAFT LS14250 seems to be much more suited for the application than the Tadiran TL-5101/P.

Update on 2015-07-11:

I also needed to change batteries on some SI master (BSM7) units and these have AA-size (14500) batteries with higher capacity than the 1/2 AA size 14250 discussed above. I tested a new SAFT 14500 battery (which has  a highest recommended discharge current of 50 mA) twice with the 5 mA one-minute test. The results are shown in the plot below.

Voltage vs time during 60 s while loading the SAFT LS14500 battery with 5 mA.
Voltage vs time during 60 s while loading the SAFT LS14500 battery with 5 mA.

The voltage delay effect is evident also in this test, but strangely enough the curves look qualitatively different compared to the LS14250 curves. In the first run, the voltage dips during the first second before it starts to recover and reaches a peak after about 25 seconds followed by a slow decay. The initial dip is a new feature.

The second test of the same battery, ten minutes later, shows a quick recovery that peaks after three seconds after which the voltage slowly decays. After about 15 seconds, the voltage dips below that of the first run, unlike what happened when testing the LS14250 battery in which case the voltage during the second run stayed above that of the first run for the full minute.

The intricacies of battery behavior are apparently complicated, but tentatively one can conclude that a “voltage delay” effect that takes place for 1-15 seconds when the battery is being loaded after a (long) time of storage is repeatable based on the findings of these few tests.

Voltage Delay in Lithium Thionyl Chloride Batteries

As I described in a previous post, I built a simple Teensy-controlled battery tester for Lithium Thionyl Chloride batteries. I had noticed that unused batteries that had been laying around, seemed to have high internal resistance and according to Wikipedia, this can be due to a passivation layer that forms on the anode and which causes a “voltage delay” when put into service.

I decided to test this using the battery tester. What I did was to modify the program I had written for it so that it loaded the battery with a constant 5 mA current while monitoring how the pole voltage developed over time. I did this three times for one minute with a few minutes of pause in between for the same previously unused battery which has been stored for at least three years. The battery type is a 1/2 AA size Tadiran TL-5101/P.

Below are plots showing the how the pole voltage varied during the tests. The three curves shows the result of the initial test (red), second test ~20 minutes later (blue) and third test ~10 minutes after the second test. The first plot shows 60 seconds while the second plot zooms in on the first 3 seconds.

Voltage vs time during 60 s while loading the battery with 5 mA.
Voltage vs time during 60 s while loading the battery with 5 mA.
Voltage vs time during 3 s while loading the battery with 5 mA.
Voltage vs time during 3 s while loading the battery with 5 mA.

The pole voltage does indeed increase at first (during 3-10 seconds) while the battery is being loaded before it starts drooping. Also, the voltage under load becomes higher the second and third times the battery is tested in this manner.

So a very short and simple test under load might give a too pessimistic view of the state of a lithium thinoyl battery that has been stored for an extended period of time. It might recover and start perform better while it is being loaded. This is somewhat counterintuitive.

The Teensy program I used to for the tester can be found here.

Battery tester based on a Teensy

I am taking care of a number of Sportident units, which are used in the sport of orienteering. These are small embedded systems powered by non-rechargeable lithium batteries, specifically thionyl chloride (Li-SOCl2) batteries, and every few years the batteries need to be replaced, depending on how much the unit has been used. The units themselves tries to keep track of the battery status by dead reckoning and by measuring the battery voltage, apparently while it is doing something that consumes current. The state of the battery voltage under load can be read out as can the value of the estimated remaining capacity.

To help in determining the status of such batteries, I wanted to have a device that could measure the voltage and the internal resistance in a convenient manner. I had a Teensy laying around and since it has a DAC output and several analog inputs, it looked like a good platform to quickly hook something together that could do the task.

This is the schematics I came up with:

The schematic of the Teensy-based battery impedance tester.
The schematic of the Teensy-based battery impedance tester.

The circuit works like this:

R1 and R2 forms a voltage divider that reduces the battery voltage to below 3.3 V which is the limit of the ADC of the Teensy. Q1 and Rs forms a current sink controlled by the voltage on the A14/DAC pin. Basically the DAC pin sets the base voltage and since the base-emitter voltage is fairly constant, a constant voltage will develop over the emitter resistor Rs. To maintain this voltage Q1 will conduct as much current as required from the battery. The emitter current can be measured by measuring the voltage drop across Rs using analog input A1.

The purpose of having A2 and A3 connected across the base resistor is to be able to measure the (small) base current so that it can be subtracted from the emitter current when calculating the battery current. This is only a small correction and not really important, but since the inputs were available and it was easy to do, I added this little feature.

I built the physical circuit on perfboard and it looks like this:

The battery tester board.
The battery tester board.
The battery tester board with clips.
The battery tester board with clips.

As can be seen, the whole thing is very simple to build as the Teensy does all the heavy lifting.

I did of course need a program to control the whole thing and do all the measuring, calculations and presentation of results. This is the program I came up with:

/* Lithium battery tester

   Tests the internal resistance of a small 3.6 V lithium battery by ramping up the load current and measuring 
   the pole voltage and calculating the internal resistance.
   
   Written by Per Magnusson, http://www.axotron.se
   v 0.1 2015-05-24
   This program is public domain.
*/

const float Rtop = 1817;       // Top resistor of divider, ohms
const float Rbot = 8170;       // Bottom resistor of divider, ohms
const float Rs = 32.8;         // Current sense resistor, ohms
const float Rb = 995;          // Base resistor, ohms
const float Vref = 3.3;        // ADC reference voltage, volts
const int ADCbits = 12;
const int DACbits = 12;
const float voltPerADC = Vref/((1<<ADCbits) - 1.0); // Factor to convert ADC codes to volts
const float voltPerDAC = Vref/((1<<DACbits) - 1.0); // Factor to convert DAC codes to volts
const float DACperVolt = 1/voltPerDAC;              // Factor to convert volts to DAC codes
const int detectLimit = 0.8/voltPerADC;             // Limit for detecting battery 
const float curLim = 35.0e-3;  // Maximum test current in A
const float curStep = 5.0e-3;  // Target current step
const int maxIter = 3;         // Number of iterations to reach target current

const int vsensePin = A0;      // Voltage sense pin
const int curSensePin = A1;    // Emitter current sense pin
const int baseSenseHiPin = A2; // High base current sense pin
const int baseSenseLoPin = A3; // Low base current sense pin
const int dacPin = A14;        // Current control pin
const int ledPin = 13;         // LED for debug

const byte sWaitNoBat = 0;
const byte sWaitBat = 1;

byte state;

void setup() {
  Serial.begin(57600);
  analogWriteResolution(DACbits);
  analogReadResolution(ADCbits);
  analogWrite(dacPin, 0);
  pinMode(ledPin, OUTPUT);
  state = sWaitNoBat;
  Serial.println("Battery tester");
  digitalWrite(ledPin, HIGH);     // turn  LED on
  delay(3000);
  digitalWrite(ledPin, LOW);     // turn  LED off
  Serial.println("Waiting for a battery to be connected...");
}

void loop() {
  int voltCode;
  int baseVoltCode;
  int curCode;
  int dacVal;
  int dacStep;
  float volt;
  float voltNoLoad;
  float curNoLoad;
  float cur;
  float baseCur;
  float res;
  float prevCur;
  float targCur;
  float stepCur;
  byte testBat;
  byte iter;
  
  analogWrite(dacPin, 0);  // Make sure we are not loading the battery in this state
  testBat = false;
  voltCode = analogRead(vsensePin);  // Read battery voltage to see if it is connected
  if(state == sWaitNoBat) {
    // We are waiting for at battery to be connected
    if(voltCode > detectLimit) {
      // A battery was connected
      testBat = true; // Proceed to test it
    }
  } else if(state == sWaitBat) {
    // We are waiting for a battery to be disconnected
    if(voltCode < detectLimit) {
      // A battery was disconnected
      Serial.println("\nWaiting for a battery to be connected...");
      delay(1000); // Delay to not react on glitches while the battery is being disconnected
      state = sWaitNoBat;
    }
  }
  
  if(!testBat) {
    // Not in a situation that a battery should be tested
    return;
  }

  // Test the battery
  Serial.println("Battery connected, waiting for connection to stabilize.");
  delay(1000); // Wait for the connection to stabilize
  voltCode = analogRead(vsensePin);
  if(voltCode < detectLimit) {
    // The battery is gone, it was just a glitch
    state = sWaitNoBat;
    Serial.println("Battery removed, aborting.");
    Serial.println("Waiting for a battery to be connected...");
    return;
  }
  digitalWrite(ledPin, HIGH);     // turn  LED on
  Serial.println("Testing battery.");

  voltNoLoad = voltCode * voltPerADC * (Rtop+Rbot)/Rbot;
  volt = voltNoLoad;
  curNoLoad = voltNoLoad/(Rtop+Rbot); // "No load" current
  
  Serial.println("");
  Serial.print("Unloaded voltage: ");
  Serial.print(voltNoLoad);
  Serial.print(" V (current = ");
  Serial.print(curNoLoad*1000);
  Serial.println(" mA)");
  
  // Ramp up the current
  cur = 0;
  targCur = 0;
  dacVal = 0.66*DACperVolt;       // Base drive starting value, 0.66 V, low current
  dacStep = 5.0e-3*Rs*DACperVolt; // Increment ~5 mA per iteration
  prevCur = 0;
  iter = maxIter;                 // First step is to read whatever current the starting DAC value results in

  // Loop to set a number of different battery test load currents and measure the battery performance at each current
  while(1) {
    if(targCur > curLim) {
        // We are beyond the maximum target current, normal exit from loop
        break;
    }
    if(dacVal >= (1<<DACbits)) {
      // The DAC value is too big, exit from loop
      Serial.print("Warning: Above maximum DAC setting (");
      Serial.print(dacVal);
      Serial.println("), exiting");
      break;
    }

    analogWrite(dacPin, dacVal);                      // Drive the base of the transistor
    delay(10);
    voltCode = analogRead(vsensePin);                 // Battery voltage reading
    volt = voltCode * voltPerADC * (Rtop+Rbot)/Rbot;  // Calculate battery voltage
    baseVoltCode = analogRead(baseSenseHiPin) - analogRead(baseSenseLoPin); // Read voltage drop across base resistor
    baseCur = baseVoltCode * voltPerADC/Rb;           // Calculate base current
    curCode = analogRead(curSensePin);                // Emitter current reading
    // Calculate battery current and compensate for base current and divider current
    cur = curCode * voltPerADC/Rs - baseCur + curNoLoad;

    if(voltCode < detectLimit) {
      // The voltage is too big, exit from loop
      Serial.print("Warning: Below minimum battery voltage (");
      Serial.print(volt);
      Serial.println(" V), exiting");
      break;
    }

    if((cur - curNoLoad) > 0) {
      res = (voltNoLoad - volt)/(cur - curNoLoad); // Calculate internal resistance
    } else {
      res = 0; // Avoid dividing by zero
    }
    if(iter < maxIter) {
      // Make a small adjustment to get closer to the target current
      if(cur != prevCur) {
        dacVal += dacStep*((targCur-cur)/(cur-prevCur));
      }
      iter += 1;
    } else {
      // Print result
      Serial.print("Voltage: ");
      Serial.print(volt);
      Serial.print(" V");
      Serial.print(" Current: ");
      Serial.print(cur*1000);
      Serial.print(" mA");
      Serial.print(" Resistance: ");
      Serial.print(res);
      Serial.println(" ohms");

      // Move to next target current
      targCur += curStep;
      if(prevCur > 0 && (cur-prevCur > 0)) {
        // Estimate the step size required to reach the next target current
        dacStep = dacStep*((targCur-cur)/(cur-prevCur));
      }
      dacVal += dacStep;
      prevCur = cur;
      iter = 0;
    }
    if(cur > curLim*1.2) {
      // The current is too big, exit from loop
      Serial.print("Warning: Maximum current exceeded (");
      Serial.print(cur);
      Serial.println(" mA), exiting");
      break;
    }
  }
  analogWrite(dacPin, 0);        // Stop the battery current drain
  digitalWrite(ledPin, LOW);     // turn  LED off
  state = sWaitBat;
  Serial.println("Done");
  Serial.println("Disconnect battery.");
}

The program sends information to a serial terminal (I used the one inside the Arduino development environment). It waits for a battery to be connected and then ramps up the current and reports the pole voltage as well as the internal resistance at a couple of different load currents. This is what the output can look like:

Waiting for a battery to be connected...
Battery connected, waiting for connection to stabilize.
Testing battery.

Unloaded voltage: 3.67 V (current = 0.37 mA)
Voltage: 3.63 V Current: 1.39 mA Resistance: 39.36 ohms
Voltage: 3.47 V Current: 4.97 mA Resistance: 41.95 ohms
Voltage: 3.27 V Current: 9.99 mA Resistance: 41.26 ohms
Voltage: 3.08 V Current: 15.03 mA Resistance: 40.23 ohms
Voltage: 2.89 V Current: 19.98 mA Resistance: 39.33 ohms
Voltage: 2.72 V Current: 24.97 mA Resistance: 38.56 ohms
Voltage: 2.54 V Current: 29.99 mA Resistance: 37.88 ohms
Voltage: 2.37 V Current: 34.99 mA Resistance: 37.33 ohms
Done
Disconnect battery.

With a different program, the circuitry can of course also be used to test batteries in different ways.

Update on 2015-10-11

As requested by Alex in the comments, here is a picture of the bottom side of the board (and the corresponding picture of the top).

The bottom of the board.
The bottom of the board.
The top of the board.
The top of the board.