Published © GPL3+

Lead Acid Battery Capacity Tester (Updated)

A 12 V Lead-Acid Battery is Discharged at a Constant Current (Programmable) for a Period of Time to get Terminal Voltage VS Time curve

AdvancedFull instructions provided8,218
Lead Acid Battery Capacity Tester (Updated)

Things used in this project

Hardware components

1306 OLED Display
Microchip ATmega328
Texas Instruments LM358
Microchip MCP4131
78xx Regulators
IRFP 260 N-Mos
Texas Instruments TL 431 Programmable
Intel Pentium 4 Heat Sink (65 Watt dissipation-ctive Cooling)
1 Ohms 5 Watt 30 Pcs Ceramic Resistor
FR 04 ProtoBoard 14cm x 8cm

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
DC drill motor


Read more


Active Load

Programmable Constant Current

Supply Rails

Different Voltage Source Levels for different Units

Bare Arduino/ATmega328

Control, Data Acquisition, User Input, Display

Analog Signal Conditioning

Conditioning, Scaling, Voltage and Current Info for ADC


Updated Codes

EEPROM pointer bug removed, OLED display font Improved
No preview (download only).

Battery Tester

It Works, but Battery MUST BE CONNECTED AFTER POWERING UP the Device (Battery Tester) , INITIALIZING (auto) and CONFIGURING (settings Input by user) . Otherwise Very High Current will flow for a Short Duration of Time ( Might damage Gate Driving OpAmp )
/* Open Source Design
* Code written by Shahariar Hossain, IE DU, Batch 3
** This firmware is for Lead Acid Battery Capacity 
*** Development & Testing Device Hardware & Farmware Date : 2015,Sep-Dec 

#include "U8glib.h"
#include <SPI.h>
#include <avr/eeprom.h>
#include <avr/interrupt.h>

#define LED 4
// cheap chinese OLED(scl,sda,nothing,d/c,rst)
U8GLIB_SSD1306_128X64 u8g(8, 7, 9, 5,6); //real H/W connection 
//U8GLIB_SSD1306_128X64 u8g(5, 6, 9, 8,7);

// Float to hold Voltage and Current readings
float Vb=0.0;
//int Vb=0;
float Ic=0.0;
float Im=0.0;

int I_base=462; // ADC value @ 0A current
int V_base=229;// @ 10.5 Volt

const uint8_t slaveSelectPin=10; // SPI bus chip select for mcp4131
uint8_t pot_pos =0; //digital potentiometer trimmer position

// Interrupt variables for Time keeping and User Input from press switch
volatile uint8_t sec=0;
volatile uint8_t S1=1;
volatile uint8_t S2=1;

// Timer variables 
uint8_t oldsec=0;
uint8_t mint=0;
uint8_t hr=0;
uint8_t j=0;

int disc_I=0;// initial discharge current value (upto 10000 mA or 10.0A in step of 100 mA or 0.1 A)
int C=05;// initial C rate

int eeprom_nth_data=0; // data index for EEPROM

// stopflag 1 means any stop condition occured : Vb<10.5 or Test runtime = C hrs or User Stopped
uint8_t stopflag =0; 

void setup(void) {
// u8g.setRot180();// flip display 
// 1.114 volt Internal Analog Ref on Atmega328p
// provides 10 bit ADC Resolution of 1.075 mV 
  pinMode(LED,OUTPUT); // Green LED for debugging Interrupts and EEPROM 

  pinMode(2, INPUT_PULLUP);
  attachInterrupt(0, SW1, FALLING);// Interrupt for Swithc 1

  pinMode(3, INPUT_PULLUP);
  attachInterrupt(1, SW2, FALLING);// Interrupt for Swithc 2
// Avr internal timer for timebase  
// Sets Potentiometer to 0 ohms
  init_screen();delay(5000); // Shows Initializarion screen for 5 sec      
  user_input(); // take test configuration form user

void loop(void) 

// Calculates Current in Amps and Voltage in Volts 


// updates the screen with time,measured V & I
// adjusts current if changed on every 5 th minute
  if ((mint%5==0)&&(sec>56))
    adjust_current(); // enable this function when everything is OK

//Stops test in one of the following 3 situations 
// Abort by user / Battery Voltage below 10.50 Volt / Test Runtime exceeds C hrs 

  // make Vb 10.5 later

// User Stop Request
if (S1==0)

// save eeprom every 5 min
 // save_eeprom();


4.5 Ah Battery Capacity Test Report

Plain text
No preview (download only).




43 projects • 144 followers
"What Kills a 'Great life' is a 'Good Life', which is Living a Life Inside While Loop"