Design And Construction Of An Automatic Battery Charger With Charging Full, Charging Process Indicator Using Arduino

Arduino Battery Charger Project

An Arduino Battery Charger: How to save the planet one battery at a time! Did you know that all those single use batteries (alkaline ones) that have a label on them saying “Do Not Recharge” are in fact chargeable!

Of course some will not be and some will charge a little bit better than others. But even getting on re-use out of a throw-away battery seems like a better way to go.

The criteria for whether or not the battery is re-chargeable or not is first of all give it a visual inspection. If it has powdery residue on it then it is dead so re-cycle it in your local battery re-cycling place.

The next thing to determine re-chargeability is whether or not the battery voltage has fallen below 0.8V. If it is too low then you are unlikely to get anywhere. You could measure this with a volt meter or just use the project below that does this automatically for you (I set the level to 0.75 since the voltage measurement is not absolutely accurate (Voltage regs usually have a ±10% regulation so you don’t get exactly 5V out – also the reference voltage I used is using two divider resistors so that’s another 10%). It is not absolutely critical for charging alkaline batteries.

Arduino Battery Charger Schematic

Arduino Battery Charger Circuit operation

First of all when CHRG and HCHRG are floating then R1 pulls the transistor base high so no current flows = OFF.

Pulling CHRG low results in a constant current of 21.3mA and then pulling HCRG low results in an increased charging current of 33mA

The basic operation is to start charging the battery at low current for a period, and then charge at a high current for another period. If the battery voltage increases, during high charge, then carry on charging, if not, then charging is finished (as long as the battery is within the acceptable voltage limits).

Arduino Battery Charger charging current

When CHRG is pulled low R1, R2 and R3 are enabled forming a resistive divider that sets the base voltage at

3.28V : 5*((1e3+560)/(1e3+560+820))

So the voltage across the base of the transistor, i.e. across R1, is:

1.722 : 5 – 3.26

The base emitter diode drop is 0.7V so that leaves 1V dropped across R4. This therefore allows you to define the charging current i.e. for the 47R resistor shown the charging current will be

21.3mA : 1.0/47

Arduino Battery Charger high current Charging

When HCHRG is pulled low (regardless of CHRG) then resistor R3 is shorted out to ground. So the voltage now dropped across (only) R2 is:

2.74V : 5*((1e3)/(1e3+820))

This the voltage across the base of the transistor, i.e. across R1, is:

2.25V : 5 – 2.74

Now the voltage drop across R1 is:

1.55 : 2.25 – 0.7

Which results in a charging current of:

33mA : 1.55/47

AREF External voltage

The voltage divider formed by R8 and R9 halves the voltage used for the ADC reference so the maximum that the ADC can read is 2.5V which is plenty since we only really need to measure up to about 1.6V. Having a lower AREF voltage also means that each bit of the ADC has a lower value i.e. a finer resolution – instead of 4.88mV it is 2.44mV per bit so the ADC can see smaller voltage changes at the battery.

Displays

You can use only the LCD display or only the LEDs. You will get a green (pass) or red (fail) light at the end of charging. The LCD displays more information such as the current voltage level at the battery, the start voltage of the battery and the elapsed time. It also shows the state variable (really for debug) that lets you know where the code is at. In addition the serial port outputs text messages showing you what happened. So the LCD is not really essential for operation but is useful if you make a stand alone unit.

Serial Monitor

You can use the serial monitor (in the Arduino IDE) to observe operation as serial data is also reported showing state machine operation, adc values and voltages.

Software Library and versions

Arduino IDE Version

Version : 1.8.3

The liquidCrystal library is replaced with one that allows SPI operation (so you can still use non SPI code with this library).

Download the (SPI) LiquidCrystal library from:

https://playground.arduino.cc/Main/LiquidCrystal#Download

Then goto your library location

C:\Users\<username>\Documents\Arduino\libraries

Rename directory LiquidCrystal to LiquidCrystal_orig.

Then unzip the downloaded file here which should result in a new folder

LiquidCrystal

You can find the schematic here (Wiring diagram):

https://playground.arduino.cc/Main/LiquidCrystal#Connections

There ‘s no facility to change pins (you could change the code though).

Code Operation State Machine

The Arduino Battery Charger code is formed from a simple state machine. These are the main states:

You can more or less read these from left to right and see what the code is doing.

IDLE

First of all in the IDLE state the system is set up to charge.

BATFND

Then in the BATFND state the voltage is checked (during low charge) to see if a valid battery is present.

If out of range then the state is set to FAIL.

If in range then the state is set to CHARGE

CHARGE

In the CHARGE state low charge current continues for 30 seconds. At the end the ADC reading is stored in the variable lowChrgADC.

After 30 seconds the state is set to HIGH_CHARGE and the high current output activated.

The state changes to HIGH_CHARGE after 30s.

Two other tests are made (all the time).

Battery reaches max voltage

  1. The state is set to FINISHED.

Battery is out of range

  1. The state is set to FAIL.

HIGH_CHARGE

After 30 seconds the state is set to TEST

The state changes to TEST after 30s.

Two other tests are made (all the time).

Battery reaches max voltage

  1. The state is set to FINISHED.

Battery is out of range

  1. The state is set to FAIL

TEST

Battery Voltage Increase for High Charge

This is where the decision is made either to terminate the process or continue. First of all, if the current ADC value (at the end of high charge compared to the ADC value at the end of the low current charge period) is not high enough (<9.77mV) then the battery is considered to be charged and the state is set to FINISHED.

The state of the battery (out of range) is not tested here since it has been continuously tested in states CHARGE and HIGH_CHARGE.

Detecting Final Charge : test_avg()

Some batteries hover around a final value but change their voltage output enough during High charge so that the algorithm can’t stop. To detect this state (over several charge and high-charge cycles) requires storing ADC values so a rolling shift register containing the last 10 low charging ADC values is used for detection.

In the function test_avg() the array prevADC[] is tested to see if the values are all within 1 value of the average of those 10 readings. If they are, then the state machine goes to the FIINISHED state i.e. this shows there has been no ‘real’ change in battery voltage over the last few charging cycles.

After each test phase the array is shifted and the latest low charge ADC value is inserted.

If neither of the above cases is true then the state machine goes back to IDLE.

The next state is :

FINISHED (if battery voltage is high enough) or

FINISHED for no average battery change or

IDLE (if the others are not true).

FINISHED

The controls and LEDs are set: (green LED is lit to indicate success) and charging is turned off.

The next state is WAIT_START.

FAIL

The controls and LEDs are set: (red LED is lit to indicate failure) and charging is turned off.

The next state is WAIT_START.

WAIT_START

Here is the only state that allows restart detecting a button press on the input pin. When pressed, various variables are initialised for a complete restart.

When pressed the state is set to IDLE.

APA

Design And Construction Of An Automatic Battery Charger With Charging Full, Charging Process Indicator Using Arduino. (n.d.). UniTopics. https://www.unitopics.com/project/material/design-and-construction-of-an-automatic-battery-charger-with-charging-full-charging-process-indicator-using-arduino/

MLA

“Design And Construction Of An Automatic Battery Charger With Charging Full, Charging Process Indicator Using Arduino.” UniTopics, https://www.unitopics.com/project/material/design-and-construction-of-an-automatic-battery-charger-with-charging-full-charging-process-indicator-using-arduino/. Accessed 19 September 2024.

Chicago

“Design And Construction Of An Automatic Battery Charger With Charging Full, Charging Process Indicator Using Arduino.” UniTopics, Accessed September 19, 2024. https://www.unitopics.com/project/material/design-and-construction-of-an-automatic-battery-charger-with-charging-full-charging-process-indicator-using-arduino/

WORK DETAILS

Here’s a typical structure for Design And Construction Of An Automatic Battery Charger With Charging Full, Charging Process Indicator Using Arduino research projects:

  • The title page of Design And Construction Of An Automatic Battery Charger With Charging Full, Charging Process Indicator Using Arduino should include the project title, your name, institution, and date.
  • The abstract of Design And Construction Of An Automatic Battery Charger With Charging Full, Charging Process Indicator Using Arduino should be a summary of around 150-250 words and should highlight the main objectives, methods, results, and conclusions.
  • The introduction of Design And Construction Of An Automatic Battery Charger With Charging Full, Charging Process Indicator Using Arduino should provide the background information, outline the research problem, and state the objectives and significance of the study.
  • Review existing research related to Design And Construction Of An Automatic Battery Charger With Charging Full, Charging Process Indicator Using Arduino, identifying gaps the study aims to fill.
  • The methodology section of Design And Construction Of An Automatic Battery Charger With Charging Full, Charging Process Indicator Using Arduino should describe the research design, data collection methods, and analytical techniques used.
  • Present the findings of the Design And Construction Of An Automatic Battery Charger With Charging Full, Charging Process Indicator Using Arduino research study using tables, charts, and graphs to illustrate key points.
  • Interpret Design And Construction Of An Automatic Battery Charger With Charging Full, Charging Process Indicator Using Arduino results, discussing their implications, limitations, and potential areas for future research.
  • Summarize the main findings of the Design And Construction Of An Automatic Battery Charger With Charging Full, Charging Process Indicator Using Arduino study and restate its significance.
  • List all the sources you cited in Design And Construction Of An Automatic Battery Charger With Charging Full, Charging Process Indicator Using Arduino project, following a specific citation style (e.g., APA, MLA, Chicago).