Need help with AA battery charger circuit.

Using LTSpice 4.2.1 on Win8.1.

I found an AA battery charger circuit that I’ve modeled in Spice and want to make sure I have wired it together correctly. The design comes from http://www.eeweb.com/blog/extreme_circu … nimh-cells. It is based on an LM317 voltage regulator. The LM317 mfg doesn’t provide a Spice model, so I created one from .SUBCKT code I found here http://www.electro-tech-online.com/thre … del.18270/. There are three different SUBCKT examples provided in that forum thread, and I have tried them all, but am thinking the one provided by member Optikon (.SUBCKT LM317/TI in adj out) is the best choice.

I have attached my Spice schematic and all the models and subckt code, but let me know if I forgot anything.

I didn’t know what to put in for a battery that is being charged, so I put in a battery load resistor and made two runs - one run uses a 0.02 ohm value representing a fully charged set of four AA niMH, the other run uses double the battery resistance because I’ve read that small battery resistance increases as batteries discharge up to a max of about 0.04 ohm (http://www.powerstream.com/1922/battery … pter08.htm).

I set R5 to 250 Ohm. The original circuit uses a 500 Ohm trim pot, so I chose the mid value.

If you look at my Spice runs, the one on left is fully charged batteries, on right is fully discharged. V[n003] is at the +V1 node; V[n004] is at + side of BATTERYLOAD resistor.

I have some questions:

  1. Is using a load resistor with these values wrong? The graphs are identical - this can’t be correct.

  2. Why would I be seeing negative voltages at the +load resistor?

  3. If I make the load 4000 Ohm the voltage across the load doesn’t change, but its current goes to a trickle.

Thanks for helping!

Bob

The model for the battery being charged is probably not appropriate. It is not a simple resistor. One possibility would be a variable voltage source opposing the charge voltage, but here are some others: http://ltwiki.org/?title=Modelling_a_Ni … y_modeling

jremington:
The model for the battery being charged is probably not appropriate. It is not a simple resistor. One possibility would be a variable voltage source opposing the charge voltage, but here are some others: http://ltwiki.org/?title=Modelling_a_Ni … y_modeling

Thanks for the circuit - I will try it out and report back.

Bob

jremington:
The model for the battery being charged is probably not appropriate. It is not a simple resistor. One possibility would be a variable voltage source opposing the charge voltage, but here are some others: http://ltwiki.org/?title=Modelling_a_Ni … y_modeling

I replaced the battery load resistor with the battery model you found, but I’m getting error “Unable to find definition of model “tbl”” when I run it. (I’ll place the full text below.) I can’t understand the error. The battery model had a test circuit, which runs fine - using the exact same .subckt NH15-2.5. Thought I’d check back here for ideas on what could be wrong?

Thanks,

Bob

FULL ERROR


Error on line 167 : c:v2:2 v2:1 v2:k=tbl m= 0 0,1.1,108,1.2,1k08,1.26,3k6,1.27,7k2,1.34,8k64,1.4,9k)

Unable to find definition of model “tbl”

  • Unknown parameter “0”

WARNING: Node N003 is floating.

WARNING: Less than two connections to node V2:K. This node is used by C:V2:2.

.OP point found by inspection.

Date: Tue Oct 21 18:22:23 2014

Total elapsed time: 7.128 seconds.

tnom = 27

temp = 27

method = modified trap

totiter = 2781

traniter = 2781

tranpoints = 1292

accept = 1232

rejected = 60

matrix size = 82

fillins = 127

solver = Normal

Thread vector: 23.8/15.5[2] 7.3/4.5[2] 3.2/2.1[2] 0.5/1.0[1] 2592/500

Matrix Compiler1: 20.3 KB object code size 3.7/2.0/[1.3]

Matrix Compiler2: 11.1 KB object code size 1.0/1.1/[0.8]

Error on line 167 : c:v2:2 v2:1 v2:k=tbl m= 0 0,1.1,108,1.2,1k08,1.26,3k6,1.27,7k2,1.34,8k64,1.4,9k)

The above line appears to be malformed; missing some parentheses and other characters. Post the actual Spice file that is causing the error. Or, if you check the box for "expanded netlist" under "setup" (hammer symbol) in LTSpice you will be able to see the expansion of the subcircuit in the error log.

jremington:

check the box for “expanded netlist” under “setup”

Thanks for that tip! It helped me solve the problem, which was due to a missing Q in the .subckt NH15-2.5 that’s posted at ltwiki. The author did include the correct .subckt in his test file, so I just copied it into my schematic.

So, now my battery charger schematic uses a model for the Ni-MH batteries, rather than a load resistor, and the Spice analysis does now run, but the results are still confusing. My V1 is 12 Vdc and uses a simple 60 second transient. This seems right to me because I want to see what charging voltage and current the batteries see. The confusing part is the negative voltage (-5.33V) across the batteries. Seems like this is incorrect and would damage them. Maybe I have the LM317 hooked up wrong?

I’ve attached all the files, in case you have time to review and clear up my confusion.

Thanks - I appreciate your help,

Bob

The negative voltage is a mystery to me. I don’t see anything obviously wrong with your circuit.

I tested two of the LM317 models from TI, as posted in that thread – in my hands the output voltage is way too high, using 240 ohm resistors as R1 and R2 in the feedback path. However, I don’t think that could cause the negative voltage.

That leaves the battery model. According to the post this model was tested in discharge mode, so maybe it doesn’t work for charge mode. It is not an easy model to understand.

The best test is to build the circuit and see how it performs with real parts.

jremington:
The best test is to build the circuit and see how it performs with real parts.

Yes, I agree. I’m starting it now.

Thanks,

Bob

carpenterdev:

jremington:
The best test is to build the circuit and see how it performs with real parts.

Yes, I agree. I’m starting it now.

Thanks,

Bob

I’m finished building and testing the charging circuit, and am updating this topic.

The circuit as last uploaded works perfect. It charges a set of four AA NiMH 2550 mAh Eneloops in series. I discharged the batteries to 4.76V, then plugged them into the bread boarded charger circuit which is supplied 12Vdc. I replaced R5 with a pot and adjusted it so charger output is 5.25V. After 3 hrs the battery pack voltage rose to 5.14V; after 4 hrs it was at 5.16V. Using an IR Thermometer, I am only seeing a 1 degF temperature rise in the LM317 VReg, and the battery temperatures have risen 2 degF.

I now need to figure out how to get the RED/GRN D4 LED to turn from RED to GREEN when V1 (charger 12V supply) is turned OFF, and the batteries are discharging. The BiClr LED has a common anode. The RED cathode is wired into the circuit as shown by D4. Any ideas on how to wire up the GREEN cathode so that it is ON when the batteries start discharging?

Thanks,

Bob

That circuit was not intended to be connected to the battery permanently. The battery will discharge fairly quickly through R4 to R7, etc… To prevent that, you need to add a blocking diode and to raise the float charge voltage by about 0.7 V.

jremington:
That circuit was not intended to be connected to the battery permanently. The battery will discharge fairly quickly through R4 to R7, etc… To prevent that, you need to add a blocking diode and to raise the float charge voltage by about 0.7 V.

Thanks for pointing that out.

I modified the circuit to include D4 & D7 blocking diodes. The bread boarded circuit seems to work fine. I discharged the batteries to 3.35V overnight, then plugged them into the circuit and turned the 12V PS on and charged them to 5.23V.

I then added the circuit branch for the Bi-Color LED and increased R2 to 383 ohms. This is causing the batteries to charge to 5.23V after 24 hours. The charging current is 0.21mA when battery voltage is 5.16V. The LEDs are working correctly - the RED LED glows when the 12V PS is connected, and the GRN LED glows if I disconnect the PS and leave batteries connected. If I measure V2 with batteries disconnected I read 6.83V.

I’d like to modify the circuit so that the RED LED turns off when the batteries reach 5.25V. Any ideas on how I’d do that?

Thanks,

Bob

I’d like to modify the circuit so that the RED LED turns off when the batteries reach 5.25V. Any ideas on how I’d do that?

I solved it by moving the input for R8 to the Adjust pin on the LM317. Now the bi-color LED turns from RED to GRN when the battery voltage reaches 5.25V.

Thanks,

Bob