Arduino Battery Capacity Tester

I have retrieved some old laptop batteries to use in my projects. But it is going so difficult to identify the right one in the battery pack. Earlier in one of my previous battery testers instructable, I discussed how you can identify good cells by measuring their voltages. But this method is not at all reliable. So I wanted to find a way where we can measure each cell’s exact capacity instead of their voltages. In a previous article, we have already built an IoT-based Battery Monitoring System. Also, check out this.

This project is so simple, that it relies on Ohms Law. None of that DIY projects can be 100% accurate, so this Battery Capacity Tester is also not perfect. But it gives reasonable outputs that can be used and compared with other batteries, so you can easily identify good cells in an old battery pack.

While building this project, I realized that there are a lot of things that can be improved. In the future, I will try to implement those things. But for the time being, I am happy with it. I hope this little tester will be useful, so I am sharing it with you all.

Please be aware of working with a Li-ion battery that is highly explosive and dangerous. I am not responsible for any loss of property damage, or life risk. This project was demonstrated for those who have a bit of knowledge of rechargeable lithium-ion technology. Please do not attempt this if you are an unknown.

Circuit Diagram

Battery Capacity Tester Circuit Diagram

Components Required

  • Arduino Nano
  • 128*64 OLED I2C Display
  • IRLZ44N MOSFET (Please note that the IRFZ44N mentioned above is wrong in the schematic)
  • 10KΩ Resistor (x4)
  • Lithium-Ion Battery Holder
  • Lithium-Ion Battery (Which will be tested)
  • Buzzer
  • Breadboard
  • 9 Volt Battery

About Parts of Battery Capacity Tester

IRLZ44N MOSFET

Here MOSFET acts like a switch. The digital output from the Arduino pin D2 controls the switch. When a 5V (Digital HIGH) signal is fed to the gate of the MOSFET, it allows the current to flow from the positive terminal of the battery, through the resistor, and the MOSFET then completes the path back to the negative terminal. It discharges the battery over a period of time. So the MOSFET should be chosen in such a way that it can handle maximum discharge current without overheating.

I used an n-channel logic level power MOSFET, IRLZ44. The L shows that it is a logic-level MOSFET. A logic-level MOSFET means that it is designed to turn on fully from the logic level of a microcontroller. The standard MOSFET (IRF series etc) is designed to run from 10V.

If you use an IRF series MOSFET, then it will not fully turn ON by applying 5V from Arduino. I mean the MOSFET will not carry the rated current. To turn ON these MOSFETs you need an additional circuit to boost the gate voltage.

So I will recommend using a logic-level MOSFET, not necessarily IRLZ44. You can use any other MOSFET also.

PCB Design

After designing the schematic diagram of the Battery Capacity Tester, the assembled components and wiring are too clumsy and looked very unprofessional. In fact, the wiring also has a chance of loose connection. To give it a clean and professional look and also to compress the size, I decided to build its PCB prototype using EasyEDA software as it is so simple to use. Now come to the main part, where we need to order our PCB prototype. I always prefer PCBWay for their quality assurance, fastest delivery and also for 24/7 customer support.

You can view the Gerber file here Gerber File Viewer.

PCB View

Battery Capacity Tester 2D View
2D View
Battery Capacity Tester 3D View
3D View

Why I Choose PCBWay as My First Preference?

I’ve done several runs with PCBWay and am happy with the results, it’s good quality. It is one of the most experienced PCB manufacturing companies based in China with an experience of more than a decade in the field of PCB prototype and fabrication. PCBWay has always been committed to technological innovation and meeting the needs of their customers from different industries in terms of quality, delivery, cost-effectiveness and any other demanding requests. The etching, solder mask, and hole sizes are all done well and that is what matters to me. It takes a few hours for a design to get approved and then a couple of days to finish and ship.

With more than a decade in the field of PCB prototypes and fabrication, PCBWay has proved its assurance from time to time. They always look at the customer’s needs from different regions in terms of quality, on-time delivery, cost-effectiveness and any other demanding requests.

PCBWay Gold Finish
PCBWay Thickness

These PCBs were manufactured by PCBWay and the finish quality really impressive, especially with the gold finish path. If you want to finish your product faster you could also ask PCBWay to make a panelized order where you receive multiple PCBs in a single panel. With this, you will also receive SMT Stencil from PCBWay, saving you time and effort. All the orders are high quality and could select a lot of settings such as thickness, flexible PCB, the colour of the solder masks, the number of layers, material, surface finish and more.

How to Order PCB from PCBWay?

Working Principle of Arduino Battery Capacity Tester

Here we used an Arduino Nano which is the main processing unit of this whole circuit working.

After giving the power, Arduino checks the condition if the battery is good or dead. Then it gives the switch ON command to the MOSFET. It generally allows the current to flow from the positive terminal of the battery, through the resistor, and the MOSFET then completes the circuit back to the negative terminal. This process discharges the battery over a period of time.

The Arduino measures the Analog voltage across the load resistor and then divided it by the resistance to find out the discharge current. Then multiplied the value by the time to obtain the exact milliamp-hour value which is the battery capacity value which we want to know.

How to Measure Voltage, Current and Capacity?

Voltage Measurement

We have to find the voltage across the load resistor. The voltages are measured by using two voltage divider circuits. It consists of two resistors with values of 10KΩ each. The output from the divider is connected to Arduino Analog pins A0 and A1.

Arduino Analog pin can measure voltage up to 5V, in our case the maximum voltage is 4.2V (fully charged). Then you may ask, why I am using two dividers unnecessarily. The reason is that my future plan is to use the same tester for the multi-chemistry battery. So this design can be adapted easily to achieve my goal.

Current Measurement

Current (I) = Voltage ( V ) – Voltage drop across the MOSFET / Resistance (R)

Note: I am assuming the voltage drop across the MOSFET is negligible.

Here, V = Voltage across the load resistor and R = 10 Ohm

The result obtained is in amperes. Multiply 1000 to convert it into milliamperes.

So maximum discharge current = 4.2 / 10 = 0.42A = 420mA

Capacity Measurement

Stored Charge ( Q ) = Current ( I ) x Time ( T ).

We have already calculated the current, the only unknown in the above equation is time. The millis() function in Arduino can be used to measure the elapsed time.

Arduino Code for Battery Capacity Tester

Leave a Comment