# Recreating a battery charger to learn LTspice and EasyEDA

#### rebelrider.mike

Joined Feb 2, 2024
27
I've got lots of NiMH cells around to power all sorts of things. But it seems that when I need a fresh set, I've always got to charge them first. I came across a video by Big Clive where he built a little trickle charger that was good for NiMH and NiCad cells.

First, I was curious about the thing he mentioned where when the cells are full they form oxygen and hydrogen on the electrodes, but then it recombines into water. So the cell neither vents nor dehydrates. I don't understand it all, but apparently, NiMH cells can be maintained by a very small current without damage.

Second, I was interested in how to choose the various components to build the charger. I don't know if Clive did a bunch of math off camera, or just intuited it, but rather than simply copy what he did, I want to see how it all works. I've been trying to learn LTspice, and this seems a good project to simulate.

Third, I thought it would be neat to finally get one of those custom PCBs that You Tube DIYrs are always advertising. So I figure this would be a good project for using EasyEDA too. I came across this video of a tour of JLCPCB, and thought it was rather fascinating:

Anyway, starting with the cells, I've read that a safe trickle charge current is 0.03-0.05C. My cells have 2,600mAh (I tested some) so to be on the safe side, I went with 0.03C which works out to 78mA. I've also read that NiMH cells have around 50mΩ internal resistance.

I drew up the schematic (with only 1 cell for now) in LTspice, and this is what I got:

I used the modified Ohm's Law (R=(Vt-Vf)/If) to find the resistor value for the power indicator LED, and LTspice agreed with my math. But I used the same equation to find the resistor value for the charge indicator LED, and LTspice says I'm way off. Either I'm using it wrong, or my math is wrong. Maybe both.

I've got some parts on the way, so I can build this circuit temporarily to see what the real values are. I wonder if it has something to do with there being a cell in the circuit that isn't the voltage source. Like maybe the voltage is causing some sort of "push back" against the forward current, and that's why the resistors have to be a smaller value?

It's late, but maybe tomorrow I'll try something like R=(Vt-Vf-Vc)/If where Vc is the cell voltage. I wonder if that would mean that putting a discharged cell in would allow too much current through the LED because of the lower cell voltage...

#### rebelrider.mike

Joined Feb 2, 2024
27
I spent some time searching around the internet, but haven't found any circuits like this, or anyone trying to do math like this.

I've simplified the circuit to only include the voltage source, the cell being charged, and the resistor to limit current. Now the only variables should be the voltage of the cell, and the resistance of the cell and resistor.

According to LTspice, I need a 46.74Ω resistor to limit the current to 0.078A. If I simplify further, and remove the battery, then I would need a 65.38Ω resistor for the same current. It seems the battery is acting like an 18.64Ω resistor rather than the 0.05Ω internal resistance that I'm using. I don't know how to explain this. Maybe I've entered the battery into LTspice wrong? Or maybe it has something to do with the fact that the battery has its own voltage and I'm not taking that into account somehow?

I wonder if I should be subtracting the cell voltage from the source voltage right away since they're apposed to each other. Maybe if I search for 2 sources in parallel. That's kind of what's happening here.

#### crutschow

Joined Mar 14, 2008
34,386
According to LTspice, I need a 46.74Ω resistor to limit the current to 0.078A. If I simplify further, and remove the battery, then I would need a 65.38Ω resistor for the same current. It seems the battery is acting like an 18.64Ω resistor
No.
The removal of the battery means the battery voltage is no longer opposing the charger supply voltage, so there is 1.45V more voltage across the resistor which, from Ohm's law, increases its current.

If you want the current to be independent of the battery voltage, you will need an active-circuit (transistors, etc.) constant-current source.

#### rebelrider.mike

Joined Feb 2, 2024
27
The removal of the battery means the battery voltage is no longer opposing the charger supply voltage, so there is 1.45V more voltage across the resistor which, from Ohm's law, increases its current.
I think that is exactly what I've been doing wrong. This time I went through and subtracted the cell voltage from the source voltage, as well as the voltage drop across the cell (based on the internal resistance) and got the exact number that the simulator wanted.

In addition, I took one of my freshly charged cells and set it up in a real-life circuit and got nearly the same results.

I also calculated the internal resistance of the cell using IR=ΔV/ΔA. I don't have the best measuring equipment, but I got around 0.2Ω rather than 0.05Ω like the internet suggested. I've been told that internal resistance of a cell will change depending on the cell's state of charge. But "full" is the one I'm interested in.

With all that figured out, I'm now able to add the other components back in, and the simulator still agrees with my calculations.

I can now limit the LED current to 25mA, and still get 78mA through the cell. Just for fun, I asked the simulation what the LED current would be if I were to put a 0.9V depleted cell in. Around 40mA is what I got back. That doesn't take into account the change in the cell's internal resistance though. I don't know how much it would change though.

#### rebelrider.mike

Joined Feb 2, 2024
27
I've got the rest of the charger designed, and the ideal resistors have been replaced with ones that are actually available. Didn't change the current significantly.

Next is to design the circuit board with EasyEDA. I have all the parts already except those two resistors I was having trouble figuring out.

#### rebelrider.mike

Joined Feb 2, 2024
27
The wiring diagram in EasyEDA was pretty easy.

Not every component has a corresponding "footprint" to go with it. Seems I need those in order to design the actual circuit board. Still working on the measurements of the cell holders, but this is what I've got so far:

It looks a lot like Big Clive's board, since that's what inspired the project in the first place. What other way would the cells be configured though? I did move the power LED to the top. I just like it there better.

#### rebelrider.mike

Joined Feb 2, 2024
27
I finally got all the parts together today. Also, I'm trying out my new work mat.

It all went together pretty easy, except for the LEDs. Not sure if the soldering iron was getting them too hot or something else. But they kept failing after installation. Eventually I got all 5 working though. These LEDs are not new. I found them in a stash of old electronic parts. It could just be age making them fragile. But now that they're in, they seem to be fine.

Hard to tell from the picture, but the power LED is on as well as the indicator for the 4th cell. Each LED is getting about 2.4V, which is what I was hoping for. I'm not sure yet exactly how I want to power it. I'm thinking of making several of these for different sized cells, and building some kind of enclosure for it that uses a single power cable. I made sure to include several holes for mounting.

#### rebelrider.mike

Joined Feb 2, 2024
27
After maintaining 2 cells for about a day, the numbers settled to about 1.66V and 74.9mA. I was shooting for 1.46V and 78mA, but the real numbers are close enough for me. I decided to add an older 2.1Ah cell, and after a while I took a thermal picture:

The resistors are a little warmer than I'd like, but I think they'll be ok. I also found an old NiCd 600Ah cell that turned out to be at 0V. It didn't take long to boost it up to 1.4V with a manually controlled power supply, and I added that to the maintainer too.

The whole board uses 0.33A which is exactly what I figured it would. So at least I got that number right. From what I've read, NiCd cells can accept 0.05-0.1C as an indefinite trickle charge. So I figure this one should be fine in the maintainer. It's gotta be better than sitting around at 0V right?

#### Audioguru again

Joined Oct 21, 2019
6,687
Energizer Ni-MH manual says that a Ni-MH battery should never be trickle-charged at more than 1/40th of its capacity rating. Their AA cells are 2300mAh then the maximum trickle-charge is 2300/40= 57.5mA.

When I used NiCad cells many years ago most ended-up shorted when trickle-charged.

#### crutschow

Joined Mar 14, 2008
34,386
NiCd cells can accept 0.05-0.1C as an indefinite trickle charge.
As noted by AGA, NiMH batteries are not as tolerant of trickle charge as the old NiCds.
You need to limit the charge current accordingly.
But most new NiMH batteries hold a high percentage of their charge for a year of more, so don't need to be trickle-charged.

#### rebelrider.mike

Joined Feb 2, 2024
27
I probably won't keep the Energizers in there for long. Just seeing how things behave for now. The Tenergy cells are what I designed the board for, and they're higher capacity than the Energizers. I may only store a couple cells at a time.

After a couple days, the Tenergy cells are working out fine sitting at about 1.5V with 70mA going through them. The Energizer is a bit higher voltage than I'd like. About 1.6V. Not surprising since it's lower capacity. The Sanyo NiCd is also a bit high at 1.7V with about 60mA going through it. A bit high, but within the 0.05-0.1C that most sources suggest.

I don't really care about the longevity of the Sanyo. At 600mAh it would take 4 of them in parallel to equal the capacity of a single Tenergy. I'm just curious to see what it does.

I've had these cells for a long time, so they're pretty old. I've tested randomly selected ones on occasion and they still have very close to their rated capacity. I'm curious to see if the ones that get put in the trickle charger degrade faster than normal.