top of page

Designed in a Day: Battery Capacity Tester

I've been working hard on assembling all the components for my electrotactile haptic feedback project. While I'm waiting for the next stages of that project, I've returned to an idea I've been wanting to explore for a while: a battery capacity tester. Specifically, I want to create a tester for the used "disposable" vape batteries that I've collected. These batteries are actually reusable and can be utilized in various projects or for repairs.


The batteries claim to be 550mAh Li-ion batteries with a typical nominal voltage of 3.7V. After a bit of research, I found the standard size for these batteries is 13400. Of course, this battery tester should be capable of testing any Li-ion battery I might want to use.


I quickly sketched a simple block diagram outlining the circuit I plan to use. Since I'm already familiar with the voltage-controlled constant current circuit from my electrotactile stimulation project, I thought it would be a valuable feature to include in the battery tester. This circuit allows me to adjust the current drawn during testing, enabling me to assess voltage drop and simulate different loads on each cell. This flexibility is particularly important when testing the capacity of batteries with varying capacities. The industry standard for capacity testing involves discharging the cell at a rate of 1C, which is the current required to fully discharge the cell in 1 hour.

When designing the circuit, I had a couple of other features in mind that I thought would be helpful additions. I have decided to add a TP4056 charging board so that the batteries can be both charged and discharged from the same board. To do this and make sure that only charging or discharging can happen at any one time, I added an SPDT slide switch. The battery tester should be compatible with any MCU that supports an ADC and DAC (although these could be substituted for additional dedicated IC’s for better performance). I also wanted to use parts that I had on hand so that I wouldn’t have to wait to receive any more parts and be able to finish the project in a day. My final aim was to use as little outside help as possible to challenge myself and see where my weaker areas are. Datasheets and similar documents were fair game, but I wanted to use the techniques that I had learnt over the last few years.


Once I’d drawn the quick sketch, I started looking at the components I had and picked out the major ones. I’ve listed the components chosen below. I could’ve definitely substituted other components for the ones used and the ones I have used here are by no means the best for the job. The ESP32, for example, is completely overkill for this application but it’s what I’ve been using recently and the only MCU I had on hand.

Microcontroller

Espressif ESP32-WROOM Dev Board

Op-amp

Microchip MCP6021

MOSFET

STP75NF75

Shunt resistor

TruOhm 0.47Ω 5W

Charging module

TP4056 charging board

After collecting the components, I jumped into Fusion 360 to design the schematic that I would be working from. While designing, I realised that I would need to use a voltage divider to be able to accurately read the working voltage of the battery. Since the ESP32 is 3.3V, the max voltage of 4.2V would overdrive the pin and possibly cause damage. Because of this, I added a voltage divider to bring the entire range of the battery into readable range. As the upper and lower limits of the inbuilt ADC do not display values as reliably as closer to the middle of the range, I designed the voltage divider to bring a max value of 4.4V down to 3.3V and allow some headroom for reading battery voltages starting at 4.2V. To reduce noise in the reading, I also added a 1uF electrolytic capacitor.

Schematic of homemade battery capacity tester
Schematic of battery capacity tester

Next, I grabbed some perfboard and began to place the components. I could’ve tested using a breadboard however because of the relatively high current and issues with noise, I decided against it. The process of populating the board was mostly seamless other than having to modify the slide switch pins as it was designed to be a panel-mounted component. I also found out that in my mess of random, unsorted resistors, I didn’t have anything around the 3kΩ value so settled for one 10kΩ in parallel with three 10kΩ resistors in series.


Overall, the circuit looked okay and was functional but I think a little more planning of the perfboard (and future improvements in mind) would have made the board look even better. Once the board was built, I needed to write some code to get any readings out!


I started with a switch statement where I wrote out the functions I was expecting I would need to create a functional battery capacity tester. I started with the most obvious, which was voltage control of the current sink. This was fairly easy initially but required some tuning. This involved taking writing values to the DAC in increments of 10 and then measuring the voltage across the shunt resistor.

Voltage across shunt resistor in a constant current circuit measured using an ESP32

I logged this relationship in an Excel sheet and made a quick graph to find that the relationship was a curve but could be approximated to be roughly linear. Using this linear approximation, I used the map function to map the expected voltage across the shunt resistor to a DAC value. I then implemented this so that the user would only have to input the current they wanted which would then be used to map to the corresponding DAC value.


After this, I looked at reading the voltage of the battery. Again, a simple analogRead() was all that was needed which was then mapped to convert it to the battery’s real voltage for the user to read. I initially used a simple multiplication here, however, the results were not accurate and I found that mapping the values aligned much better with the real-world values.


The final function was the battery capacity test function which would run the actual capacity test with the specified parameters. In simple terms, this function would take a starting voltage, a drain current and a final voltage, then return the time taken for the battery to drain from start to finish. This final time would then be used to calculate the capacity in mAh of the battery.


If you would like to see the final program, any 3D models or schematics for this project, please check it out here.

testing setup using a home made battery capacity tester, an esp32 and vape batteries
Battery capacity testing setup

The results of the battery capacity tester are promising and appear to be fairly accurate to the ratings of a few of the batteries I have tested. As the shunt resistor is dissipating the energy as heat, it does heat up significantly, as does the MOSFET. The voltage measured across the shunt resistor and battery both stay roughly in line with the measured voltage using an RHMM17 digital multimeter. I’m hoping to be able to test some of the cells that I’ve already tested on a professional battery capacity tester to verify my results.


As you can see below, the battery tester got a value of 597mAh with a current of 550mA over 1.09 hours. I measured the voltage across the shunt resistor and for the majority of testing this measured voltage was only 230mV! That's roughly 25mV, or 10%, under the expected voltage. If you account for this difference, the measured capacity is almost dead on.

There are a number of improvements that I’d like to make to the project, some of which will increase the accuracy of the capacity measurements. For example, taking readings of the shunt resistor using another ADC on the ESP32 would allow the current to be set precisely and allow the DAC value to change and maintain a constant drain current throughout the test. Swapping out the MOSFET may also give more accurate measurements by eliminating a lot of the power lost to heating by the device operating in the linear region. This effect could be reduced by using a MOSFET with a lower VGS(th) and with a low RDS(on) as the MOSFET would be operating further out of the linear region with the aim of being in saturation. To improve the usability, I’d also like to add a case to the device and swap out the ESP32 for a more suitable board, such as an Arduino Nano (this will take some small modifications to the hardware and code). To hold the battery while it is being charged/discharged, I’m looking at designing a battery holder for 13400 size batteries and similar while maintaining the JST connections for anything larger.


Any future updates will be posted on my blog.




Kommentare


bottom of page