This is an open source lithium-ion 18650 cells tester that discharges 4 batteries into 4 resistors, regularly records the current flowing, and deduces the total capacity of the cell.
It is quit handy if you have old laptop batteries that you want to test in order to create your own battery packs for a very cheap price.
Just put the charged cell in a slot, and the test starts automatically if the cell is charged. You can then follow the test on real-time curves.
At the end of the test, a csv file is created with the recorded voltages and capacity.
When one cell is tested, you can replace it independently of the others.
The advantages of this projects versus a commercial tester like the iMax B6 are:
- all slots are totally independent
- you can see the precise behaviour of the cell
- you can calculate your own metrics on each cell
- you can easily create statistics on the tested cells from the saved csv files
- you can extend it to manage more cells
From a programmer point of view, the project contains those following interesting points:
- how to mock a Raspberry with an SPI device (here an MCP3008 ADC) in order to easily create unit tests
- how to create unit tests for a Tkinter GUI
Planned improvements:
- use a constant discharge current
- record the initial voltage drop when the battery is put under load
- add an estimated remaining time during test
- 1x raspberry pi
- 1x 4-channel 5V relay
- 4x 4Ohm 5W resistors
- 1x MCP3008 Analog numeric converter
- 1x 4 slots battery holder
- 1x USB wifi dongle (optional)
Example of construction
sudo pip3 install --upgrade setuptools
sudo apt-get install -y python-smbus
sudo apt-get install -y python3-tk
sudo apt-get install -y i2c-tools
sudo raspi-config
In the menus, go to Interfacing options
, then I2C
and choose YES
Then, run
sudo reboot
sudo i2cdetect -y 1
Configure SPI with the following commands:
sudo raspi-config
Interfacing options / SPI / YES
sudo reboot
ls -l /dev/spidev*
pip3 install -f requirements.txt
python3 battery_tester/tkinter_app.py
- First, charge your cells, for example with TP4056 cards.
- Start the raspberry and run the program
- Put the cells in the slots
- Once the test of a cell is finished, replace it with a new cell (wait for 10s before putting the new one)
Create a virtual environment:
pipenv install - requirement_dev.txt
Then
pipenv shell
Then, to run the tests, run the command pytest