# NG3 chargers can't current limit on lithium batteries?



## dexion (Aug 22, 2009)

customcircuits said:


> 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.
> 
> ...


 
Not that it helps you much (but perhaps you can fix it yourself) but if you search the battery/charging forum I documented my modifying my ng3 for lithiums from lead.
Really was a piece of cake and it will limit current i dont belive it would care what battery chemistry you use a voltage limit is a voltage limit. Sounds like they set it too high. There are 2 settings on the ng3 you can change ending voltage and ending current. If you are around the correct voltage from lead (ie if you had a 144Vdc model and use 48 lifepos you are fine.) I went from a 156vdc to 52 lifepos lowered the ending voltage and fininshing amperage without removing the charger from the car. It will actually finish charger and go green but I like to charger to 80% so i use a timer. When i ballance i let it go green.


----------



## rfhendrix (Jan 24, 2011)

I know I'm off the subject but maybe someone can help me here. I have an ng3 programmed for a 144 volt lead acid pack. I used it the first time on a new pack of batteries and it worked fine. I believe the voltage was about 151 when I started the charge and I ended about 152. After I discharged the pack some to about 150 volts I decided to top off the charge again but now I get a "battery not detected" alarm. Zivan has not answered my emails yet. The connections are good and I am getting 150 volts to the unit. Can someone help me?


----------



## customcircuits (Dec 21, 2008)

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?


----------



## rfhendrix (Jan 24, 2011)

customcircuits said:


> 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?


I would certainly be interested down the line. I expect my lead acid pack to last two years more and then I will be switching to lithium. And I am not too happy with the company.


----------



## customcircuits (Dec 21, 2008)

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.


----------



## DIYguy (Sep 18, 2008)

Wow, nice job! Now that should helps some folks. This is what a DIY forum is all about. 

Perhaps you can explain the connection and programming method?


----------



## customcircuits (Dec 21, 2008)

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.


----------



## GizmoEV (Nov 28, 2009)

That is awesome, Dave. Any idea if the same modification will work with the NG1 or the 240V NG3? Also, is it possible to program the charger to stop when the current dropped to a particular value after reaching the CV stage?


----------



## customcircuits (Dec 21, 2008)

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.


----------



## GizmoEV (Nov 28, 2009)

Thanks for the info. I found that the Old_NG3_Logic.pdf file can be found at http://aaron.birenboim.com/EV/ I also found that Greg Solberg could be one of several people including a firmware engineer at Tesla but I didn't search any further. His name is at the bottom of the schematics pages.

I'll open my NG3 and NG1 and take pictures of the control board. Maybe we can determine if this mod can work in the NG1 as well.

As for programing the chip, I have a Melabs U2 Programmer, will this work for programing? I should be able to figure out the code from your example since I've programmed in BASIC, Pascal, FORTRAN, and various command languages 15+ years ago.


----------



## customcircuits (Dec 21, 2008)

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.


----------



## cbliss (Jun 28, 2010)

I am interested, how would we go about getting the hardware and 'sample' code?


----------



## palmer_md (Jul 22, 2011)

very interesting. Does this mean we can now set our own charge profiles in the software, or is this still hardware limited.

For example, I have an old NG3 that was used to charge 120v lead acid, and I'd like to change the profile to something for 144v LiFePo4. Can I set the CV point and then a minimum current cutoff that terminates the charge?


----------



## GizmoEV (Nov 28, 2009)

palmer_md said:


> Can I set the CV point and then a minimum current cutoff that terminates the charge?


If the minimum current cutoff can't be set then merely lower the ending voltage like I have done with my NG1 and NG3. I'm ending at 3.465vpc right now and the number of Ah which go into the pack after the charger drops into the "yellow" phase is actually quite minimal so charging times really aren't that much longer.

Depending how the timer is done it could be that when the current drops to a particular point the timer counter could be incremented/decremented appropriately to end the charge.


----------



## customcircuits (Dec 21, 2008)

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.


----------



## bgeery (Oct 17, 2011)

This is really exciting. Zivan makes a great charger but the lack of interest in making true Lithium charge curves is going to hurt them in the near future. With the flexibility added by this mod chip I think we have probably the best charger for the money. These things go for cheap refurbished.


----------



## Elithion (Oct 6, 2009)

bgeery said:


> Zivan makes a great charger but the lack of interest in making true Lithium charge curves is going to hurt them in the near future.


The ideal curve for Li-Ion is a plain old CCCV, nothing fancier. Your plain Lead-Acid charger (no "profile") will work just great with Li-Ion. As long as the BMS (you do have a BMS, right?) is able to shut the charger on or off, your Li-ion pack will be charged most efficiently and completely by such a charger. Zivan knows that.

Please see "the 3 stages of Li-Ion charging": read or watch.


----------



## bgeery (Oct 17, 2011)

They are pawning off lead acid charge profiles to those that ask for a lithium charging, or asking for a $600 minimum charge to create a proper and true CCCV charge profile. There currently is NO generic CCCV charge profile to choose from Zivan. With all the lithium conversions going on, you think you would have taken the time to create even one generic CCCV profile. They don't care. They have good hardware, but the top people at ZivanUSA suck IMO.

Thankfully this mod chip clears up the whole issue and the only time I'll ever deal with ZivanUSA is if the charger breaks. Everyone happy (and BMS free).


----------



## GizmoEV (Nov 28, 2009)

I wonder if the temperature compensation is taken care of in this logic chip? If so, it seems that the pins for temperature input could be used for input to control the charger externally: to turn down the current or shut it off completely.

FWIW, Attached are photos of the logic boards in my 115V NG1 and 230V NG3 both with the same programming. The paper work says it is the ZV curve #7 but the sticker on the chip says ZV6, in any case it is set for 69.3V Saturation and the current just tapers down close to zero until the timer during the "yellow" phase times out.

I don't think there is anything wrong with using a re-purposed lead acid curve except that the proper charge profile for LiFePO4 calls for a CCCV curve which terminates when the current drops to 0.05C. For my 200Ah pack that would be 10A, just barely above what the NG1 can do. I compensate by charging 20 cells to 69.3V or 3.465vpc which may still be a little high.

Here is the NG1 115V control board:










Here is the NG3 230V control board:








https://picasaweb.google.com/lh/photo/X7hGcRCA5ZHTl6CRz91NFNMTjNZETYmyPJy0liipFm0?feat=directlink


----------



## bgeery (Oct 17, 2011)

GizmoEV said:


> I wonder if the temperature compensation is taken care of in this logic chip?


Check out http://endless-sphere.com/forums/viewtopic.php?f=16&t=9167 for some temp probe (and general) info.


----------



## GizmoEV (Nov 28, 2009)

Yes, that is a great thread. What I was wondering is if the chip does the actual controlling of the ending voltage then the replacement unit could be programmed to take input on the same pins and do something different with it.


----------



## bgeery (Oct 17, 2011)

GizmoEV said:


> Yes, that is a great thread. What I was wondering is if the chip does the actual controlling of the ending voltage then the replacement unit could be programmed to take input on the same pins and do something different with it.


I see. Well it depends on how the probe is wired. The way I understand it, the chip sees a reference voltage that has some relationship with with the actual measured pack voltage. We can manipulate this reference voltage using the voltage pot. If Zivan wired the probe "inline" with this signal line I would think we could only use it only for it's intended purpose of lowering or raising the voltage setpoint. If the probe really is on it's own signal line then we probably can use that as a signal line as you wish to. With the right programming you should be able to signal on the line any number of variables using a multi position switch with different resistance values or just a SPST switch for a simple binary hi/low signal.

If what you're ultimately after is simply a CC/CV charge profile that terminates charge at 0.05C I don't think we need anything more than the mod chip itself. The way I understand it, just like voltage the chip sees a reference signal corresponding in some way to the charger current output, so it would be a simple matter for the chip to terminate charge once the current drops to the specified reference level. The reason I believe the chip must receive a current reference signal is because manipulating the current pot lowers and raises current output of the charger, even in Phase one (CC) mode.

If we can use the temp probe, I'd like to use it as a temp probe, but at proper correction value for LiFePO4 cells. The best reference I have to what that might be is the Thunder Sky owners manual that suggests raising charging voltage 100mVpc at -35degC. This implies a temperature compensation of -1.82mVpc per degC standardized at 25C. At 110 degrees that's a 79mVpc drop in voltage, or almost 2 volts with 25 cells.


----------



## bgeery (Oct 17, 2011)

Found an interesting old post on EVDL at http://www.diyelectriccar.com/forums/showpost.php?p=7580&postcount=17


----------



## customcircuits (Dec 21, 2008)

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.


----------



## bgeery (Oct 17, 2011)

Dave posted pictures of his NG3 and NG1. Same (output) voltage ranges but different current capabilities. Most of the resistor values are readable. Can this help answer your question? I'd assume 99% of the Zivan chargers out there started life as Pb chargers. My hunch is each model uses different hardware revisions for the power section and the logic section is generic between them.


----------



## GizmoEV (Nov 28, 2009)

When I had my NG3 reprogrammed I was told that it couldn't go much high enough in voltage, it was originally a 48V lead acid version, and they wanted to sell me an Elcon. I told them that they programmed my NG1 and it worked fine and that I had personally seen another NG1, programmed for 48V lead acid, put out 72V so they programmed it the same. The NG1 which I got to put out 72V was originally purchased with a NiZn profile which was reprogrammed for "8 T-875s or equivalent" before I got it. I just dialed in the ending voltage to 72V when I initially started charging a LiFePO4 pack before sending in the ones in the pictures I posted to get properly programmed.

From this I assume, like Brent said, that the basic hardware is set for different voltage ranges like both of my Zivans were built for a 48V lead acid setup, and then they have a 72V range and then maybe a 120 or 144V version. The original sticker on both my current Zivans say that 66V is the max voltage they will allow so it makes sense that they could actually put out a little above that. IIRC, the pots are 15-20 turn pots.

I'm not sure what or how I would need to take measurements on mine but let me know and I'll do my best. I have an Extech EX830 meter so I should be able to measure most anything on these if I'm told what and where.

I do want to get a board, maybe two, at some point.


----------



## customcircuits (Dec 21, 2008)

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.


----------



## GizmoEV (Nov 28, 2009)

customcircuits said:


> 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.?????


I'm guessing that the 66V was a safety limit. I never saw my pack go that high, 62V IIRC. Playing with the voltage pot got it up to 72V on a LiFePO4 pack.



> 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'm sure my chargers aren't the newest.  As long as the control logic is the same it shouldn't matter. I do know that I couldn't have different profiles programmed into my NG3 except that the sticker on the front seemed to indicate that there were different options based on jumper settings. I played around with them one time and found I could get different current settings which appeared to correspond to what I would expect with different capacity packs. Maybe it is only the newer surface mount type which had the option of different charge profiles.



> 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.


Do you have any idea what could happen in the worst case situation testing the a different logic board? Any chance that something might burn up in the charger due to over current or is there enough in place that maybe the worst that could happen is messed up voltage settings and timeouts? If only the latter then that is easy to deal with. Just babysit the pack when charging and unplug the charger if things go wrong.

For my NG1 I can just plug it into my Kill-a-Watt meter but I might want to get some way to measure the current out of the wall for my NG3. What do you think?


----------



## bgeery (Oct 17, 2011)

GizmoEV said:


> Do you have any idea what could happen in the worst case situation testing the a different logic board? Any chance that something might burn up in the charger due to over current or is there enough in place that maybe the worst that could happen is messed up voltage settings and timeouts? If only the latter then that is easy to deal with. Just babysit the pack when charging and unplug the charger if things go wrong.


Have you taken a look under the stickers to confirm both your units are using ST62T25B6 microcontrollers? I'll check mine next time I have cause to tear out my dash for access. If they are, then this mod chip adapter will at least be electrically compatible and no harm will come from testing it out. We still might find that some singlal lines were crossed or something like that, but that won't physically damage the charger in any way (and would be easy to fix in software.)

BTW, I was reading an old thread from 2005 mention the reprogramming fee was only $40 back then. ZivanUSA is double that now.


----------



## customcircuits (Dec 21, 2008)

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.


----------



## GizmoEV (Nov 28, 2009)

bgeery said:


> Have you taken a look under the stickers to confirm both your units are using ST62T25B6 microcontrollers? [...]
> 
> BTW, I was reading an old thread from 2005 mention the reprogramming fee was only $40 back then. ZivanUSA is double that now.


No, I'll have to do that next time I get a chance. As for reprogramming cost, that is progress right?  Maybe the extra cost is so they don't have to answer our questions.


----------



## bgeery (Oct 17, 2011)

customcircuits said:


> 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.


Hi Dave. Any news on the boards yet? Just checking in.


----------



## customcircuits (Dec 21, 2008)

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.


----------



## bgeery (Oct 17, 2011)

customcircuits said:


> 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.


That's great! Take your time, I was just curious as to how things were going.


----------



## RWAEX (Jul 13, 2011)

Thanks for providing the schematic of the NG3 control board. Now I have a chance to replace the board with one which I'll design using discrete parts. I have been retired for 20 years and never did learn programming so I have to stick with the old fashioned way. I was stonewalled by the NG3 rep when i told him I had changed to lithium. I was always hopeful to get the Zivan reprogrammed, but in the meantime I designed a charger from scratch. It provides 10 amps at 135 volts. It starts with a button and stops when the current reduces to 1 amp. The hot parts are built on a heat sink and there is a fan. So far, so good. I have been thinking of making a 220v version so I could increase the current to 15 amps. BTW, my car is the 914 that I bought from Steve, who has a blog with lots of details of the car. My charger is modular and i will include schematics of each of the 5 modules after I learn how to convert them to pdf files. They are now *.eps.
Bob


----------



## bgeery (Oct 17, 2011)

RWAEX said:


> My charger is modular and i will include schematics of each of the 5 modules after I learn how to convert them to pdf files. They are now *.eps.


 zamzar.com will do an online converion of EPS to PDF. There are plenty of other free sites as well as software out there.


----------



## RWAEX (Jul 13, 2011)

I was able to convert my files to pdf. Now they are too big to insert. I'll work on that.

Bob


----------



## bgeery (Oct 17, 2011)

RWAEX said:


> I was able to convert my files to pdf. Now they are too big to insert. I'll work on that.
> 
> Bob


If you ZIP comprees the PDF file, the message board allows up to 2.38MB attachments, instead of the measly 97.7KB it allows for most others.


----------



## RWAEX (Jul 13, 2011)

I shrunk the files.


----------



## customcircuits (Dec 21, 2008)

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.


----------



## Elithion (Oct 6, 2009)

That's all nice and well, but, I hate to tell you, you don't need to modify the Zivan NG3 to work with Li-ion. On the contrary, the nice thing about the NG3 is that it's a plain old CCCV charger, which is perfectly ideal to use with Li-ion (in conjunction with a BMS). 

During balancing, you do not need to ask the charger to lower the current to match the balancing loads' current. Instead, the BMS will take care of not allowing the cells to be overcharged, by switching the charger on and off, such that the _average _current matches the balancing loads' current.

After the pack is balanced, with a plain CCCV charger, the current will _naturally_ go down to 0 A as the pack is topped off. That is due to physics pure and simple, not to a charger profile. So, again, there is no need to tell the charger to reduce the current. (This is true independently of a BMS.)

Please read The 3 stages of charging, or, in video form.


EDIT: I take this part back: I do see the need for a way to program the Zivan _voltage _at your convenience. I was too hasty when I addressed just the title of the thread: "NG3 chargers can't current limit on lithium batteries". Sorry.


----------



## customcircuits (Dec 21, 2008)

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.


----------



## GizmoEV (Nov 28, 2009)

Elithion said:


> That's all nice and well, but, I hate to tell you, you don't need to modify the Zivan NG3 to work with Li-ion. On the contrary, the nice thing about the NG3 is that it's a plain old CCCV charger, which is perfectly ideal to use with Li-ion (in conjunction with a BMS).


They are a pain to get reprogrammed to what we want! I had to ask for a profile for 19 cells so that it was at the right voltage for 20 cells given that the ending current tapers to near zero. Furthermore, it costs about $100 to make a simple change.



> During balancing, you do not need to ask the charger to lower the current to match the balancing loads' current. Instead, the BMS will take care of not allowing the cells to be overcharged, by switching the charger on and off, such that the _average _current matches the balancing loads' current.


But if you applied that to my system the way the chargers were originally programmed it would have taken for ever to get my pack charged. I went from 48V lead acid to 20 cell LiFePO4. Your method wouldn't have worked very well with my charger the way it was.



> After the pack is balanced, with a plain CCCV charger, the current will _naturally_ go down to 0 A as the pack is topped off. That is due to physics pure and simple, not to a charger profile. So, again, there is no need to tell the charger to reduce the current. (This is true independently of a BMS.)


And my data shows that after the pack is balanced it doesn't need to continually be balanced on every charge. Furthermore, the charge procedure is to charge to 3.6V and end the charge when the current drops to 0.05C which is 10A in my case. If the ending voltage is lower then the ending current can be lower without overcharging the cells.



> But now, I am afraid that you're better off leaving the NG3 charger as is, and let your BMS do its job.


And that is where many of us disagree with you. Besides the BMS vs no BMS debate, why would you remove one of the safety mechanisms in a charging system? What you are proposing is that a BMS never fails. It is made by humans so it is not *if* it will fail it is *when* it will fail. By having a properly programmed charger to shut off when it should, entirely on its own, you stand a better chance of your pack being protected when the BMS fails to do its job. Why wouldn't you want this redundancy?

Given the data I have on my pack so far, and that of others, the pack does not have to be balanced on every charge provided that there are no bum cells in the pack. Having a user programmable Zivan means that I can do a balance charge and then easily reprogram the unit to not charge to such a high voltage until the BMS signals that a cell is getting out of line and needs to be balanced again. My data suggests this is easily a year or more. I believe others have gone even longer.


----------



## Elithion (Oct 6, 2009)

GizmoEV said:


> They are a pain to get reprogrammed to what we want!


Ah! Right you are!



GizmoEV said:


> ...the pack is balanced it doesn't need to continually be balanced on every charge


I never said it did. You are correct.

The first time you charge balancing takes a while. Once the pack is balanced, in the following charge cycles the balancing phase may last just a minute or so. If you wanted to, you could rig something to skip the balancing phase after the first time, but why go through the trouble?


----------



## GizmoEV (Nov 28, 2009)

Elithion said:


> If you wanted to, you could rig something to skip the balancing phase after the first time, but why go through the trouble?


To prolong the life of the pack by not over charging it every time it is charged.


----------



## Elithion (Oct 6, 2009)

GizmoEV said:


> why would you remove one of the safety mechanisms in a charging system?


Actually, a "Li-ion profile" is not a safety mechanism. That is because, if the pack is not balanced, and there is no BMS (or the BMS as failed), long before you reach the low current portion of the profile, the charger will still pump full current into the most charged cell, which will become overcharged and may explode. 

On the other side, if the pack is balanced, the current will _naturally _go down, without the need for a "Li-ion profile".

However, setting the correct top voltage of the charger _is _a redundant safety mechanism, and I am all for it: if the pack is balanced, even if the BMS fails, the pack will not be overcharged.


----------



## Elithion (Oct 6, 2009)

GizmoEV said:


> To prolong the life of the pack by not over charging it every time it is charged.


Balancing does not harm cells. At least not the way balancing is done by all the BMSs I am familiar with.

On the contrary, balancing maximizes pack capacity.


----------



## GizmoEV (Nov 28, 2009)

Elithion said:


> However, setting the correct top voltage of the charger _is _a redundant safety mechanism, and I am all for it: if the pack is balanced, even if the BMS fails, the pack will not be overcharged.


And that is why this NG mod is being made. It is being made to provide multiple charge current options, a user settable ending voltage, and the option to properly terminate the LiFePO4 charge procedure which includes the ending voltage and ending current. The last item, ending current, is what so many seem to miss/ignore continually.


----------



## Elithion (Oct 6, 2009)

GizmoEV said:


> The last item, ending current, is what so many seem to miss/ignore continually.


I am one of those people. Please do explain. (Seriously.)


----------



## GizmoEV (Nov 28, 2009)

Elithion said:


> Balancing does not harm cells. At least not the way balancing is done by all the BMSs I am familiar with.
> 
> On the contrary, balancing maximizes pack capacity.


Do you have data to back that up? After balancing, disconnect the cells and let them sit for a few hours. What voltage do they rest at? If it is over 3.4V then the cells were over charged and their life shortened.

As for max pack capacity, have you done your own tests to see how much capacity is really above 3.4V? I have. I started with a TS-LFP100AHA cell resting at 3.397V and charged it 4.00V. The cell accepted only 0.6588Ah. Why over stress the cell for less than 1% of its capacity. I'm giving up less than 1 mile of range for a longer life pack.


----------



## Elithion (Oct 6, 2009)

GizmoEV said:


> If it is over 3.4V then the cells were over charged and their life shortened.


Yes, absolutely.



GizmoEV said:


> As for max pack capacity... I started with a TS-LFP100AHA cell resting at 3.397V and charged it 4.00V. The cell accepted only 0.6588Ah.


Yes, absolutely.


----------



## GizmoEV (Nov 28, 2009)

Elithion said:


> I am one of those people. Please do explain. (Seriously.)


Naturally the idea is to be able to fully charge the cell without overcharging. A fully charged LiFePO4 cell rests at 3.4V, if it rests above this voltage it is overcharged. One option is to charge to 3.4V and just hold it there but then it would take a very long time to fully charge the cell. To compensate for the ESR of the cell, which raises terminal voltage while charging, the charging can be to a higher terminal voltage than 3.4V but then the ending cutoff current needs to be increased the farther above 3.4V the ending voltage is set. The most common charging procedure I have seen is to charge to 3.65V and end when the current drops to 0.05C. For my 200Ah 20 cell pack that would mean I should charge to 73.0V and hold that voltage until the current drops to 10A and then terminate charging. When the cells settle down they will be resting at just under 3.4V or 68.0V for my particular pack. Continuing to charge below the cutoff current of 0.05C can/will overcharge the cells. Last I checked your BMS doesn't balance at or above 10A which means you have to continue charging until the current drops to the programmed shunting current (or the BMS tells the charger to begin throttling back the current) and hold that current for a time to maintain the voltage of the highest cell at 3.65V or the shunting voltage until all cells have matched up. Even with a balanced pack this 3.65V is held with a current significantly lower than 0.05C which means that the cells are being over charged.

Test it out like I said in a previous post. "Balance" the cell and disconnect all loads from it and let it sit for a few hours then measure the terminal voltage. If it is resting at over 3.4v it was overcharged.


----------



## Elithion (Oct 6, 2009)

GizmoEV said:


> Naturally the idea is to be able to fully charge the cell without overcharging....


Yes, I see where you're coming from, and I fully agree with your understanding. Thank you for taking the time.



GizmoEV said:


> Last I checked your BMS...


Actually, that is not quite how the Lithumate BMS works. But that's besides the point. The point is that I fully agree with all you said about how cells should be treated.


----------



## bgeery (Oct 17, 2011)

Well, I receive the chip today. Thanks! Can't do much until I also receive the programmer I found on eBay.


----------



## octagondd (Jan 27, 2010)

GizmoEV said:


> A fully charged LiFePO4 cell rests at 3.4V, if it rests above this voltage it is overcharged.


David, I am curious if you could point me in the right direction for the data regarding the resting voltage for LiFePo4 cells. This is a very interesting discussion and I want the specs and/or data to look at with regard to what voltage a fully charged cell sits at. Are SE cells different than TS or any of the newer ones in regards to resting voltage?

Thanks,
Dave


----------



## customcircuits (Dec 21, 2008)

bgeery said:


> 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.


----------



## bgeery (Oct 17, 2011)

customcircuits said:


> Let me know if you have any questions. I realize there isn't a user's manual yet.


It'll probably be a couple of weeks to receive the clone Pickit 3. Hopefully David already has the debugger in hand and will have a lead on me.

Have you experimented with getting more than the rated 10 amps out of your charger? Using the trim pot and the stock chip, I'm able to adjust it up to 13.9 amps with no ill effects so far.


----------



## customcircuits (Dec 21, 2008)

bgeery said:


> 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.


----------



## bgeery (Oct 17, 2011)

customcircuits said:


> 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 forgot you'er running around 160V. My GEM NEV peaks out at about 85V while charging. 85V * 13.9A = 1181 Watts. Well below the 1800 Watts a standard 120V 15A outlet will handle. That extra 40% is appreciated.


----------



## bgeery (Oct 17, 2011)

Has anyone else ordered and received their chip yet? I'm still waiting for the programmer and would enjoy hearing from others that are already playing with the device.


----------



## RWAEX (Jul 13, 2011)

I have my PIC and I am trying to learn how to use the tools. I have downloaded MLAB-X and the HI-TECH compiler and they are installed. I was able to load the text file in Notepad and edit the voltage to 135 volts. My control card has a 16 position switch plugged into the pins next to the socket. While I was waiting, and before I started trying to program, i tried to get the charger to start without the micro in the socket. There was one line from the ADM chip which stayed down and inhibited it from starting. These projects are supposed to teach us some humility.

Bob


----------



## RWAEX (Jul 13, 2011)

My NG3 was originally with my 914 when it had 20 6v batteries, or 60 cells. My charger is open and I can see that there are two 470k resistors connected to the battery plus terminal. One goes to pin 12 and the other goes to pin 15 on the control board.

I want to set one of my switch positions to have a minimum current such that I can turn on the charger with a light bulb load to determine the output voltage without having the battery connected.

I have MPLAB-X up and some files loaded. I found that I can edit ngc.c to change the volts and amps but I don't yet know that all the files are in the right place.

Bob


----------



## Zak650 (Sep 20, 2008)

Hi,

I have a NG1 do any of you guys that are familiar with these chargers know anything about the two pin jumper that can be moved to different positions along two rows of pins? Is it for different chemistries? They are located close to the din socket on the NG1.

Thanks


----------



## RWAEX (Jul 13, 2011)

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.

Bob


----------



## customcircuits (Dec 21, 2008)

RWAEX said:


> 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.
> 
> Bob


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.


----------



## RWAEX (Jul 13, 2011)

I have learned a few things. When I went to the firmware folder and clicked on the red icon, the program opened in MPLAB8 and the only error I saw was that I didn't have my pickit3 connected.

When I installed MPLAB-X and loaded the mplab legacy project with the same red icon, numerous errors appear.

It seems better to try to proceed with the first option. I was able to edit the voltage to 135 v. and I may be ready to connect my pickit3 and the chip and run. The nice thing about MPLAB-X is that there is a lot of hand holding along the way and MPLAB8 looks like it's made for the pros.

Bob


----------



## customcircuits (Dec 21, 2008)

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.


----------



## bgeery (Oct 17, 2011)

*Charger dead. Watch out.*

Well I changed the voltage and current values, programed the chip and verified programming, swapped out chip in NG1. All I got when plugged in was a click from the relay and a solid yellow LED. Swapped back to old chip and got same thing. NG1 now dead and on it's way back to Zivan for repair. Wish I would have charged the batteries before the swap. No wheels for a few weeks. Thanks for trying anyway.


----------



## customcircuits (Dec 21, 2008)

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?


----------



## bgeery (Oct 17, 2011)

customcircuits said:


> 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?


Could have been backwards. I oriented pin one to match the old chip's pin one. I think I programmed in debug mode. I'm not shipping until tomorrow so I could pay with it some tonight, but not hopeful. I'll try rotating the old chip 180 degrees and see if I get some life showing.


----------



## bgeery (Oct 17, 2011)

OK, I'm an idiot. When I put the old hip back in I reversed it. I also just broke a pin on the old chip taking it back out! 

I reprogrammed the new chip, but this time *not* in debug mode. I installed the new chip, and get the beep, and the LED is green this time, and fan is off. So, I beleive it thinks the pack is already at or above the charge voltage and ends charging instantly. How do the voltage and amperage trim pots currently work with the new chip? Do they have any effect right now? It's either the trim pots or the formula used to derive pack voltage from the reference voltage is not applicable for the NG-1.

Time to go solder that pin pack onto the old chip. I don't have a clue what's the matter with me today.


----------



## bgeery (Oct 17, 2011)

Is this a 3.3 volt or 5 V PIC? I've played it safe so far setting the voltage at 3.65 (3.38 at the PIC).


----------



## customcircuits (Dec 21, 2008)

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.


----------



## bgeery (Oct 17, 2011)

25 LiFePO cells. Been charging at ~86V (~3.45Vpc) until amps drop to ~1 Amp.

When Zivan reprogramed my NG1 for lithium, they replaced the entire logic board. This new board has a row of five jumper pairs, not four. They are labeled MD, C0, C1, TP, and AH. TP is the pair currently shorted.


----------



## RWAEX (Jul 13, 2011)

I have my PIC and I have been struggling to understand it. Finally I am using MPLAB 8.4 and the compiler v9.8. Note that I downloaded the compiler as a Pro version but in the Lite mode. That is the only way to get the right version. Then I loaded MPLAB and the compiler on a computer that had not been contaminated and connected the Picket3. It told me I had no target so I connected the chip. I put the chip in a breadboard and applied 5v. I continued until the screen said "program verified". Next, I put the chip in the charger with a dummy load of 2 light bulbs in series and applied power. The result was a beep, no fan and a yellow light. Oh, I edited the c file to 135 volts and saved it before any of the above. Does anyone know what I should do next?

Bob


----------



## bgeery (Oct 17, 2011)

RWAEX said:


> The result was a beep, no fan and a yellow light. Oh, I edited the c file to 135 volts and saved it before any of the above. Does anyone know what I should do next?


Hopefully Dave will have more time soon to hand hold us through the process. You are getting about what I'm getting, except you'er getting a yellow light where I was getting a green one. What model do you have? I have the NG1 72 volt version.


----------



## RWAEX (Jul 13, 2011)

My charger is an NG3 which was originally used on my 914 with lead. It charged the lead to about 140 volts. When I went to lithium, I only wanted 135 volts for 40 cells. Zivan was unresponsive, so I designed my own charger, 135 volts at a maximum of 10 amps. With this design, I am able to set the voltage with no load, then press a button to start the charging. It shuts off at one amp. I used an available chassis to mount everything and it is too big to fit under the hood, which the Zivan does nicely. It would be nice if the control board in the Zivan were on a removable connector. For a fixed application, there is very little justification for Pic control, but I would surely try to use the Pic before I would try to rip out the present control board. There is also the intriguing possibility I could learn something about programmable hardware. If I do, I may never be the same again.

Bob


----------



## customcircuits (Dec 21, 2008)

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.


----------



## customcircuits (Dec 21, 2008)

I had a few more questions that I was emailed, that I will answer here.

1. Is there a way I can fake a battery pack (e.g. 2 x 10A ceramic
> heaters) so I can test my code without having the pack connected to the
> charger? I've still got a fair way to go before I'm ready to connect the
> batteries, but I'd like to get on with coding before as soon as the
> replacement arrives.

You can fake it out but since the heaters don't behave the same as the batteries you won't really be able to verify very much. If you just want to test things like is it running or how to operate the buzzer/fans/relays, you can disconnect the battery and the chip will still run. Another test you can do is to run the chip with the SS = 0; (line ~196) commented out. This will disable the charger output but still allow the chip to measure the pack voltage. 

> 2. WRT the current calculations - my charger is 230V 19A in, 144V 18A
> out. Can I just use say 19 ma per bit rather than your 11 ma? or do I
> have to measure it?
> 3. Also, will I need to change the .047 divisor for the digital_pot_bits
> setting (line 154)?
> 

Both of these will have to be changed. If we knew for certain what specific current sensing transformers and amplifier gain values were used for the different charger models we could figure out an exact equation, but unfortunately we don't. I didn't even know for sure what mine was so I just measured it. Remember, it's also a function of the current pot setting. 

The way I figured mine out was to hard code the digital_pot_bits (line ~152) to a specific value. I then enabled the output and measured the actual current with a clamp on current meter as well as the voltage that was measured by the chip on line ~172. This means using the debugger to view the current_bits in the watch variables. 

From these measurements I was able to create a table that I used to figure out the constants used on lines ~154 and ~188. For example, since the digital_pot_bits is an 8-bit value (256 possible settings), I made measurements every 64 values or (0x40, 0x80, 0xC0,...). If you do it correctly, you should be able to generate two linear plots, one for actual current vs digital_pot_bits and another for actual current vs current_bits. You can get your two constants from the slope of these lines. It's not as bad as it sounds.

> I am assuming the Voltage constants won't need to change since it's
> still 144V...

Since you have a 144V system your constants should (I say should but I can't guarantee) be the same. What you have to verify though is that the voltage variable (line ~185) is seeing the correct pack voltage. The way to verify this is to measure your pack voltage with a meter, then use the debugger to get the voltage value seen in the watch variables. If they are off, and they likely will be, you will need to adjust the voltage pot until they agree.


----------



## RWAEX (Jul 13, 2011)

I think I posted that I got a beep when I plugged in the chip. I can't repeat that. The programming indicates that it is complete. In the debug mode it seems to hang at the sounder, whether I single step or run. I went back and tested the original chip and it still works as it did, which voltage is too high for lithium.

In the programming and debug modes I have the chip mounted in a breadboard. I did learn that I can supply 5v from the picket or not. I also used an external power supply.

Bob


----------



## CrunchTime (Feb 13, 2009)

customcircuits said:


> > 2. WRT the current calculations - my charger is 230V 19A in, 144V 18A
> > out. Can I just use say 19 ma per bit rather than your 11 ma? or do I
> > have to measure it?
> > 3. Also, will I need to change the .047 divisor for the digital_pot_bits
> ...


Can I measure the current by using the heater trick? Can the charger limit itself even through a short? I guess the voltage will be wrong without having the pack though.



> > I am assuming the Voltage constants won't need to change since it's
> > still 144V...
> 
> Since you have a 144V system your constants should (I say should but I can't guarantee) be the same. What you have to verify though is that the voltage variable (line ~185) is seeing the correct pack voltage. The way to verify this is to measure your pack voltage with a meter, then use the debugger to get the voltage value seen in the watch variables.


So this I can't do until I have the pack set up. It's going to be a pain debugging this in the car - I'll need a 30 meter USB cable for the PICkit 3


----------



## RWAEX (Jul 13, 2011)

I have been able to program the chip and the report is that it is successful. Then I switched to the debugger and used the animate mode. It slowed down when it got to the sounder so I lowered the numbers temporarily and then the program stuck trying to set up the A/D. The line where it stopped is where it says to wait.

BTW, my windows do not show line numbers and that would be nice while chatting about the program.

Bob


----------



## customcircuits (Dec 21, 2008)

Bob - If you're using MPLAB there should be two ways to get the line numbers. One is to enable them by right clicking on the editor and selecting properties, then "C File Types", and enable line numbers. The other way is just to click on a line in the editor and look at the very bottom of the MPLAB IDE window. It should say Ln ###, Col ###.

I don't recommend using the animate feature. It slows things down like you say when it comes to loops. For example, if you want to start at a particular place in the code, set a break point to it and then hit run (without animate enabled). Then you can single step through the specific parts of the code you want. 

CrunchTime- This is where my laptop came in a little handy. 

You might be able to use a heater to test your current and voltage settings but I'm doubtful. Without testing it or probing around a little more on the controller I can really say for sure. My concern is that the output stage is a switcher and not really designed for a primarily resistive load. You might end up getting a large AC switching component in your readings that would be hard to detect and make sense of without o-scoping it. 

If you do end up trying the heater, start out with the current limit set extremely low and work your way up. I certainly wouldn't try it into a short either.


----------



## GizmoEV (Nov 28, 2009)

octagondd said:


> David, I am curious if you could point me in the right direction for the data regarding the resting voltage for LiFePo4 cells. This is a very interesting discussion and I want the specs and/or data to look at with regard to what voltage a fully charged cell sits at. Are SE cells different than TS or any of the newer ones in regards to resting voltage?
> 
> Thanks,
> Dave


Sorry for the delay in responding. I've been dealing with two family emergencies at once so I'm a bit behind.

This is really a bit OT for this thread but I'll post a few things to investigate. Unfortunately I haven't found a single definitive source for this information so I have had to glean from multiple sources including user's experience (and mine), user reports, technical papers and the like.

Watch this video for a good overall understanding to LiFePO4 cells. I recommend watching it more than once if you want to get a better understanding of things: http://chargecar.org/blog/main/Battery_Tech_Talk

This paper is very technical. I originally read it to learn why manufacturers say not to charge LiFePO4 cells when they are below 0°C. If you know your physics and/or chemistry you can get some info out on voltages. It is not for the "faint of heart".  http://www.tinhoahoc.com/Battery/cr030203g.pdf

There used to be a CALIB spec sheet which showed 3.4V as the "float" voltage but I can no longer find it. I also had an email from someone who posted on the EVDL, they worked for a LiFePO4 battery manufacturer, that in testing that they could fully charge a cell if it were held at 3.4V long enough. I gathered that this was quite a long time but he didn't say how long. He also wouldn't disclose which manufacturer he worked for.

Jukka Järvinen has been testing and using LiFePO4 cells for many years. Search for his name on the EVDL and you will come up with posts by him. Basically he says that if a cell rests above 3.4V then it is evidence that all the Lithium has been moved from one side to the other indicating a fully charged cell. I do know that it takes very few ions to be transferred for the voltage to go from 0V to 3V so it makes sense that a similar thing happens at the fully charged end which my testing agrees with. For the older TS cells he said that they only need to be pushed to near 4V once in a while and at low currents. Charging them to lower voltages between them is definitely beneficial for life span.

Jack Rickard (evtv.me) has done quite a bit of battery testing but it takes a while before you can glean enough info from him to understand why he makes the claims he does. Over the past 2-3 years I have pieced together enough info from him to agree with him on the 3.4V number.

The documentation which came with my TS cells in 2009 say to stop charging when the current drops to 1% of what it was to start with where 0.5C was recommended. This would be an ending current of 0.005C which is quite low. Using this method left cells sitting above 3.5V for several days. I don't know how much of that was due to capacitance of the cells and how much was due to actual Li charge storage. Remember, these LiFePO4 cells are also big capacitors with their hundreds of plates separated by a dielectric.

Finally, the best thing you can do is get some cells and equipment and play with them.

HTH, now I'm going to keep watching this thread because I want to be able to program my Zivan chargers for LiFePO4 charging with both a voltage and current cutoff.


----------



## RWAEX (Jul 13, 2011)

With my latest attempt to program, I got a beep and a green light. My selector switch is in position 4 for which I have the minimum current set to zero. 

A switcher like this should be able to operate with a minimum load. I know the rule of thumb is for a bleeder that provides 10% load, but my charger operates with a much lower load. I am providing the Zivan with two 100w bulbs in series for a load. There is a battery sense line on the control card but it is apparently sensitive to a voltage too high.

I still don't have a good debugging procedure down. I have tried both the mplab internal and the picket3. When programming, should I be in release mode?

Bob


----------



## customcircuits (Dec 21, 2008)

Bob - What do you mean by "I have tried both the mplab internal and the pickit3?" 

I would recommend your final programming (once you have everything working) be done in release mode but generally there really isn't much difference between debug and release mode.


----------



## RWAEX (Jul 13, 2011)

The Mplab internal debugger I referred to is Mplab sim, which one of the tutorials suggested using.

I have had success in getting the supply to turn on. Switch positions 6 and 7 are the ones that work, not 3 or 4 as I originally thought. I'll figure out the switch later.

I have voltage! With a load of two 100w bulbs in series, the supply comes on. I am able to adjust the voltage from 155 to 189, a good range but far too high. I got a beep to start, and fans are on. I still get a green light. Is that correct?

I have line numbers displayed so I can follow the instructions to make changes. Also, what is the procedure for erasing the present program to write in the modifications?
Bob


----------



## customcircuits (Dec 21, 2008)

You don't have to do anything special to reprogram the device. Just hit the program button again and it will download the new code.

If your LED is green now, it likely means that the program ran through all of the states and you're now sitting in the IDLE state. What is a little troubling though is that the fans are still running. I would expect them to shut off in this state. If you want to verify this, set a break point on line ~230 "state = IDLE;" then hit run. If it stops here then you know where you are in the code.


----------



## RWAEX (Jul 13, 2011)

I misspoke. The red is also on, making it yellow. I think that means it is in the CV stage, which it is. The voltage is too high, so I think the reference must be too high. I measured the voltage on the A/D pin and it was 4.2. That seems too high so I am going to try to lower it.

Bob


----------



## CrunchTime (Feb 13, 2009)

RWAEX said:


> Switch positions 6 and 7 are the ones that work, not 3 or 4 as I originally thought. I'll figure out the switch later.


I also have a 16-pos switch - a PT65 506L508; the board it's on is labelled "ZR87A1s".


```
Switch Bit - Jumper - PORT C Bit
0          - AH     - RC1
3          - TP     - RC2
2          - C1     - RC3
1          - C0     - RC4
```
I believe this means (although I don't have my replacement chip yet so I can't test it - correct me if I'm wrong) that we (or just me if yours is different ) should use


```
unsigned char get_switch() {
      return TP << 3 |
             C1 << 2 |
             C0 << 1 |
             AH;
}
```


----------



## customcircuits (Dec 21, 2008)

Unfortunately, I don't have a switch on my board so I won't be much help.


----------



## GizmoEV (Nov 28, 2009)

customcircuits said:


> Unfortunately, I don't have a switch on my board so I won't be much help.


Don't you have a row of jumper pins on yours? All three of the NG1s I've opened up and my NG3 have a row of jumper pins. One of the NG1s had a rotary switch which was hooked up to the row of jumper pins. The rest of the chargers use standard jumpers.


----------



## customcircuits (Dec 21, 2008)

Mine has the jumpers but not the switch so I can't tell what's tied to what.


----------



## CrunchTime (Feb 13, 2009)

customcircuits said:


> Unfortunately, I don't have a switch on my board so I won't be much help.


Sorry - this was aimed at RWAEX, who mentioned that he has a switch that sounds like mine.

Anyway - I've now received my chip, and have plugged it all in on the bench. With nothing plugged in to the charger output, should I be able to see the voltage? The internal A/D input is getting readings (0xBD), but I'm not seeing anything on the actual output connector.

I guess this is where I need some light-bulbs or something?

[edit] More about the rotary switch - I seem to have it right, except that I don't get TP (should be the high bit of the switch value) set i.e. I get 0-7 twice as I go from 0-F on the switch. I'll be checking that I have the switch installed correctly, but does anyone have any other suggestions? (the switch works correctly - checked with a meter...)

[edit again] I may have found the problem - the initialisation function sets ANSELC = 0xE6 (line ~285) which if I'm reading the datasheet right is making LED1/2, SOFT_START, and RC2 into *analog* inputs (the 0x02 bit is ignored). I changed it to 0xE0 and now I get 0-F from the switch. This would presumably be different if you're going to use a temperature probe on the TP input, which I assume is its original purpose.


----------



## RWAEX (Jul 13, 2011)

I still have not figured out the switch. I changed line 186 to 45/1024+125 and that had no effect, so I changed line 145 to /60. With this. the minimum output is 132v and I can easily adjust it to 135v. Also, the voltage on the A/D pin is1.85. Should I change line 145 to a lower number? What other lines, including comments, need to be updated?

My car is fully charged so I will need to drive it a few miles to check the current limit.

I think the confusion over the pins is that the rotary switch has the digital inputs reversed from what this program is using. I will check the logic levels of the four digital pins versus the switch position and report that.

Bob


----------



## RWAEX (Jul 13, 2011)

Here's some data on the rotary switch, if you have one.

Program position 1 is switch position 6
2 8
3 7
4 9

I don't think you should put a heater load to test the CV settings. At startup, the switcher sees the whole supply voltage and you may violate the safe area. On my charger, I blew several IGBTs until I realized I had too big an output capacitor. When the charger is connected to the battery on the Zivan, the output cap is precharged. On mine, I just used a smaller cap, which is only needed for open, or nearly open, circuit testing.

Bob


----------



## customcircuits (Dec 21, 2008)

Crunchtime - The 0xBD you're reading is likely from the battery being disconnected. The analog circuitry is expecting a minimum voltage and without it you can get some unexpected values. What voltage do you see on the a/d pin if you measure it with a meter?

Bob- What was your charger originally configured as? 120V, 132V, or 144V


----------



## CrunchTime (Feb 13, 2009)

Dave - I think I'm going to wait until I have the batteries hooked up - a combination of worsening eyesight, somewhat shaky hands and trying to use meter probes to poke tiny wee pins surrounded by high voltages leads me to think that I might be better off when the things I need to probe are bigger 

If I hook up the batteries, and then set everything as low as it will go and work up, I hope I won't be able to damage anything...

Bob - if it matters, your numbers lead me to believe that your switch is the same as mine. You should find the following subsets:


```
Program   C0.C1  Switch
1         0.0    0,2,4,6
2         0.1    8,10,12,14
3         1.0    1,3,5,7
4         1.1    9,11,13,15
```
In any case, I'm probably going to remove the hex switch and use one of the jumpers as a BMS HV cut-off just in case, and one as a switch to select 10A or 20A charge rate.


----------



## RWAEX (Jul 13, 2011)

Crunchtime has a better representation of rotary switch positions. I will use positions 6,8,7,and9. My 914 originally had 20 6 volt batteries. At 7 volts per battery, that would be 140 volts, so if the choice were 142, that would probably be right. The original program arrived at this voltage in stages.

Bob


----------



## RWAEX (Jul 13, 2011)

We should all be grateful to Dave for providing us with a method to modify the Zivan. I have my micro working now but it's not because I understand it. I have had trouble getting the voltage to match what I want for my lithium pack. I went back to the control board schematic. It's analog, so I can read it. I made some assumptions, one, that the digital pot would be centered, and two, that the analog pot would have the same voltage. This results in the a/d pin being 2.52 volts. For my battery, it results in a ratio of 54. When I changed the number from 72 to 60, I was able to adjust my output to 135 volts. I think I will change it again to 54 and test that.

Bob


----------



## customcircuits (Dec 21, 2008)

Bob- Do you have an original part number on your charger? Since it was originally configured for 20 6V batteries, I think it should have been a 120V charger profile. If that was the case then you probably want to leave the number of cells in the system at 60 and adjust your pot. Unfortunately, I can't find my notes I made on the pot adjustments or I might be able to tell you where to set it. I'll try to find them. I recommend getting the pot settings correct and then making your voltage adjustments through the code.


----------



## customcircuits (Dec 21, 2008)

Found my notes from an earlier post. Here they are again.

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.


----------



## customcircuits (Dec 21, 2008)

Bob - Refresh my memory, how many Li cells are you using now?

One way you should be able to set the pot is to measure your current pack voltage and divide it by the number of original lead acid cells. I think it's 60 in your case. Then tweak the pot until the voltage on the voltage a/d pin measures that voltage. For example if your pack is currently at 135V then you want the a/d pin to measure 2.25V. Once your pot is set you shouldn't need to touch it again.


----------



## Zak650 (Sep 20, 2008)

Hello Zivan enthusiasts,

I have a NG1 labled max voltage 58.8 volts is anything you folks are doiing with modifying these chargers capable of raisng the voltage on this charger?

Thanks,
Zak


----------



## GizmoEV (Nov 28, 2009)

Zak650 said:


> I have a NG1 labled max voltage 58.8 volts is anything you folks are doiing with modifying these chargers capable of raisng the voltage on this charger?


Assuming that an NG1 with that ending voltage is the same one used for 48V lead acid packs, based on my NG1 (and NG3) for 48V lead acid, that they can in fact put out as much as 72V. I found this out by adjusting the voltage trim pot to the max while charging a LiFePO4 pack. I subsequently had both of them programmed by the US Zivan dealer for 69.3V saturation for my 20 cell LiFePO4 pack.

Edit: I forgot to add that the factory programming doesn't use current as a cutoff criteria so it will only taper back toward 0A until the timer times out. At least that is how mine ended up working. That is just one reason the control board replacement that this thread is about is such a useful modification.


----------



## lou-ace (Jul 21, 2009)

Great work Dave, still waiting for the codes, I wish Zivan weren't so closed liped about their product thanks again.


----------



## RWAEX (Jul 13, 2011)

These are the results of my charger now. I have changed lines 145 and 186 to reflect the lower voltage of my system. I did not change line 147 because I don't understand it. My output voltage is adjusted to 135 volts. The voltage on the adc pin is 1.86, which is lower than it should be. The divided voltage from the battery, which is on one end of the analog pot, is 2.36 volts. The 470k resistor on the board has a 5% tolerance so there will be a variation here.
When I plug it in, I get a beep and the fans come on. There is a momentary red light, then both come on. The load is two 100 w bulbs in series. I can use it like it is after I check the current limit when it is connected to the battery, but I think there might be some tweaking left to do.

Bob


----------



## RWAEX (Jul 13, 2011)

This forum seems to have gone dormant. I have finally reinstalled my Ng3 in the E914 and here's how it works. The charger was adjusted with a 600ma load to 135 volts, using what I believe to be my most accurate voltmeter. The battery voltage had been run down to 133 volts. When I connected the charger to the battery and applied power, the current went to 12.35 amps and the red light came on. When the voltage rose to about 134.5 the yellow came on and the the current kept decreasing. I disconnected when the current got down to 300ma so I don't know at what current the device goes to idle. If I ever take it apart again, I'll set the idle up somewhat.

Thanks again, Dave.

Bob


----------



## bgeery (Oct 17, 2011)

I'm following your progress, Bob. I've put the project to the side for a bit to work on some other pressing projects. I want to make sure the new chip will work in my NG1 before I pull the old chip again. I don't think the soldered on broken pin on the old chip will survive being removed again from the socket. I suppose I could just buy a new chip from EV Conversions, just to have on hand, but knowing them they wouldn't just send me one without having to send the whole charger into them for installation.


----------



## genawin (Oct 1, 2008)

I found your thread recently as i would like to make a few adjustments to a spare NG3 i've got , thought you might like to see this image of what must be a remote control of the output which i think was designed to interface with a BMS , my question is has anyone got a similar control on thier Zivan as it would be handy to make use of it but i don't know how to ?
A little background is it came out of a small production run conversion of a Citroen C1 using in my case 32 x 160ah TS cells and the surprising thing is the cover is marked 96v but it goes into float/balance at 132v (4.125v/cell ?)The car has a sophisticated BMS which i believe has capacity to balance on discharge as well.


----------



## jdeurisco (May 18, 2013)

genawin said:


> my question is has anyone got a similar control on thier Zivan as it would be handy to make use of it but i don't know how to ?


The black box has the characteristics of an opto coupler and is controlled by the GEL BMS with a 0-5V signal.
This modification, according to the guy that wrote the BMS software, was made in an attempt to control the charger to pull back the current supplied in the latter stages of the charge. 
To be more precise, it does *not* regulate the _current..._ it regulates the _voltage_ (which will of course affect the current, so the statement is not entirely wrong)
The voltage can be adjusted 10-20% only.

In my humble opinion this is a hack that has little to no effect, and we've therefore decided to cut the connection to the BMS and refit the multiturn potmeter (details on the potmeter is to be found here: http://www.diyelectriccar.com/forums/showpost.php?p=353628&postcount=2)


----------



## green caveman (Oct 2, 2009)

David,



GizmoEV said:


> FWIW, Attached are photos of the logic boards in my 115V NG1 and 230V NG3 both with the same programming. The paper work says it is the ZV curve #7 but the sticker on the chip says ZV6, in any case it is set for 69.3V Saturation and the current just tapers down close to zero until the timer during the "yellow" phase times out.
> Here is the NG1 115V control board:
> 
> 
> ...


Do you by any chance have a picture of the power board of the NG3?

There seems to be resistor(s) labeled R20 and R21 close to the battery input of the power board that control the voltage level of the charger. 

I have one charger rated output of 144V with a 560K resistor in R20 and a 120V output with a 470K resistor. The ratio is 120/144. (Oddly the 120V output has two identical resistors, the 144V output only one).

I suspect that the output of that divider goes into Pin 12 of the control board (I read 1.95V there when I apply 105V to the 120V charger). That's then compared with the magical 1.954V so frequently referenced and this difference is the input to the A/D on the board (pin 18).

In this case, the control boards (and the programming?) would stay constant across the various voltage outputs (presumably within reason - the limits of the components on the power board). Changing a 120V to a 96V or a 72V would just involve changing the R20/R21 resistor.


----------



## green caveman (Oct 2, 2009)

I think we're looking at this wrong. This is unverified, although the voltage measurements and the comments in the thread seem to suggest it's true. Update - everything seems to be correct. I have yet to go through a whole charge cycle, waiting for better weather, but the voltages seem to be correct.

If you assume that there is only one control board, which seems reasonable since they're surface mount and so being produced in some quantity somewhere, then the whole problem simplifies.

Now you have to not read the manual so that you never hear the concept of "cell tension". That's just a red herring introduced by Zivan to throw Dave off the track.

If the control boards are all the same, then the change is on the power board. The only one I've seen is the resistor near the input.

We now have two variables, the power board resistor and the setting of the U-Pot.

// value in K ohms of the resistor(s) on the power board - my board
#define POWER_BOARD_RESISTOR 470f

// the value of the U POT - easiest plan is to leave it at one end (zero) or the other (2).
#define U_POT_RESISTANCE 2f

// given the power board resistor value and the resistance of the pot
// we have two components of the voltage divider that gets us the max
// and min voltage readings for this controller.
// The remaining component is the 6.8K (R9) on the NG3 schematic which is
// in series with the 0-2k pot. 
// Lets say the resistance on the power board is Rp and on the control
// board the sum of 6.8k and the pot is Rc
// The minimum voltage we can read is when the output of the voltage divider
// is the same as the 1.954V reference.
// This is given by (Rp + Rc)/Rc*Vout
// Vout is 1.954 so:

float rc = 6.8 + U_POT_RESISTANCE;

float minVoltage = (POWER_BOARD_RESISTOR + rc)/rc*1.954;

// Now Dave as stated an inverse gain of 100k/15k
// 0.15
// suspiciously, given an A/D range of 5V 5*0.15 = 0.75V
// 1.954 + 0.75 = 2.704 which is remarkably close to the 2.71V input to U11A
// on the NG3 schematic
 // For the sake of argument, let's assume that the max voltage, the point
// where the A/D will read 5V is at 2.71V.
// Repeating the calculation above:
float maxVoltage = (POWER_BOARD_RESISTOR + rc)/rc*2.71;

// The voltage range - a minor optimization
float voltageRange = maxVoltage - minVoltage;

Now, the digital pot just scales linearly:


// the digital pot bits scale linearly 
digital_pot_bits = (unsigned char)(constant_voltage-minVoltage)/voltageRange*256;

And the voltage from the A/D just falls out from all of this:

// now the voltage can be calculated from the A/D readings...
voltage = ((float) voltage_bits)/1024*voltageRange + minVoltage;


So, what's up with the current? Is it the same on a 115V and 230V charger, or is it different?


----------



## genawin (Oct 1, 2008)

_"Do you by any chance have a picture of the power board of the NG3?"_

NG3 96v






NG3 144v










A little mod that EEC put in instead of the 2k pot









What is the function of the left hand pot on the power board ?


----------



## green caveman (Oct 2, 2009)

genawin said:


> _"Do you by any chance have a picture of the power board of the NG3?"_
> 
> NG3 96v
> View attachment 18934
> ...


One of those resistors is 390K (I think) which would be about the right ratio:

390K ohm - 96V
470K - 120V
560K - 144V

However you labelled that as the 144V which, if true, blows the theory completely. It it's the 96V then it confirms the theory. The resistor on the other board (which doesn't look original) seems to be 300K. Is that the board where the 2K was also replaced? The 144V I have seems to be 560K.



genawin said:


> A little mod that EEC put in instead of the 2k pot
> View attachment 18933


Did they explain the function of the extra board? 



genawin said:


> What is the function of the left hand pot on the power board ?


Something to do with the current output. I haven't made it that far yet.

The approach seems to be to put a clamp meter on the input (or output) and turn the pot until you reach the desired current level.


----------



## green caveman (Oct 2, 2009)

green caveman said:


> 390K ohm - 96V
> 470K - 120V
> 560K - 144V



60V seems to be 220k but, it has two of them. It seems that sometime's it's one and sometimes two, but I don't really understand why. They also seem to be 5% (rather than most of the others which seem to be 1%). Not sure that matters since the idea seems to always be to make a final adjustment with mechanical pot.


The 120VAC/104VDC(now) charger has been run through a few charging cycles. All seems well. I have not got the current limiting digital pot to work (considering it's the topic of the thread maybe I should spend a little time to figure that out) but the mechanical pot still controls the current.

It occurs to me that I should check the components on the power boards of the various systems and make sure that the components on the 60V are rated for the 120V I'm hoping the change this to...


----------



## 3fazeac (Aug 23, 2014)

I have a used NG3 - it's set to charge LeadAcid at 144V. I want to alter the output voltage using the blue trim pots as mentioned in this thread.

However, the other instructions about measuring the output voltage do not work for me.

The instructions I've read say set the selector to 7 or F and disconnect any load on the output. In both cases when I test, I get a red flashing light and the on/off beeper/buzzer.

Does anyone have any tips for measuring/setting the NG3 output voltage?
Thank you.


----------



## arklan (Dec 10, 2012)

which way do u turn the trimpot to get higher voltage?
clockwise or counter clockwise?
thanks


----------



## green caveman (Oct 2, 2009)

Need to capture this information somewhere...

R20 on the power board goes to pin 12 on the control board. (This is the whole voltage divider circuit that lets you control the output of the controller). This is in the middle of page 1 of the control board schematic linked earlier in this thread.

R21 on the power board, which is not always populated, but when it is, seems to be populated with the same resistance as R20, goes to pin 15 on the control board. This is middle-left of page three.


----------



## green caveman (Oct 2, 2009)

What's the level of interest in this project? I'm considering (no promises) rebuilding the boards - basically the same design but shuffling pins so that the serial port can be brought out (I want BlueTooth).

If there's interest, I might be willing to post gerbers and how to turn those into boards and a BOM and the source code that I'm currently using (or perhaps a link to a repository). I'm not interested or willing to produce pre-programmed boards. Is anyone interested in doing that?

The problem with the current design is that the programmer is relatively expensive (~$30). On the other hand, programming is quite simple and reliable (download the IDE, load the project and hit go) - with a decent document it could be fairly fool proof.

There should really only be three parameters that need to be changed - the value of the resistor (R20) on the power board, the number of cells and the capacity (Ah) of the cells. It's possible these could be programmed from a GUI so the on-board code is always the same.

I really like these boards and the flexibility they allow for the end user to control the NG3. Lead to Lithium, change the profile, change the voltage, use the same charger on multiple vehicles, all without returning to the manufacture for changes.

Anyone have any thoughts or feedback.


----------



## green caveman (Oct 2, 2009)

If you're using this mod I think that you are probably overcharging your pack.

A long discussion resulted in this post:

http://www.diyelectriccar.com/forums/showpost.php?p=525289&postcount=25

Which links to the BestGo manufacturing specs that says the cut-off current in the CV phase should be C/20, so 5A for 100Ah cells. The default in the software seems to be 0.2A - 200mA.

The change should just be a matter of changing the MIN_AMPS for the profile you are using (or all of them), eg

#define MAX_VOLTS_1 158.5 
#define MAX_AMPS_1 11.0 
#define MIN_AMPS_1 5

I haven't yet made and tested the change.

In my case the charger was constantly resetting. This seems to be because of the PIC watchdog timer (not the charger watch dog). Fix looks about like this (at the end of the main loop):


```
WDO = 1;         
     WDO = 0; 
     Clear_WDT();  // clear the PIC watchdog timers.  Without this, there are periodic resets of the controller. 
   } /////END OF WHILE 

} ////END OF MAIN

 // clear the 18F watch dog timer.  Put in function to avoid optimization issues: 
//  [URL]http://www.microchip.com/forums/m122062.aspx[/URL]  
void Clear_WDT (void) { 
       ClrWdt();  
}
```


----------



## GizmoEV (Nov 28, 2009)

green caveman said:


> If you're using this mod I think that you are probably overcharging your pack.
> 
> A long discussion resulted in this post:
> 
> ...


 What I had to do was top balance my pack and then trim the voltage to 3.455V/cell to keep the standard charger from over charging. I verified it by charging completely and then removing any load on the pack and let it sit several hours and checked the voltage of each cell. Since all of them dropped to just below 3.38V I know that my TS LiFePO4 pack isn't being over charged.

Basically the higher the target voltage used the higher the cutoff current needs to be but it isn't a linear relationship. I've tested this a little with small packs and it appears to hold true. It is better to undercharge than to over charge your pack. Also, I'm going on 3.5 years with no balancing on my pack and it doesn't show signs of cell drift. If you have no unbalanced loads and no bad cells you do not have to balance your pack on every charge. My pack is now 5 years old.


----------



## PuncturedCell (10 mo ago)

Hi all,

I've picked up where Dave and Caveman left off.

I have rewritten Dave's code to be used on an Arduino, which makes this all quite an 'easy' mod IMO.

Now 21/11/2022.


Arduino Nano based
Uses PlatformIO on VSCode
The voltage part works AFAIK. the sensing according to Green caveman's gain works a charm.
Current I havent touched yet. I haven't used the original conversion from Dave, but the sensing works. Will update in the GitHub once I make progress
There's also a screen! But I havent tried connecting it yet, since I was out of screens.
One of the jumpers (TP) transforms this into a PSU. CV mode with the LED showing load.



> > GitHub - WoutOsse/Zivan-NG3












I'm not a programmer, just a hobbyist with some basic knowledge of it. I've tried explaining most of my thought process inside the code. Feel free to add/complement.

There'll probably also be a version with RS485 control, since I'm planning to put this Zivan permanently inside a boat. But you'll probably want your own implementation of this.

Contact me on Discord if you want more info >> itsPointless#6048


----------



## PuncturedCell (10 mo ago)

Update:

The Arduino - Zivan NG3 is fully functional without RS485. 

Arduino Nano based
SSD1306 OLED with most important info (voltage, current, state, errors)
Changing voltage / current only by flashing the Arduino.
*Lithium packs can now be charged safely, without overcharge, and cut-off amps can be set as desired. Making the NG3 still viable when changing to Lithium packs.*
PSU mode (By using the jumper TP-1

Will post a final visual update once I have the screen & remote USB connection installed in the chargers plastic casing

I haven't figured out a 'chique' way to read current. But currently it's quite close for the low amps (<5A) i've tested (+- 0.1A difference, but not sure about scaling to lets say 30A)


----------

