12v Battery Charger Circuit using LM317 (12v Power Supply)
Most of our electronics projects are powered by a Lead Acid battery, in this project let us discuss how to recharge this lead acid Battery with a help of a simple circuit that can be easily understood and built from home. This project will save yourself from investing in a battery charger and help you to extend your battery life. So let’s get started!!!!
Let’s start by understanding few basic things about a Lead Acid Battery so that we can build our charger more efficiently. Most of the lead acid batteries in the market are 12V batteries. The Ah (Ampere hours) of each battery may vary based on the required capacity, a 7 Ah battery for example will be able to provide 1 Amps for a duration of 7 hours (1 Amps *7 hours = 7 Ah). Now after complete discharge the battery percentage should be around 10.5, this is the time for us to charge our batteries. The charging current of a battery is recommended to be 1/10th of the Ah rating of the battery. So for a 7 Ah battery the charging current should be around 0.7 Amps. Current greater than this may harm the battery resulting in reduced battery life. Keeping this in consideration this, small homemade charger will be able to provide you variable voltage and variable current. The current can be adjusted based on the present Ah rating of the battery.
This Lead Acid Battery charger circuit can also be used to charge your mobile phones, after adjusting the voltage and current according to mobile phone, using the POT. This circuit will provide a Regulated DC Power Supply from the AC mains and will work as AC-DC Adapter; I have previously created a Variable Power Supply with High current and voltage output.
- Transformer 12V 1Amp
- IC LM317 (2)
- Diode Bridge W005
- Connector Terminal Block (2)
- Capacitor 1000uF, 1uF
- Capacitor 0.1uF (5)
- Variable resistor 100R
- Resistor 1k (5)
- Resistor 10k
- Diode- Nn007 (3)
- LM358 – Opamp
- 0.05R – Shunt Resistor/wire
- LCD-16*2 (optional)
- Arduino Nano (optional)
The complete schematics of this Battery Charger Circuit are shown below:
The main objective of our 12V power supply circuit is to control the voltage and current for the battery so that it can be charged in the best possible way. For this purpose we have used two LM317 ICs, one is used to control the voltage and the other is used to limit the current. Here, in our circuit the IC U1 is used to control the current and the IC U3 is used to control the voltage. I would strongly recommend you to read the datasheet of LM317 and understand it, so that it comes in handy while trying similar projects since LM317 is a most used Variable regulator.
A simple Voltage Regulator Circuit, taken from LM317’s datasheet, is shown in the figure above. Here the output voltage is decided by the resistor values R1 and R2, in our case the resistor R2 is used as a variable resistor to control the output voltage. The formulae to calculate the output voltage is Vout = 1.25 (1+R2/R1). Using this formulae, the value of resistance 1K (R8) and 10K – pot (RV2) is selected. You can also use this LM317 calculator to calculate the value of R2.
Current Limiter Circuit:
The Current Limiter Circuit, taken from LM317’s datasheet, is shown in the above figure; this is a simple circuit which can be used to limit the current in our circuit based on the resistance value R1. The formulae to calculate the output current is Iout= 1.2/R1. Based on these formulae the value of pot RV1 is selected as 100R.
Hence, in order to control the current and voltage two potentiometers RV1 and RV2 are used respectively as shown in the schematics above. The LM317 is powered by a diode bridge; the Diode Bridge itself is connected to a Transformer through connector P1. The rating of the transformer is 12V 1 Amps. This circuit alone is sufficient for us to make a simple circuit, but with help of few additional set up we can monitor the current and voltage of our charger on LCD, which is explained below.
Display Voltage and Current on LCD using Arduino:
With the help of an Arduino Nano and an LCD (16*2), we can display the voltage and current values of our charger. But, how can we do this!!
Arduino Nano is 5V operational Microcontroller, anything more than 5V will kill it. But, our charger works on 12V, hence with the help of a Voltage divider circuit the value of (0-14) Volt is mapped down to (0-5)V using resistor R1 (1k) and R2 (500R), like have previously done in 0-24v 3A Regulated Power Supply Circuit, to display the Voltage on LCD using Arduino Nano.
To measure the current we use a shunt resistor R4 of very low value to create a voltage drop across the resistor, as you can see in the circuit below. Now using Ohms Law calculator we can calculate the current passing through the resistor using the formulae I=V/R.
In our circuit the value of R4 is 0.05R and the maximum current that can pass through our circuit will be 1.2 Amps because the transformer is rated so. The power rating of the resistor can be calculated using P=I^2 R. In our case P=(1.2*1.2*0.05) => 0.07 which is less than a quarter watt. But if you do not get a 0.05R or if your current rating is higher, then calculate the Power accordingly. Now if we are able to measure the voltage drop across the resistor R4, we would be able to calculate the current through the circuit using our Arduino. But, this voltage drop is very minimal for our Arduino to read it. Hence an Amplifier circuit is constructed using Op-amp LM358 as shown in the figure above, the output of this Op-Amp is given to our Arduino through an R-C circuit to measure the current and display in on the LCD.
Once we decide our value of components in our circuit, it is always recommended to use simulation software to verify our values before we proceed with our actual hardware. Here, I have used Proteus 8 to simulate the circuit as shown below. You can run the simulation using the file (12V_charger.pdsprj) given in this zip file.
Building up the Battery Charger:
Once you are ready with the circuit you can start building up your charger, you can either use a Perf board for this project or build your own PCB. I have used a PCB, the PCB was created using KICAD. KICAD is open source PCB designing software and can be downloaded online for free. If you are not familiar with PCB designing, no worries!!!. I have attached the Gerber and other print files (download here), which can be handed over to your local PCB manufacturer and your board can be fabricated. You can also see how your PCB will look after manufacturing, by uploading these Gerber files (zip file) to any Gerber Viewer. The PCB design of our charger is shown below.
Once the PCB is fabricated, assemble and solder the components based on values given in the schematics, for your convenience a BOM (Bill of materials) is also attached in the zip file given above, so that you can purchase and assemble them at ease. After assembling our Charger should look something like this….
Testing of Battery Charger:
Now it is time to test our charger, the Arduino and LCD is not required for the charger to operate. They are used only for monitoring purpose. You can mount them using Bergstick as shown above, so that you can remove them when you need them for another project.
For testing purpose remove the Arduino and connect your transformer, now adjust the output voltage to our required voltage using the POT RV2. Verify the voltage using a multimeter and connect it to the battery as shown below. That is it our charger is now operational.
JLCPCB – Prototype 10 PCBs for $2 + 2 days Lead Time
China’s Largest PCB Prototype Enterprise, 300,000+ Customers & 10,000+ Online Orders Per Day
Inside a huge PCB factory: https://www.youtube.com/watch?v=_XCznQFV-Mw
This Post / Project can also be found using search terms:
- 12v battery charger circuit using lm317