Arduino Controlled 12V battery charger circuit

Arduino is an open-source that is designed for artists or for those who do not have an electronic background. Here, in this article, we are going to show you the method of making a battery charger circuit controlled using an Arduino uno board. The project Arduino Controlled 12V battery charger circuit is an advanced version of the previous posted project “12V, 7Ah Smart Battery Charger with PCB Diagram”. This charger also has the features of bulk stage charging and float stage charging as in the previous circuit.

Silent features of Arduino Controlled 12V battery charger circuit

  1. Charge the battery in different stages i.e. bulk stage charging and float stage charging.
  2. 16×2 LCD for better visual indication of charging status of the battery and fully charged.
  3. The simple circuit is thus understandable to everyone.
  4. Automatic charging voltage and current according to the battery status.
  5. The high output current of about 5 Amp. Max.

ardunio controlled 12v battery charger circuit

Components Required for Arduino Controlled 12V battery charger circuit

Resistor (all ¼-watt, ± 5% Carbon Unless Stated Otherwise) Ω µF
R1 = 0.2 Ω/ 5W (Wire wound)

R2 = 1.5 KΩ

R3 = 470 Ω

R4, R13 = 1 KΩ

R5, R7, R9, R11 = 3.3KΩ

R6 = 330 Ω

R8 = 4.7 KΩ

R10 = 2.2 KΩ

R12 = 22 KΩ

VR1 = 2 KΩ POT.

VR2 = 10 KΩ POT.

Capacitors
C1, C2, C4 = 10 µF, 35V or 63V (Electrolytic Capacitor)

C3 = 2000 µF, 35V or 63V (Electrolytic Capacitor)

C5 = 100 µF, 24V (Electrolytic Capacitor)

Semiconductors
IC1 = LM338

IC2 = LM7812

T1, T2 = BC547

D1, D2, D7 = 1N5408

D3, D4. D6, D8 = 1N4007

Arduino UNO Board

Miscellaneous
LCD1 = 16×2 Alphanumeric LCD

SW1 = Push-to-on Switch

Jumpers for connectors

LED1 = 5mm any color LED

Heat Sink for IC1 and IC2

X1 = 220V AC Primary to 15V-0-15V, 3A Secondary Transformer

Circuit Description of Arduino Controlled 12V battery charger circuit

The circuit is shown in figure 1 and made using Proteous. For circuit description and working of Arduino Controlled 12V battery charger circuit we are dividing the entire section into 4 parts.

circuit diagram of arduino controlled 12v battery charger

Voltage Stepdown and Rectifier Unit | Arduino Controlled 12V battery charger circuit

The stepdown and rectifier is built around 220V AC primary to the 15V-0-15V secondary transformer, two high-power rectifier diode, and a filter capacitor (C3 = 2000 µF). This arrangement is a full-wave rectifier with a filter circuit. Transformer X1 step down the AC input voltage to 30V AC which is rectified using two diodes D1 and D1 and filtered using capacitor C3. This DC output contains ripple and the magnitude of DC volt is about 28.5V (30V-0.7V-0.7V = 28.5V). Approximate 1.5V is the voltage drop across diode D1 and D2 combined.

Battery Charger Circuit | Arduino Controlled 12V battery charger circuit

The charger circuit is designed around an adjustable voltage regulator IC (LM338). Filtered DC voltage is given to the input pin of IC1 (LM338). This IC can provide a regulated voltage of about 1.2V to 32V at excess of 5A current. Diode D3 and D4 are protection diodes and hence protect from reverse polarity voltage sources.

Transistor T1 and T2 control the voltage at output i.e. when the battery is fully charged then output is set to float charging state and when the battery is in charging state the then the output is set to bulk charging.

charger unit with transistorFigure 2: Adjustable Voltage Regulator with Rectifier

Working of the adjustable voltage regulator

The output voltage (V0ut) of the adjustable voltage regulator is described by the following equation

V_{OUT} = V_{REF} \times (1 + \dfrac{R_2}{R_1}) + I_{ADJ} \times R_2

Where R2 = VR1 + R5 + R6 i.e. combination of these three resistors.

R1 = 470-ohm

VREF = 1.25V

IADJ = 45 uA

Therefore the above equation can be re-written as:

V_{OUT} = 1.25 \times (1 + \dfrac{R_2}{470}) + 45\mu \times R_2

Mathematical Calculation of theoretical value of R2

The maximum voltage at which we can charge the 12V battery is about 14.2V. So, let us assume VOUT = 14.2V and calculate the value of variable resistance VR1.

14.2 = 1.25 \times (1 + \dfrac{R_2}{470}) + 45\times 10^{-6} \times R_2

 

11.36 = (1 + \dfrac{R_2}{470}) + 36\times 10^{-6} \times R_2

 

10.36 = \dfrac{R_2}{470} + 36\times 10^{-6} \times R_2

 

10.36 = 2.1636 \times 10^{-3} \times R_2

Therefore,

R_2 = 4788.18 \Omega

Now, Calculate the value of variable resistor VR1

R_2 = VR_1 + R_5 + R_6

 

4788.18 = VR_1 + 3300\Omega + 330 \Omega

Therefore, theoretical value of variable resistor VR1 is

VR_1 = 1158 \Omega

So, adjust the wiper of the variable resistor in between.

Now let’s see the working of the automatic charger stage in three different cases.

CASE 1: When Both the transistor is OFF i.e. both the digital pin D8 and D9 of the Arduino board is low.

R_1 = 470 \Omega

Value of resistor R2 is a combination of all three resistor VR1, R5, and R6 because this two transistor is off and does not conduct any voltage i.e. R2 = 4788-ohm

So, the voltage output can be calculated as

V_{OUT} = 1.25 \times (1 + \dfrac{4788}{470}) + 45\times 10^{-6} \times 4788

 

V_{OUT} = 13.98V + 0.215V

Therefore

V_{OUT} = 14.195V \approx 14.2V

Thus, battery Charge at bulk stage

CASE 2: When the Transistor T1 (Charger OFF Transistor) is off and transistor T2 (charge low transistor) is ON. In this case resistor, R6 does not contribute any resistance to adjustable resistance because conducting transistor T2 heavily conducts and passes all the voltage to the ground from the endpoint of R5. Thus, equivalent resistance (R2) = 4788 – 330 = 4458-ohm.

R_1 = 470\Omega

 

R_2 = 4458\Omega

Therefore, output voltage VOUT

V_OUT = 1.25 \times (1 + \dfrac{4458}{470}) + 0.215

 

V_{OUT} = 13.32V

Thus, in this case, the charger circuit maintains only a float charging state i.e. battery charger supply 13.2 voltage to the battery at a constant rate. As we all know that batteries have some internal resistance and start to self-discharge at a constant rate and to solve this issue we used here float charging concept.

CASE 3: When both the transistor is on, in this case, no resistor (i.e. VR1, R5, and R6) contributes in R2 i.e. R2 becomes zero because transistor T2 starts to conduct and all the voltage is passed from collector to emitter to ground. So, the output voltage can be calculated as

V_{OUT} = 1.25 \times (1 + 0) + 0

 

V_{OUT} = 1.25V

Fixed Voltage Regulator | Arduino Controlled 12V battery charger circuit

Fix voltage regulator 7812 (IC2) is used to power the Arduino uno board and also used to calculate the power consumption to find whether the battery is good or not. Two diodes D5 and D6 are used for protection as in the above circuit. A voltage divider network is made using two resistors R8 and R10 which are used to measure the voltage difference. One output between these two resistors is given to analog pin A1 of Arduino uno board as shown in the circuit diagram.

fixed voltage regulator for battery chargerFigure 3: Fixed Voltage Regulator Circuit

Display Unit | Arduino Controlled 12V battery charger circuit

The display unit is built around a 16×2 alphanumeric LCD and Arduino board. As this LCD is based on Hitachi so for contrast we don’t need a variable resistor. A fixed value resistor is connected to the VDD pin (pin 3) of LCD to the ground as shown in the circuit diagram. The higher data pin of LCD (D4, D5, D6, and D7) is connected to Arduino uno digital pin (D5, D4, D3, and D2) respectively. Where enable (E) and Reset/Set (RS) pin of LCD is connected to D6 and D7 respectively as shown in the circuit diagram. LED+ and LED- (pin 15 and pin 16) of LCD is connected to +Vcc (5V of Arduino) through current limiting resistor R13 and GND respectively. If you are new to Arduino and LCD interfacing then please watch this video before interfacing: Interfacing of 16×2 LCD to Arduino UNO Board.

lcd and arduino connection for battery chargerFigure 4: Display Unit for Arduino Battery Charger

Battery Status | Arduino Controlled 12V battery charger circuit

For checking battery status press the switch SW1 for a few moments. Arduino board gets power from the battery and it measures the voltage from the voltage divider network formed using resistor R12 and variable resistor VR2. The jumper is used for calibration of the circuit for battery testing.

battery status for arduinoFigure 5: Battery Status Circuit

Software Code | Arduino Controlled 12V battery charger circuit

The software code for Arduino controlled 12V battery charger circuit is written in Arduino programming language and compiled using Arduino IDE.

calibration circuitFigure 6: Calibration Circuit

Calibration of Arduino Controlled 12V Battery Charger Circuit

  1. Connect all the circuit components as shown in the circuit diagram.
  2. Upload the code to the Arduino Uno board.
  3. Short the jumper (CON1).
  4. Connect the multimeter in place of the battery, and set the multimeter in DC voltage measurement mode. (V probe of the multimeter is connected to the output of diode D7 and COM probe to GND of the circuit).
  5. Adjust the wiper of VR1 until the multimeter shows 14.2V reading. If the multimeter reads 14.2V fix the wiper of VR1.
  6. Adjust the VR2 until LCD 14.2V and fix the wiper of VR2.
  7. Now, remove the jumper and multimeter and connect the battery. Your device Arduino-controlled 12V battery charger is ready to use.

2 Thoughts to “Arduino Controlled 12V battery charger circuit”

  1. Dani

    Hello, I want to use a solar panel instead how can I work on it?

  2. Dani

    I used a solar panel in place of the panel but the display doesn’t work it just charges the battery. How can I get it to display

Leave a Comment