Arduino Lithium-ion Battery Charger
In this post we are going to build a smart 3.7V Li-ion / Li-Po battery charger using Arduino, which is equipped with tons of features with minimal hardware setup. We will learn how to correctly charge a lithium-ion cell using CC / CV methods in easy words and in the end of this post you will be able to make a very reliable, feature rich yet simple smart li-ion battery charger.
We will see:
- Main features of this Li-ion / Li-Po battery charger circuit.
- How to charge a 3.7V Li-ion / Li-Po cell correctly.
- Circuit diagram of Li-ion / Li-Po battery charger.
- Circuit description.
- Program code for Li-ion / Li-Po battery charger.
- How to operate the proposed battery charger.
Features of the proposed Li-ion / Li-Po battery charger:

- Full battery detection and auto cut-off.
- Auto timer cut-off.
- Overcharging current cut-off.
- Auto current sensor calibration.
- Real time current consumption on display.
- CC / CV modes indication on display.
- Charging current recommendation.
- Current sensor – Reverse polarity detection and cut-off.
- Battery reverse polarity protection.
- Charging range from 1000mAh to 5000mAh.
We will explore each and every feature mentioned here in later part of the post. Now let’s learn the fundamentals of Li-ion / Li-Po charging method. We concluded the following explanations from Battery university and designer’s guide to Li-ion battery charging from Digi-Key Electronics.
How to charge 3.7V Li-ion /Li-Po cell properly?
It is very crucial to know lithium-ion cell / battery’s charging parameters like voltage, current and cut-off current before we start to build the charger so that charging process can be done correctly. As you might know Li-ion and Li-Po batteries are known for its violent character (if mishandled), so it is essential to know the correct charging procedure.
What is the nominal charging voltage for 3.7V Li-ion / Li-Po Cell?
Short answer: 4.20V
For a 3.7V Li-ion / Li-Po battery the charging voltage is 4.20V (+/- 50mV) meaning we should ideally apply 4.20V to the battery, but may have deviation within the range from 4.15V to 4.25V, but not more than 4.25V strictly.
What is the charging current for a typical Li-ion / Li-Po cell?
Short answer: 0.5C or 0.5 x Ah (Universally)
The charging current is ultimately decided by the battery’s capacity Ah (C -rating). The charging current can be between 0.5C to 1C and this also depends on your battery’s datasheet / manufacturer. Just remember “C” rating = Ah of the battery.
- For example a 2000mAh or 2Ah battery’s “C” rating is 2 and we can charge the battery between 0.5 x 2 (Ah) = 1 A (to) 1 x 2 (Ah) = 2A.
- For 1000mAh or 1Ah capacity, we can charge battery from 0.5 x 1 (Ah) = 0.5A (to) 1 x 1 (Ah) = 1A.
Some manufactures say not to charge the battery above 0.7C and some say not above 0.8C and some say not above 1C. This could be because manufacturer to manufacturer do some chemistry tweaks to their batteries and due to this some batteries can accept more current than others. If you apply more current than manufacturer’s recommendation your battery will degrade soon.
Since our charger must suit batteries from all manufacturers we have to fix some charging rate where all the batteries can be charged and we found 0.5C to be optimal. Charging Li-ion / Li-Po battery below the recommended current will not harm the battery; instead it actually improves the battery life span.
When to Cut-off the battery from charger?
Full charge occurs when battery voltage reaches its threshold i.e. 4.20V and when the charging current reaches 0.1C that is 10% of the battery capacity.
For example: A 2000mAh battery can be disconnected when the voltage reaches as mentioned and also when the current reaches 200mA, similarly a 5000mAh battery can be disconnected when charging current reaches 500mA and so on.
Please note that voltage alone cannot tell the state of charge of a battery, the voltage can reach 4.20V when the battery is just charged around 70%, so it is the charging current that indicates the state of charge.
When the battery is disconnected after a full charge, open circuit voltage settles around 4.0V after some time.
Can I float charge Li-ion / Li-Po batteries?
BIG NO!
Li-ion / Li-Po battery chemistry cannot accept float charging – that is applying current equal to self-discharge rate of the battery to keep it at full voltage like lead-acid type. The Li-ion battery has to be disconnected completely from the charger.
Topping charge:
However topping charge can be done. Topping charge is a charging process done when the battery falls around 4.05V or below after a full charge and the battery is still connected to charger, the charger kicks in to fill the battery till 4.20V and the cycle repeats. But it is nowhere applying continuous current to the battery.
What are “Pre-conditioning” and “CC / CV” charge stages?
Pre-conditioning charge: If the battery is over-discharged to like below 3V, charging the battery at 0.5C may cause overheating which could lead to permanent damage. To prevent such thermal dissipation, the battery is charged with current at 0.1C or 10% of the capacity till the battery can accept full recommended charging current.
CC / CV charging stage:
Li-ion / Li-Po batteries are charged with strict constant current (CC) and constant voltage (CV) parameters. Any deviation will lead to premature expiration of the battery.

What is CC Mode?
When a discharged battery is connected to a charger the battery will pull maximum current limited by the charger. During this charging stage if we measure the current it will stay constant with time but the voltage will be equal to discharged battery voltage and slowly rising. Here current is constant but voltage is varying / increasing.
What is CV Mode?
During CC mode the battery terminal voltage was rising slowly and the current was constant, but once the battery reaches 4.20V current starts to drop and voltage will stay constant till the end of full charge. Here the voltage is constant but current is varying / decreasing.
Note: The current limit is the tip over point between CC and CV mode of a charger. If the battery consumes less than the current limit, the charger is said to be in CV mode and if the battery is consumes current equal to the current limit, the charger is said to be in CC mode.
Li-ion / Li-Po battery charger circuit:

Circuit description:
The circuit relatively simple for a Li-ion / Li-Po battery charger and even a beginner in Arduino can accomplish with ease.
CC / CV buck converter:

The heart of this project is the above shown CC / CV power supply which is actually a buck converter and this is responsible for regulating voltage and current to the li-ion battery. This buck converter is just like any other voltage buck converter but this has an additional feature which can limit current . This module has two control potentiometers one for voltage and another for current. Once the current is limit is set to (say) 1A, the short circuit current will not exceed 1A.
You can find this “CC / CV buck converter” on any e-commerce sites and it is commonly available. The above shown exact model is not necessary.
How to set current limit:
To set current limit on this type of buck converter we need a multimeter.
- Set the multimeter at 10A mode.
- Power the buck converter with 9V supply.
- Touch the multimeter leads at buck converter output’s which will short circuit. Note that the output is current limited so it won’t fry the buck converter.
- Using a Phillips screw driver rotate the current potentiometer anti-clockwise to reduce the current and vice-versa to the desired current limit.
- Set current to 0.5C of the battery capacity. (0.5 x Ah)
How to set voltage?
- Set the multimeter to 20VDC range.
- Connect the leads at the output and rotate the voltage potentiometer clockwise to increase voltage and vice-versa.
- Set voltage to 4.20V precisely.
Now you buck converter module is ready for CC and CV operations.
ACS712 5A current sensor:

We are using ACS712 (ACS712-05B) 5A (AC/DC) current sensor module which will measure charging current in the circuit. This current sensor works on the principal of magnetic effect where a current carrying conductor will generate magnetic field around it and the magnetic field around the conductor is directly proportional to current flow.
The IC in the breakout board measures the magnetic field and gives out a proportion analogue voltage between 0 to 5V. When no input current is applied the output voltage will be at 2.5V, if the current is applied the voltage will go from 2.5 to 5V or 2.5V to 0V since it can measure AC and DC.
But the problem with this sensor is that the output is rich in noise and picks up stray magnetic field from its surrounding, so it practically never centres at 2.5V and also deviates from the actual current reading by a lot.
To overcome this issue we came up with an algorithm to calibrate this sensor aggressively every 10 minute during its operation.
To improve accuracy further more you can add 0.47uF capacitor of any type as shown (in parallel with the existing SMD component):

Also use twisted pair wires to reduce noise from measuring wires as shown:

Important note: ACS712 comes in 3 variants 5A, 20A and 30A and all look identical. Make sure you got 5A one and 20A and 30A will not work with this project.
LCD Display:

We are using a ‘16×2’ LCD display to show battery charging status and several important information on charging. We are using I2C LCD adapter module to reduce wiring work with the project.
Relay:
We are using a 9V relay (12V relay also works fine) which is activated by a low power NPN transistor. A diode will arrest high voltage back EMF while switching the relay ON and OFF.
Please note that 5V relay (which is available with breakout board) is NOT used here. If we use 5V relay, we usually connect to Arduino’s 5V output pin and when the coil is energized the Arduino’s 5V output pin drops to 4.4V which mess with current sensor voltage reference and gives incorrect readings and cut-off point.

Fuse and diode:
The fuse and diode act as simple reverse polarity protection. When the battery is connected in correct polarity the diode is reverse biased and does not short circuit the battery to blow the fuse. If the polarity is reversed the diode conducts and makes a short circuit which will blow the fuse instantly and prevents any further damage to battery or to the circuit.
Push buttons:
In this circuit two push buttons are provided, one for entering the battery capacity that you are going to connect (INC – increment button) and one for starting the charging process (START button).
Input power supply:
In our test setup we used 9V 600mA wall adapter for a 2000mAh battery which was charged with 1A current limit (at buck converter). If you want to charge a higher capacity battery like 3000mAh or above use 9V at 1 – 2A as input supply.
That concludes the hardware setup.
Library files to be downloaded before compiling the code:
ACS712 current sensor library: Click here
I2C LCD library: Click here
Program code for Li-ion / Li-Po battery charger:
// ----------© Electronics-Project-Hub----------- // #include "ACS712.h" #include <EEPROM.h> #include <LiquidCrystal_I2C.h> LiquidCrystal_I2C lcd(0x27, 16, 2); #define sensorInput A0 ACS712 sensor(ACS712_05B, sensorInput); //------ Time out Setting --------// int h_lt = 4; // in hrs int m_lt = 20; // in min // -------------------------------// const int relay = 5; const int inc = 4; const int ok = 3; int address = 0; int batt_cap; int current_lt = 0; float peak_I_lt = 0; float cut_off = 0; boolean set_batt = true; boolean var = true; int i = 0; int hrs = 0; int Min = 0; int sec = 0; float currentReading; float CV_current = 0; void setup() { pinMode(relay, OUTPUT); digitalWrite(relay, LOW); pinMode(inc, INPUT_PULLUP); pinMode(ok, INPUT_PULLUP); lcd.init(); lcd.backlight(); EEPROM.get(address, batt_cap); if (batt_cap < 1000) { EEPROM.put(address, 1000); } lcd.clear(); while (set_batt) { lcd.setCursor(0, 0); lcd.print("Enter capacity:"); lcd.setCursor(0, 1); EEPROM.get(address, batt_cap); lcd.print(batt_cap); lcd.print(" mAh"); if (digitalRead(inc) == LOW) { while (var) { if (digitalRead(ok) == LOW) var = false; if (digitalRead(inc) == LOW) { lcd.setCursor(0, 1); batt_cap = batt_cap + 100; if (batt_cap > 5000) batt_cap = 1000; lcd.print(batt_cap); lcd.print(" mAh"); delay(250); } } } if (digitalRead(ok) == LOW) { EEPROM.put(address, batt_cap); lcd.clear(); lcd.setCursor(0, 0); lcd.print("Your battery"); lcd.setCursor(0, 1); lcd.print("is "); lcd.print(batt_cap); lcd.print(" mAh."); delay(2000); lcd.clear(); lcd.setCursor(0, 0); lcd.print("Set current"); lcd.setCursor(0, 1); lcd.print("limit = "); current_lt = batt_cap * 0.5; peak_I_lt = batt_cap * 0.7 * 0.001; cut_off = batt_cap * 0.1 * 0.001; lcd.print(current_lt); lcd.print(" mA"); delay(3000); set_batt = false; } } current_calib(); CCCV(); } void loop() { for (i = 0; i < 10; i++) { currentReading = sensor.getCurrentDC(); delay(100); } timer(); lcd.clear(); lcd.setCursor(0, 0); if (currentReading <= CV_current) { lcd.print("MODE:CV"); } if (currentReading > CV_current) { lcd.print("MODE:CC"); } lcd.setCursor(0, 1); lcd.print("CURRENT: "); lcd.print(currentReading); lcd.print(" A"); if (currentReading <= cut_off) { for (i = 0; i < 10; i++) { currentReading = sensor.getCurrentDC(); delay(100); } if (currentReading <= cut_off) { digitalWrite(relay, LOW); lcd.clear(); lcd.setCursor(0, 0); lcd.print("BATTERY FULLY"); lcd.setCursor(0, 1); lcd.print("CHARGED."); while (true) {} } } currentReading = sensor.getCurrentDC(); if (currentReading >= peak_I_lt) { digitalWrite(relay, LOW); current_calib(); digitalWrite(relay, HIGH); delay(3000); currentReading = sensor.getCurrentDC(); if (currentReading >= peak_I_lt) { while (true) { digitalWrite(relay, LOW); lcd.clear(); lcd.setCursor(0, 0); lcd.print("Overcharging"); lcd.setCursor(0, 1); lcd.print("current detected"); delay(2000); lcd.clear(); lcd.setCursor(0, 0); lcd.print("Charging halted."); lcd.setCursor(0, 1); lcd.print("Press reset."); delay(2000); } } } } void current_calib() { lcd.clear(); lcd.print("Auto Calibrating"); lcd.setCursor(0, 1); lcd.print("Current Sensor."); sensor.calibrate(); delay(1000); currentReading = sensor.getCurrentDC(); if (currentReading >= 0.02 || currentReading <= -0.02 ) { sensor.calibrate(); delay(5000); currentReading = sensor.getCurrentDC(); if (currentReading >= 0.02) { current_calib(); } } } void timer() { sec = sec + 1; if (sec == 60) { sec = 0; Min = Min + 1; re_calib(); } if (Min == 60) { Min = 0; hrs = hrs + 1; } if (hrs == h_lt && Min == m_lt) { digitalWrite(relay, LOW); while (true) { lcd.clear(); lcd.setCursor(0, 0); lcd.print("Time out !!!"); lcd.setCursor(0, 1); lcd.print("Charge Completed"); delay(2000); lcd.clear(); lcd.setCursor(0, 0); lcd.print(" Press reset"); lcd.setCursor(0, 1); lcd.print("****************"); delay(2000); } } } void re_calib() { if (Min == 10 || Min == 20 || Min == 30 || Min == 40 || Min == 50 || Min == 60 && sec == 0) { digitalWrite(relay, LOW); current_calib(); digitalWrite(relay, HIGH); } } void CCCV() { lcd.clear(); lcd.setCursor(0, 0); lcd.print("Analyzing CC/CV"); lcd.setCursor(0, 1); lcd.print("Modes..."); digitalWrite(relay, HIGH); for (i = 0; i < 20; i++) { currentReading = sensor.getCurrentDC(); delay(100); } if (currentReading <= -0.1) { while (true) { digitalWrite(relay, LOW); lcd.clear(); lcd.setCursor(0, 0); lcd.print("Reverse current"); lcd.setCursor(0, 1); lcd.print("detected."); delay(2000); lcd.clear(); lcd.setCursor(0, 0); lcd.print("Flip current"); lcd.setCursor(0, 1); lcd.print("sensor polarity."); delay(2000); } } CV_current = currentReading * 0.8; } // ----------© Electronics-Project-Hub----------- //
Timeout setting:
If the battery is taking too long to charge fully this is an indication of a malfunctioned battery and such batteries must not put to use in future. If you charge such battery there is risk for safety and the charging battery must be cut-off if it exceeds expected charging time.
Such function is built-in to this charger and you can set / change the timing in the code after which the charging will get terminated even if the battery is not fully charged.
//------ Time out Setting --------// int h_lt = 4; // in hrs int m_lt = 20; // in min // -------------------------------//
You can set hours and minutes. By default it is set at 4 hour and 20 minutes. A discharged battery (not over discharged) should fully charge around 3 to 3.5 hours at 0.5C charging current.
Prototype:



How to operate this charger and its functions:
With your completed hardware setup, power ON the charger and you will be asked to enter the battery capacity that you are going to connect.

- Press INC button to increment the battery capacity on the screen. For every press, it will increase by 100mAh on display. The minimum battery capacity that can be charged is 1000mAh and maximum is 5000mAh with this charger.
- If you reach 5000mAh any further increment will reset to 1000mAh.
- Now press start button, the screen will display the required charging current that you should have set to the CC / CV buck converter beforehand (0.5C).

- After this Arduino starts to calibrate the current sensor and compensates for the stray magnetic field. This can take 5 to 15 seconds.

- The charger starts to analyze CC and CV modes. CV mode will be indicated if the charging current is reduced by 20% of the initial current.

- The actual charging process starts now.

- When the charging current reaches 0.1C, charging is terminated and you may disconnect the battery from charger.

- If you set charging current more than 0.7C on buck converter, the charger will detect as over-current and halts charging. You need to bring it below 0.7C (ideally 0.5C).

- If the charging process did not complete with in the designated time period, timeout process will kick in and terminate charging. You can change timeout setting in the code if you want.

Note 1: If the display shows “Reverse current detected” just reverse / flip the wires that are connected to screw terminals on ACS712 sensor.
Note 2: The charger will auto calibrate the current sensor every 10 minute during which relay will switch multiple times, which is completely normal.
If you have any questions regarding this smart Li-ion / Li-Po battery charger project, feel free to ask us in the comments, you will get a guaranteed reply from us.
Really good Instructable. Thanks! Quick question though. What is the reason that you can’t charge a li-po smaller than 1000 mAh, and what modifications would it take to make it able to do so? I have some 600 mAh and 800 mAh batteries that I’d like to be able to charge on it as well. Thanks again. Cheers!
Thanks,
The problem with charging a lower capacity battery is that (5A model) ACS712 current sensor cannot measure current less than 100mA accurately because it is very sensitive to electromagnetic noise that exist around the sensor.
Cut-off current for a 800mAh is 80mA the current sensor could measure garbage value and cut-off charging randomly or even could overcharge the battery.
Regards
Verry good instructions.
I have the same question as Rick. Use it for LIPO between 300 and 800 mV.
For me the use of Arduino to charge the LIPO is required. I use it for loading the small lipo’s in car’s on a scale 1:87 (thats why they must be small) and arduino to communicate with Games on track.
Is it possible the use a better sensor like INA219
300 to 800 mV? or mAh?
ACS712 is bad at measuring low current, INA219 may help but we haven’t tested it and the code has to rewritten for the new current measurement module.
If possible we will try do one in future.
Regards
Can we modify this circuit for 24v 10Ah Li-ion battery pack?
No, this circuit is only for single cell charging.
can we make any changes in circuit and components to make it compatible for 24v 5Ah battery.
Are you talking about li-ion battery? Or some other battery types?
Many thanks for your prompt reply.
Yes i am talking about Li-ion battery.
Hi,
A 24V li-ion battery consists of multiple 3.7V li-ion cells connected in series, which cannot be charged using this charger.
You need a 24V battery BMS board (Battery management system) to charge them properly.
Regards
Awesome project ,please can I get a circuit for Li ion battery pack ,as you told this Circuit can’t be used for more than one cell,It will be very helpful ,thank you.
We will try to make one in the future…..
Can i use this to build cut off charger for smart phone?
No, smartphones or even featured phones has its own cut-off functionality which works just fine. This charger is used for charging a li-ion cell directly.
You may use a socket timer to disconnect your charger from mains if you want to, but phone’s build in cut-off function is good enough to prevent any harm to your phone or to its battery.
What is use of transistor and resistor in this circuit?
The transistor is used as switch for activating the relay. The resistor at the base terminal of the transistor is to limit the current, if over-current enters the base of the transistor it will get damaged.
Can you explain the whole code?
Sorry, explaining each and every line of the code is a very tedious task for us. But if you have any specific question in the code you may ask.
Can you explain this?
void re_calib()
{
if (Min == 10 || Min == 20 || Min == 30 || Min == 40 ||
Min == 50 || Min == 60 && sec == 0)
{
digitalWrite(relay, LOW);
current_calib();
digitalWrite(relay, HIGH);
}
}
This function is executed to re-calibrate the current sensor every 10 minutes to make sure that current sensor is feeding the Arduino with correct values. A time-out clock is running while charging the battery and it has “Min” variable. When Min equals the above values the calibration function executes.
Regards.
Hi, nice work with the charger! 🙂 I think that probably there’s error in the condition:
if (Min == 10 || Min == 20 || Min == 30 || Min == 40 || Min == 50 || Min == 60 && sec == 0)
The && operator has a higher priority than || (I always use this nice table here – [LINK PROTECTED]), so I guess it should be like:
if ( (Min == 10 || Min == 20 || Min == 30 || Min == 40 || Min == 50 || Min == 60 ) && sec == 0)
Otherwise, the condition will be true for Min == 10 … Min == 50, even when sec will not be 0.
Regards,
Martin
Hi,
It is a good coding habit to write in the way you have mentioned, but there is nothing particularly wrong with the existing condition and it works equally well. However if we add one more condition say EXOR then proper brackets are necessary.
Regards
Hye sir. The relay is 5 pin or 3 pin?
Relay: pin #5
Can you tell the calculations which are required in this project?
Hi,
Setting current limit to the buck converter’s output: 0.5 x Ah (battery capacity).
For example: If you have a 2000mAh (2Ah) battery the short-circuit current at buck converter must be 0.5 x 2 = 1A (current limit).
Regards
Hye. Can i see the fully circuit including the I2c adapter
Hi,
Could you please rephrase your question, we could hardly understand…..
Can the input be 5v 2amp. Because your input is 9v.
No, input voltage cannot be less than 7V.
If 12v?
Didn’t get the question…. you mean 12V input? If so, yes…
Can u tell the name of buck converter module ?
Hi,
You can ask/search for “CC/CV buck converter module” on popular e-commerce sites or nearby electronics spare parts store.
Regards
Can u plzz explain connection given to the relay in circuit diagram?
Yes, please give us one day time we are updating a circuit related to relay diagram which should clear your confusions…
Hi,
We have updated the relay circuit in the “Relay” sub heading of the post.
Regards
Hye sir, could you explain why should we use buck converter in this program? What the actual function of the buck converter as you state the buck converter is the heart of the project.
Hi, Buck converter is the one which regulates voltage and current to Li-ion cell.
hi, i have wrote the coding in the arduino, and it shows this
Arduino: 1.8.12 (Windows 10), Board: “Arduino Uno”
batteries:10:10: fatal error: ACS712.h: No such file or directory
#include “ACS712.h”
^~~~~~~~~~
compilation terminated.
exit status 1
ACS712.h: No such file or directory
This report would have more information with
“Show verbose output during compilation”
option enabled in File -> Preferences.
Hi,
You need to download and add the ACS712 library to your IDE from the given link.
Regards
Hi, do you mind to share the block diagram or flow chart of this circuit? I had made one, but this comment can’t upload figure.
Hi,
It would be great if you can share your block diagram with us, you may upload the diagram to google drive and share a link here.
Regards
https://drive.google.com/file/d/199LBSukFgGE1voF1sM0PZ95JCurkA3zO/view?usp=sharing
hi, this is the link to the block diagram.
Hi,
Thanks, we will update it in the post after enhancing the diagram and and any corrections if any, very soon.
Regards
hello sir, the wire from relay (N/O) is connect to (+ve) or (-ve) input for ACS712?
Hi,
Those current measuring terminals don’t have polarity, but you may need to reverse the connection if the LCD displayed a message to do so.
Regards
Hye sir. I have done the coding, but the charging session just happen a while, just in 3 -10 second, than the lcd display ‘battery fully charged’. But the truth is its the battery still not fully charged. So, what should I do?
Hi,
We are familiar with that situation, this could happen because of the following reasons:
1) Insufficient input current to the charger circuit. Try at-least 1A adapter @ 9V. If the current goes below the cut-off current it will recognize as full battery.
2) You did not set the correct current limit at the buck converter. You should set a short circuit current at buck converter according to 0.5 x Ah = I.
3) You did not set the correct voltage i.e. 4.20V.
4) You have a dying battery that is not accepting the current the charger supplies.
Regards
Hello Blogthor. Tell me HRS4-S-DC12V relay is suitable for this project? Sorry for the stupid question, I’m new to electrical engineering. Thank!
Yes it works!
one more question. Why do we use a 4.7 kΩ resistor and how to calculate which one is needed?
Thank you very much,Blogthor!
Hi,
There are two 4.7K resistor which one you are referring to? So that I can explain correctly.
Hi does the project comprises of under voltage protection?
Hi,
The proposed circuit is only a charger, it cannot provide over-discharge / under-voltage protection.
Regards
hi.. can i use 3.7v 20000mAh li-ion powerbank battery for this project?
Hi,
No, the maximum limit is 5000 mAh.
Hi,
I wonder what diodes to use. Can you please explain.
Regards, Rob
Hi rob,
I have explained the function of the diode, please read the section fuse & diode.
If this explanation isn’t enough please see the article “12v lead-acid battery charger using Arduino”, link in the same post and scroll to the diode section, I have explained even better.
Regards
Hi.
Can we use 4.2V Li-on battery ?
Thank you.
Yes, this charger is designed for charging a 4.2V li-ion/li-po battery.
Hey;
Can we use 12V 2A input power supply ?
Yes, but the Arduino voltage regulator heats up a bit at 12V
Hello
What is the black “COM” thing in circuit diagram can you explain it ?
Thank you!
Hi,
COM refers to the common terminal on the relay.
VHello;
I got 9V-1A adaptor. Can i charge 3.7V-2600mAh battery ? Is it safe ?
Yes, you can! Set the correct current limit and it is safe.
Hello;
You said there is two 4.7kOhm resistors in circuit. But there is only one in circiut diagram, where is the other one ? And why do we use a 4.7 kΩ resistor and how to calculate which one is needed? (The one connected to BC548 middle leg)
Thank you very much,Blogthor!
Hi,
Can you please mention where did we say two 4.7K resistor, we don’t remember it 🙂
There are formulas using which we can calculate resistor value for base terminal of a transistor, kindly google it.
I inserted 4.7K in the design because of my experiences I had with BC548 transistor, you can also use till 10K.
Regards
Hey Blogthor !
If we gonna charge battery with 4.20V, why do we need at least 7V input ?
Thank you.
Hi,
This is a very basic question but an important one. The Arduino board uses a built in 5v regulator for its normal operation when powered externally, the regulator requires a minimum of 7V to deliver 5V at its output, if you apply less than 7V you will see the Arduino not operating properly.
The buck converter also requires a minimum voltage, if you apply below it, you’ll see output voltage collapsing.
Regards
Hey sir;
Do you have any book or article that you recommend about this topic ?
Thanks.
Hi,
You can google / YouTube on this topic and that’s how I learn about this.
Regards
Hello sir.
I got a same problem with other friend here. LCD says “Battery fully charged” right after i set the mAh of the battery. But i do all the things u said. My buck converter shows 4.2V and 1A (i got a brand new 2000mAh battery) and my input is 8.6V 1A. What can be the problem ?
Thank you.
Hi,
Please short-circuit the output and start charging (without battery at 1A current limit) same as before. You should see 1A on the display and it can hold this indefinitely, if so your circuit is working fine. If this does NOT happen with your circuit, please check for loose connections at the relay, battery connector, ACS712 screw terminals etc (where the charging current flows).
Make sure your new li-ion battery is working properly (even I was victim of fake li-ion batteries) and partially discharged before testing the circuit.
Regards
Sir hi again;
I am seeing 0.39-0.46A on lcd it keeps changing.
Now the problem is clear. Your soldering contacts are poor and also please check with a multimeter at buck converter’s output directly that your getting 1A.
Sir hi again;
Now i getting 0.99A-1.03A but LCD says my charge current is 0.03A (its lower than cutoff) for this reason it keep saying “Your Battery Fully Charged” but my battery voltage is 3.86V not 4.20V should i change the battery ?
Thank you so much for your help.
Hi,
A fully charged li-ion battery after removing from charger will be between 3.8V to 4V, which means you have a fully charged battery.
Discharge it to 3.3 to 3.5V and test the circuit again.
Regards
Is my presumption correct that the project also works with any other Arduino (Nano, Micro, Mega, Mini, …)?
Yes, it works on most of the Arduino boards, just check for SDA and SCL pins which is different for MEGA.
Hello Bloghtor;
In the code you said CV must be bigger or equal to current reading for CV mode. But at the bottom you also said CV=Current Reading x 0.8 . In that case if you put CV=CurrentReadingx0.8 on CV=>CurrentReading we will get CurrentReadingx0.8=>CurrentReading and that is wrong. Can you explain it to me ?
Thank You.
Hi,
Can you please rephrase your question and ask again, because your question doesn’t make any technical sense.
Regards
if (currentReading <= CV_current)
{ lcd.print("MODE:CV"); (equation 1)
CV_current = currentReading * 0.8; (equation 2)
if you put equation 2 on equation 1 it will be CurrentReading <= CurrentReading*0.8 it means CurrentReading must be 0 or must be nagative and it doesn't make any sense
Thank you
Hi,
CV_current = currentReading * 0.8; runs only once after you turn ON the circuit to calculate a tip over point between CC and CV and gets stored in CV_current variable.
Equation 1 will run till the battery is full and currentReading is the variable where new current value is stored every few times a second.
Regards
Hello Bloghtor;
My circuit also says “Your battery is fully charged”. My buck converter out values are collecet but when i short circuit the output LCD and other devices gone off and then on (after the relay clicks). I checked my relay pins connections dozens of time but everythink seems okay. What can be the problem ?
Thank You. 🙂
It seems like you have incorrect wiring connection(s) which you haven’t found yet because the display and relay must stay unaffected even when you short the charging output.
OR Your input current is insufficient.
Hello Bloghtor;
I’m having trouble building the circuit, getting blinking lights from everywhere when the relay clicks (testing my circiut as you told, short circiuting the output). And your real life circuit doesnt match with your circuit scheme. Can you add more evident pictures of your circuit (It would be great, and i checked every relay connections like you said to another friend). I can’t find my mistake. Most importantly thank you for helping all of us, i wish you happy and healty new year with your loved ones. 🙂
Thank you!
Happy new year for your too!
The frustration that comes with building circuits are pretty common and we too have faced it 🙂
If it works for us and also for others, there is no reason why it should not work for you (as long as there are not critical error with your circuit).
Now coming to technical part, shorting the output (charging clips) must not cause trouble to any other part of the circuit if it does, something is fatally incorrect with your built. I highly suspect the current to your circuit is insufficient, if the circuit connections are fully correct.
Regards
Hello Bloghtor;
I didnt quite understand CC CV mode selection in code. Can you explain how is your code is decide which mode will be apply ?
Thank you
Hi,
CC mode occurs when the battery tries to consume more current than the current limit set at the buck converter.
CV mode occurs when the battery is consuming less current than the current limit set at the buck converter.
So, this occurs naturally, the code just figures out which phase of charge is going on.
Regards