DIY Electric Car Forums banner

NG3 chargers can't current limit on lithium batteries?

60284 Views 144 Replies 21 Participants Last post by  jollmo
We've been using an NG3 charger for the last several years to charge our lead acid pack. We originally had Electric Conversions install an optional low current mode switch on the NG3 so that we could charge on a standard 15 amp outlet while at work.

We're in the process now of upgrading our pack to lithium. Before we purchased the new batteries we had contacted Electric Conversions regarding modifying our NG3 to handle the lithium batteries. They said they would be able to modify the charging profile for our configuration.

Now, after just receiving the charger back from Electric Conversions we noticed that the low power option had been removed from our unit. They failed to mention this little detail to us. I contacted them and all I was told was we can't current limit on lithium batteries and it would take to much time to do. If you can current limit on lead acid why not lithium? If the hardware of the NG3 supports current limiting on lead acid it should be just as capable of current limiting on lithium. I realize that it might require a separate charging profile or something but it can be done.

My plan now is to figure out the profile programming of the NG3 and modify it myself. I have a lot of professional experience in reverse engineering electronic systems and feel that it can be done. I know a lot of people have been down this path before on here and have found some decent information. If anyone has information about the NG3 charger that would help speed up the process it would be appreciated.

Two lessons here, NG3s don't currently have a current limiting capability on lithium and avoid Electric Conversions. After reading some of the other posts on here, I'm not the only one to have problems with this company.
1 - 20 of 145 Posts
We found the schematics online for the NG3 charger's control logic and have verified them, so we're already close to resolving our problem. Ideally we would replace the entire control board because it's outdated at best. But, the far simpler approach is to just replace the existing socketed microcontroller with a more modern device. This will require developing a small adapter module with the new chip and additional I/O that can plug into the existing socket. Going this route would allow others to be able to modify their charging profiles and add additional features without the need for sending them in, as is required now.

We are primarily interested in adding a selector switch that will allow us to charge in both high power and power modes. However, we have seen others inquiring about various mods to their controllers. We're interested in finding out what others might want added to their NG3?

We would considering selling these modules if anyone was interested. We're curious to find out what the the interest level might be in these devices?
See less See more
Just put the finishing touches on our NG3 charger upgrade. Since Electric Conversions left us high and dry, we had to modify our charger ourselves in order to allow charging at different rates. We ended up replacing the outdated socketed microcontroller with a newer PIC on an adapter board. The prototype is up and working great, we can charge now at four different rates, easily adjust the CV point, and if we lose a cell at some point we can quickly recover.

We're not planning on releasing this as a formal product at this point but if anyone finds themselves in a similar situation we will be glad to assist them in doing the same.


See less See more
The only connection I use on the board is a standard 6 pin programming/debugging header for the PIC. I use a cheap ($45 at Digikey) Pickit3 USB programmer/debugger from Microchip to interface to the board. I had to bend the pins slightly (something to change if I ever do another version) in order to be able to connect the Pickit to the board while it is installed in the charger.

I added another set of input pins inorder to measure the input power as well as the output power; however, in order to keep things simple I'm just measuring the output and applying an average efficiency correction value.

The circuit boards cost me $35 and the components another $10. I already had the Pickit and the Microchip MPLAB software (with Hi-Tech Lite C compiler) was free. All total it cost me less than $50.
We only have our one NG3 unit to test so it's hard to say for certain regarding the other NG models. My guess is most likely yes on the NG1 and almost certain on the 240V NG3. To the best of my knowledge Zivan uses the same control board and firmware for the different models. What primarily changes are the power components.

I've attached the schematics of the digital control board. I did not create the schematics myself, I found them online a while back but can't find where now to give them proper credit. I can say that they matched perfectly to my NG3 120Vac 144Vdc unit.

If possible, I would recommend opening your charger up and seeing what type of control board is inside. If the programmable chip being used is a 28 pin ST62T25B6 then you're probably set.

I will post my device's schematics and my prototype PIC code here shortly once I have had a chance to fix a few things and document them better. Additionally, I will build the hardware module for anyone interested for say $35, just to cover my costs. This will NOT include programming. It will be up to the end user to program the device and verify that it is working properly. The reason for this is because we are not in this for the money so we also don't want to take any liability should any battery packs be destroyed.

Anyone wanting to use one of these devices will need to be able to do some very basic programming. That said, PIC programming, especially with my example code provided, should be extremely easy.

I'll post more as time permits.


See less See more
Unfortunately, the only programmer that will work with my module is Microchip's PicKit3. Even the PicKit2 doesn't support the newer PIC chip that I used. Microchip does sell other programmers that would work but they are more expensive and would require a pin adapter. You can buy a new PicKit3 from Digikey for $45 or used one off of Ebay for around $20. Ebay also has cheaper PicKit3 clone devices but we can't say for sure if they work or are reliable.

I've went ahead and made a few small improvements to the module from the original prototype. I documented the schematics and attached them here.

I'll clean up and document my prototype code as well. I'll try to get it posted as soon as I can find some time.


The schematics for the logic board and my replacement microcontroller replacement module have already been posted here. I will try to have my sample code cleaned up, documented, and posted here within the next few days but please bear with me. I will have to order more boards before I can sell the modules to anyone, but I'd like to find out what the interest level is before I place the order. So please just send me an email for now stating that you'd like to buy one. But before you do, I would recommend that you examine your controller and see if the logic board inside is similar to the picture of mine that I posted.

Keep in mind that the logic board schematics are for a 144Vdc out version of the NG3. Your model of NG charger may have some different valued resistors, shunts, and voltage bias points. More than likely my module will still work but you may have to run a few additional tests and measurements. I will try to explain more in detail later.

There are only two settings to configure for the controller, a voltage limit and a current limit. For my unit, I have two external toggle switches that I mounted to the NG3 case and then connected to the C0 and C1 pin header inputs which are found right next to the LED. When the program starts it reads the position of the two switches, telling me which of four current limit settings I want to use. I then set the voltage set point and the desired current limit. All that is left is to set the SOFT_START pin low in order to enable the charger output.

Once the charger output is enabled, nothing else is technically required. The charger will current limit at the desired set point during CC until it hits the CV point, at which point it will maintain voltage, naturally decreasing current. If you did nothing else in your code the charger would just stay at the CV point forever. So, you can setup your charger to do just about whatever you want. You can stop charging immediately at the CV point, you could stop after a certain period of time in CV, or you could stop at a minimum charge current.

In other words, you can set your charger up to be a simple CC/CV single stage charger, or you can make it as absolutely complicated as possible.
Then there are the LEDs, the AUX relays, and the sounder. Again, do what you want with them. Hopefully when I post my code it will become clearer.
See less See more
I completely agree with everything in that post. The power stage of the charger is great. The control board though is pure crap. I had originally planned on replacing the entire control board until I opened up the charger and saw what was in volved in having to completely dissassemble the charger, cut out and desolder the old control board, resolder in the new one, and hope that everything would go back together without having those extra pieces left over that always seem to show up. I decided on the easier route of just replacing the socketed chip. I figured it would be much easier for others as well to just replace a chip on their own.

Yes, you can use the temperature probe input to control the board anyway you want. The probe input circuitry is shown on page 6 of the original schematics. It's signal just shows up as an analog signal at one of the a/d pins of the PIC. So, in other words, once you sample the voltage you can do anything you want with it. For our own setup, we are not currently using the temp probe so we don't yet have temperature compensation built into our code.

In documenting my code, I'm trying to make it as simple as possible for everyone with different versions of the charger to work with. I understand how my 144Vdc out version works; however, I don't yet have a good feel for all of the different versions (voltage and chemistry types) of chargers out there. For example, my NG3 was originally configured as a 144Vdc 15A lead acid charger. When they modified it to LiFePo all they did was change the chip, add a jumper, and maybe tweak the pots. However, I'm currious if there are any real changes they make for other chemistries. Here is why I'm asking, in Zivan's user manual they discuss the cell tension, which for lead acid is 2.0V. This 2.0V tension is what my 144V charger is based off of, which I will try to explain later. But they state the tension for other chemistries is different. I'm curious if they actually used different hardware settings for the cell tension for example if you originally bought say a NiCd charger.

Here is why I consider my 144Vdc charger to be based off of a 2.0V cell tension. This is all based on the circuitry that is on the right half of page 1 of the control board schematics. U7A generates a buffered reference voltage (Vref) 1.954V. U6D buffers the voltage divided battery input. If my battery pack is at 144V and the voltage pot is set to 0 ohms (left schematically) then the buffered voltage (Vbatt_divided) out is 1.999V. If the battery pack voltage is 144V and the voltage pot is set to 2k ohms (right schematically) then the output is 2.588V. This tells me that there is a 481k ohm voltage divider resistor on the power board. Likewise for a 144V system, they assume 12 batteries with 6 cells each or 72 total cells. Again the voltage divider math works out 6.8k + 2k + 481k =~ 490k, or another way to look at is 6.8k ohms/cell * 72 cells = 490k.

So, the voltage that the A/D (Va/d) of the PIC sees is:

Va/d = ( Vbatt_divided - Vref ) * (100k/15k)

From this, and assuming the pot is at 0 ohms, I can set my CV point anywhere from 140.7V to 195.1V before I clip the A/D input. If the pot is at 2k then it is reduced to between 110V and 150.1V.

The big question is, given the range of possible CV setpoints, do all different versions of the chargers have slightly different hardware or does it skip every 48V or so? Obviously I would expect some differnces beween say a 72V system and a 144V but what about systems that are closer in output? For example I might expect that a 156V system with an additional 6 cells would have a voltage divider resistor on the power board that is 521.8k. Any thoughts or measurements that can be made would be appreciated.
See less See more
Thanks for the info, it both reaffirms what I was thinking and confuses me even more. I would expect with a 2.7V cell limit and 24 cells that your limit would be 65V as well. If you adjusted your pot I would expect the limit to only go down from there.?????

Unfortunately, my logic board is all surface mount and the ones in the pictures are through hole components, making it difficult for me to do a direct comparison.

I think at this point the best to get a few boards out and just let you guys help run some tests. I'll work on getting some boards ordered and assembled as soon as I can.

So here it is, the prototype code. It's not as complete as I'd like yet but I think everyone will be able to figure it out and modify it to their needs. In order to compile it you will need to download Microchip's MPLAB and Hi-Tech's PIC18 Lite C compiler. (both free). The text file is just the code. The zip contains the entire MPLAB workspace and project files.


If you're not careful and pay close attention to what you're doing there is the real possibility of damaging your controller or worse, your entire pack. I'm trying to help people here, not destroy their vehicle or burn down their garage. A careful review of the possible hazards is well worth a little bit of time.

There aren't currently any timers in the prototype code. This will need to be added if you want to use them.

The nice thing though about the MPLAB design environment and the PicKit3 for programming/debugging is that you can set break points and monitor variables within the PIC device. This makes troubleshooting your initial setup a snap. I recommend anyone who wants to use one of these modules become familiar with the debugger and watch variables.
Sorry for the delay, I've been sidetracked. Boards are in, parts are in. I just need time to get them assembled and tested. I'll try to get them done soon.
Ok, I have a number of boards built, tested, and ready to go.

If you are interested in purchasing one please send an email to [email protected]. I know some of you already have but please resend so I know who is still interested. I'll then send you an email invoice.

The cost for one of these units is $40. Shipping is an additional $5 for standard addresses in the US. Programming of these units will also require that you purchase a PicKit3 programmer.

Please remember that these are experimental units and the specific profile programming is left up to the end user. Everything (LEDS, relays, fans, charging profile) on the charger is now programmable/customizable so assume nothing. Using one of these units will void your warranty and we assume no responsibility for any damage that may occur from there use.
You've missed the entire point of these boards. You should read from the beginning of the post. The guys at Zivan USA are the ones that do not understand their own charger.
Well, I receive the chip today. Thanks! Can't do much until I also receive the programmer I found on eBay.
Let me know if you have any questions. I realize there isn't a user's manual yet.

My recommendation is to get familiar and run the device outside of the charger first. You can use the PicKit to power it with 5V and run through the code. You'll want to get familiar with the debugger and your watch variables.

Once you have an understanding of how to operate the device and how to use the debugging environment, you can install the device in the charger. You'll then want to disable the power provided by the PicKit and allow the charger to provide the 5V power to it.
Have you experimented with getting more than the rated 10 amps out of your charger?
Can't say that I have. I've usually been more concerned with turning down the output. We're lucky to even find a 15A outlet around here.
I have loaded MPLAB-X and the Hi-Tech compiler. After many false starts I loaded the program from the firmware file and I was able to see the ngc.c file. I edited the CV lines to lower the voltage to fit my car. BTW, my charger has a 470k resistor between the battery and the control board. I clicked on the build and clean tab and numerous errors returned. My charger has a 16 position rotary switch connected to the programming pins. Only the first four positions of this switch are used.

If anyone has any ideas how to proceed, I'd like to know.

Two things to check:

1. Make sure you opened the ngc.mcp project file, not just the ngc.c source code file.

2. Check to see that the Hi-Tech C compiler is selected under PROJECT->SELECT LANGUAGE TOOLSUITE->HI-TECH UNIVERSAL TOOL SUITE

If this doesn't help, post or email me your errors.
The project file is actually an MPLAB8 version. MPLAB8 really isn't that bad but it looks like there is a conversion function to take version 8 project files to X version.
Any smoke or fireworks? It would be nice if we could figure out what happened.From the sounds of it your charger might still be ok. If the main relay still clicks and you have the yellow LED then most of the charger is working. This is the default behavior without a chip installed. Any chance the chips were installed backwards or have a bent pin? When you programmed the chip did you use the PicKit in debug or programming mode?
The PIC is a 5v unit. When its installed in the charger you have to allow the charger to provide the 5v. If you try to power the charger's entire 5v system through the PIC it's not happy.

I normally operate in debug mode but your final programming of the chip needs to be done in programmer mode. Your program won't start up without the debugger if it's only programmed in debug mode.

The trim pots still play a role with the new chip. I don't have much time so I'll try to answer this more tomorrow but what is your battery configuration? You'll likely need to modify the equations and set your pots to a specific position. The debugger comes in really handy here.
Sorry, its been a while. Ok, not sure where to start.

Brent, sounds like your chip is being programmed correctly but that the equations will need to be modified. This is where the debugger is required but since your charger is a 72V unit we can make some educated guesses to get started.

The first line you need to change is for the cell_voltage_setpoint on roughly line 144. Remember, the charger thinks everything is lead acid and works off the notion of the lead acid cell. For me, I had 12 12V lead acid batteries so I had 72 cells. If you had 6 12V batteries (or equivalent setup) for your 72V, then you'll need to change the 72 cells to 36 cells.

The next equation you'll have to modify is the voltage equation on line ~185. This will be derived from the comments just above, but again replacing the 72 cells with 36. This should give you now:

voltage = ((float)voltage_bits) * 27 / 1024 + 70.34

And again, that is assuming the rest of the logic board is the same. Which I believe it is based on everyone's input here. Then there are the current equations but lets start there for now.

Bob- Do you know if your charger is a 132V or a 144V model originally?

I'm a little puzzled by what you're seeing. I would expect the fans to come on if you're hearing a beep. The LED wouldn't be yellow either.

Again, my recommendation is to use the debugger. I would start off using the debugger with the chip out of the charger. All you need is the chip and the PicKit. Set the PicKit to debugger mode and have it provide 5V power to the chip. Then program your chip and use the "step into" command to walk line by line through the code. This is the best way to understand what the chip is doing. Monitor your watch variables as you go. You can set breakpoints at certain points in the code to and then hit run. The program will run until it gets to that point and then it will stop.

Once you can walk through the code and understand it outside of the charger, then you can install it and do the exact same thing. Then you can see where the program is having problems. Without using the debugger it's almost anyone's guess as to what is going on.
See less See more
1 - 20 of 145 Posts