You may not be interested in building yet another charger, but this project might give you some ideas on other uses for the INA219 module, or I2C LCD, or 3D printing design using Fusion 360 (an excellent CAD program, free for hobby use).
This charger works to a resolution of 0.1 mA, 0.1 mAh and 0.01 V. It's particularly suited to charging the very small capacity cells, typically used on indoor models - there are lots of simple chargers available for these, but they don't usually give you the option to accurately control the charge rate or measure the capacity of the cells.
The principle is very simple. A 5V source is used to charge the cell through a relay contact and a current-limiting resistor. The current-limiting resistor is on the outside of the charger, mounted in spring contacts - so it's easy to change the resistor to give the desired charge rate. There is a separate resistor for discharge operations.
The heart of the system is an INA219 module. This is a small, cheap, I2C device that measures voltage and current. With the standard shunt resistor that is supplied on the module, it can work with up to 3.2 A and up to 26V. It has 12-bit resolution and switchable ranges to give more accuracy when working on the lower ranges.
Only other bits required are an Arduino, a 4x20 LCD with I2C adapter, and a standard relay board.
If you're going to use a regulated power supply - such as a phone charger or USB power bank, then a 5V Arduino would be the best solution. But I wanted to use a 4-cell Nickel battery as a power supply - and I found that the LCD contrast required constant adjustment depending on the state of charge of the Nickel battery. So I used a 3.3V Arduino - a Pro Mini Strong - this has an onboard 1A low dropout 3.3V regulator, so I could run the display from the Arduino's regulated 3.3 volts and so avoid the changing contrast problem. The relays have coils that are specified to work over the voltage range 3.75V up to 6V: they do actually work from 3.3V, but they are operating outside their specification. Luckily the standard cheap relay boards have opto-isolators that work fine at 3.3V and then the option to use a separate power supply for the coils - by connecting the coil supply straight to the power source (which must be at least 4.2 V if you want to charge standard LiPo cells) the design is fine for input voltages up to 6V.
Here's a photo of the components used.
Beware that the relay boards come in at least two different sizes. It would be easy to design a case to suit one size, but then solder up the connections on a different board that doesn't fit the case. Ask me how I know!
Here's the case design.
And here are all the gubbins wired up. Note that I hid some of the wiring underneath the boards, so as to make the tangle of wires look slightly less disgusting!
Here's a circuit diagram. Click on any photo to see a bigger version.
Note that the GND connection into the INA219 module is taken from the negative terminal of the battery being charged - and that GND wire then doesn't continue to the Arduino or anywhere else - all the other GND connections are taken from a separate GND wire from the GND input terminal. Although the two GND wires are connected to each other up at the terminals, this separates the 'analogue ground' in which virtually no current flows, from the 'digital ground' which carries more current and more electrical noise. It's best to wire it this way as the INA219 is then able to more accurately measure the voltage of the cell on charge.
Single cell charger / discharger
-
- Posts: 766
- Joined: 16 Feb 2018, 14:11
- Location: Warwickshire
Single cell charger / discharger
- Attachments
-
- charger_case_STL.zip
- STL (3D printer) files
- (79.34 KiB) Downloaded 229 times
-
- singleCellCharger.zip
- Arduino source code (sketch)
- (6.46 KiB) Downloaded 249 times
Last edited by Martin on 05 Sep 2018, 15:42, edited 4 times in total.
-
- Posts: 44
- Joined: 25 Feb 2018, 13:10
Re: Single cell charger / discharger
Looks like another great project.
- Wayne_H
- Posts: 824
- Joined: 17 Feb 2018, 05:26
- Location: Temora, NSW. Australia
- Contact:
Re: Single cell charger / discharger
And there I was earlier tonight looking at the I2C lcd module in my box of bits, wondering what I was going to do with it (true story, really!!)
Problem solved - thanks Martin
Problem solved - thanks Martin
Cheers,
Wayne
Once a Retrobate, always a Retrobate............
Wayne
Once a Retrobate, always a Retrobate............
- tiptipflyer
- Posts: 404
- Joined: 16 Feb 2018, 22:49
- Location: Germany
Re: Single cell charger / discharger
Just finished my Single Cell Charger.
Yesterday I was charging and discharging all my single cell lipos to test it out. It works great.
I had to change a few things to make it work properly. At first the lipo voltage was showing only about half of the actual value, so I changed the sketch to multiply the busVoltage by the factor 2.05 to give accurate readings.
The charging and discharging current also showed about half the actual value, so I changed the definition for the shunt resistance value to 0.05 instead of 0.1039 0hm.
No everything was working great. I have no idea why it was showing only about half the values. I veryfied everything with my DMM, all numbers are spot on now.
I had a great time building it and trying to understand, what´s going on.
Thank you Martin for the project.
BTW, I am using a charge resistor of 12 Ohm, charge current is about 110mA, and a discharge resistor of 56 Ohm for a discharge current of about 75 mA. Power will come from a 5V Cell Phone charger. And I also got the wrong size relay panel (Murphy did it). Cheers
Frank
Yesterday I was charging and discharging all my single cell lipos to test it out. It works great.
I had to change a few things to make it work properly. At first the lipo voltage was showing only about half of the actual value, so I changed the sketch to multiply the busVoltage by the factor 2.05 to give accurate readings.
The charging and discharging current also showed about half the actual value, so I changed the definition for the shunt resistance value to 0.05 instead of 0.1039 0hm.
No everything was working great. I have no idea why it was showing only about half the values. I veryfied everything with my DMM, all numbers are spot on now.
I had a great time building it and trying to understand, what´s going on.
Thank you Martin for the project.
BTW, I am using a charge resistor of 12 Ohm, charge current is about 110mA, and a discharge resistor of 56 Ohm for a discharge current of about 75 mA. Power will come from a 5V Cell Phone charger. And I also got the wrong size relay panel (Murphy did it). Cheers
Frank
-
- Posts: 766
- Joined: 16 Feb 2018, 14:11
- Location: Warwickshire
Re: Single cell charger / discharger
Nice one Frank!
I don't really understand why the voltage and current were both wrong. The current is measured by the volt drop across the resistor on the sensor board so would obviously change if the resistor value was different - but I thought they all had the same nominal (0.1 ohm is it?) thing fitted by default. The voltage shouldn't change from chip to chip as far as I know, even when you change the current range.
If you have a spare INA219 module you could try that. I had some weird readings on the first one I built (not a factor of two, but some other weird error). I spent ages trying to find out why but in the end swapped the module and then it worked perfectly. I tried three other modules and they were all good too. I chucked the faulty one in the bin before it could cause me any more grief!
It seems that with your unit, perhaps the I2C communications aren't working quite right and getting shifted by one bit? That might explain the factor of 2 error. Perhaps it's some strange interaction with the I2C drive to the LCD - did you have to change the settings for that as perhaps you have a different LCD I2C adapter to the one I used?
Of course it doesn't matter if your charger is working accurately and reliably, but if you want to investigate further you could perhaps put some temporary print statements in the program to (also) display the voltage via the serial terminal - and that would then allow you to disconnect the LCD display and see if it makes any difference to the voltage displayed via the serial connection.
I don't really understand why the voltage and current were both wrong. The current is measured by the volt drop across the resistor on the sensor board so would obviously change if the resistor value was different - but I thought they all had the same nominal (0.1 ohm is it?) thing fitted by default. The voltage shouldn't change from chip to chip as far as I know, even when you change the current range.
If you have a spare INA219 module you could try that. I had some weird readings on the first one I built (not a factor of two, but some other weird error). I spent ages trying to find out why but in the end swapped the module and then it worked perfectly. I tried three other modules and they were all good too. I chucked the faulty one in the bin before it could cause me any more grief!
It seems that with your unit, perhaps the I2C communications aren't working quite right and getting shifted by one bit? That might explain the factor of 2 error. Perhaps it's some strange interaction with the I2C drive to the LCD - did you have to change the settings for that as perhaps you have a different LCD I2C adapter to the one I used?
Of course it doesn't matter if your charger is working accurately and reliably, but if you want to investigate further you could perhaps put some temporary print statements in the program to (also) display the voltage via the serial terminal - and that would then allow you to disconnect the LCD display and see if it makes any difference to the voltage displayed via the serial connection.
- tiptipflyer
- Posts: 404
- Joined: 16 Feb 2018, 22:49
- Location: Germany
Re: Single cell charger / discharger
Thanks Martin,
the charger is working very reliable. I tried it now two days all day long charging and discharging all my single cell lipos and checking the voltages and currents all the time. No problems encountered, everything is spot on.
I also think, that either the INA219 or the I2C module caused the trouble. I will change the INA219 to another one, just to verify it.
Cheers
Frank
the charger is working very reliable. I tried it now two days all day long charging and discharging all my single cell lipos and checking the voltages and currents all the time. No problems encountered, everything is spot on.
I also think, that either the INA219 or the I2C module caused the trouble. I will change the INA219 to another one, just to verify it.
Cheers
Frank
- tiptipflyer
- Posts: 404
- Joined: 16 Feb 2018, 22:49
- Location: Germany
Re: Single cell charger / discharger
Just installed my spare INA219 module and the original sketch, the lipo voltage was now spot on, no more multiplying by 2.05, but the charge current showed more than 3000 mA without the charge program being started. So there is obviously something wrong with the cheap chinese INA219 modules.
I reinstalled the first module and changed the sketch again, now everything is working as it is supposed to do. All values are spot on. I will leave it as it is, it is working perfectly.
Cheers
Frank
I reinstalled the first module and changed the sketch again, now everything is working as it is supposed to do. All values are spot on. I will leave it as it is, it is working perfectly.
Cheers
Frank