diy solar

diy solar

Heltec (JK) 200A Smart BMS with 2A Active Balance

I have a JK-BMS on my battery bank, and I know exactly what you are talking about. Let me see if I can explain it a little better.

A pure sine wave inverter does not draw a constant current. The current from the battery follows a sine wave shape. It ramps from zero current up to peak current in 1/4 of a cycle. The peak current is actually about 40% more than the average current. Then the current will ramp back down to zero at the 1/2 cycle time. At this point, the inverter reverses polarity, and ramps the current back up again, hitting the peak at the 3/4 cycle time. The battery current is positive again, and the inversion happens in the inverter circuit. The the current ramps down back to zero again at the end of the cycle. The process them repeats for every cycle.

If you measure with an averaging meter, you will just see a fairly steady current that should be close to the true RMS current. I use a True RMS Fluke meter, and it is able to give a vey accurate reading on this odd waveform. The current reading in the BMS just measures the voltage across a shunt resistor. This reading is only taken periodically, and it is not synced the the changing current from the inverter. It might take a reading at zero current, or at the peak current, but most likely, it will fall somewhere in between. Due to the shape of the wave, the reading tends to bounce a bit above and below the true RMS current. It is not perfect, but over the long term, it is "good enough" for the BMS to calculate the amp hours charged in or discharged out of the battery. This works because if you average the readings over a full hour, the high and low readings will average out.
intesting, thank you for the in depth description of how AC inverter draws Varying DC amps
There is not a simple fix for the short term reading fluctuations. Ideally, reading it much faster and doing a running RMS type average would be best, but that takes more memory and computation. That is basically how my Fluke meter does it. An easier and cheaper way to do it is to just put an analog low pass filter on the signal from the current shunt. This will not be perfectly accurate, but by putting in an average to RMS correction factor for a sine wave, it will be very close, as long as the current wave follows a sine wave shape. Many AC voltage and current meters do this. When you measure 120 volts AC, it is actually averaging the sine wave and doing a small correction. It is accurate for a clean sine wave, but if it is a square wave, or triangle wav etc., then the reading will be a little off. A true rms meter is still accurate, no matter the wave shape.

In the case of the BMS random reads, it is actually very accurate over the long term because it is adding up the amp hours of each reading on the waveform. If you just watch the reading for a few seconds, you can get a pretty good idea of what the average reading is. If you need more accurate, use a clamp on amp meter or install an external shunt with averaging or true rms reading.
well said!

as you mention, one way to get around this issue at a Firmware Level is to sample the Battery Current at e.g. 120hz and only report averages that cover an integer number of AC cycles (1 cycle = 1/60 second, 2 cycle = 2/60 second). It Must Be Integer Multiple Number Of Cycles.

zero crossing average would drastically reduce the fluctuation

i have had to do this before writing low level microcontroller firmware. sampling like this would completely negate that part of the fluctuation.

if BMS reads current and reports over time periods that are not 1/30th of a second precisely or 1/15th of a second precisely, this fluctuation will never go away is my theory. good luck!

oh... if running the inverter at 50hz change all the values. or to whatever frequency for locale.

excited for the 4S BMS after new years celebration :)
 
The current detection frequency of BMS is twice per second. Since the inverter is generally a sine wave inverter, the current fluctuation is relatively frequent, so the BMS current display will fluctuate greatly. We are preparing to reduce the current acquisition frequency of BMS, which will reduce the fluctuation. The current fluctuation will not affect the balance and protection function of BMS
oh no! perhaps i misunderstand!

if current detection frequency of BMS is 2 Hz it will need a long averaging period to remove fluctuation, many seconds

if AC waveform frequency 60hz -> BMS current acquisition must be 120hz to properly remove fluctuation error


sample frequency must be 2 * frequency or 60*2 = 120 hz acquisition frequency

to save memory resources on BMS MCU please consider using summation and division technique to keep memory and computation usage to absolute minimum

here is some example code to communicate

Code:
int sampleSum    = 0; // total value of samples added up
int sampleCount = 0; // total count of #samples added together
float ampereAveraged = 0; // averaged value
void addNewSample(float ampere)
{
  sampleSum    = sampleSum + ampere;
  sampleCount = sampleCount + 1;
}
float updateAveragedSample()
{
  if(sampleCount > 0)
  {
    ampereAveraged = sampleSum / sampleCount;
    sampleSum = 0;
    sampleCount = 0;
  }
 return ampereAveraged;
}
void loop()
{
  float bmsAmpere= aquireCurrentBMS();
  addNewSample(bmsAmpere);
 
  if( sampleCount >= 120 )
  {
   float amps = updateAveragedSample(); // this resets the Sum to 0
   // this value will not have fluctuations if the sampling frequency is twice the AC frequency
  // assumes current acquisition at 120hz
  }
}

if it is possible, please consider to increase BMS current acqusition frequency to 120hz and add up value then divide when 120 samples have been accumulated, then reset the count for next AC waveform cycle. this would really differentiate JK to me, since many people use AC inverter with ampere ripple.

kind regards, and thank you for your time

edit: updated example code for more clarity
 
Last edited:
Is anyone having issues with the JK Android App on Android v12? I've just updated my phone to v12 and now the JK app instantly crashes as soon as it is opened. I've tried clearing the app data / cache and have the latest v4.0.0 build 33 of the app.
At present, because Android 12 is the latest system, engineers are already updating the app. The current app version is v4 2.0, but it still needs to be updated for Android 12 system to be compatible. Please wait patiently
 
I have a JK-BMS on my battery bank, and I know exactly what you are talking about. Let me see if I can explain it a little better.

A pure sine wave inverter does not draw a constant current. The current from the battery follows a sine wave shape. It ramps from zero current up to peak current in 1/4 of a cycle. The peak current is actually about 40% more than the average current. Then the current will ramp back down to zero at the 1/2 cycle time. At this point, the inverter reverses polarity, and ramps the current back up again, hitting the peak at the 3/4 cycle time. The battery current is positive again, and the inversion happens in the inverter circuit. The the current ramps down back to zero again at the end of the cycle. The process them repeats for every cycle.

If you measure with an averaging meter, you will just see a fairly steady current that should be close to the true RMS current. I use a True RMS Fluke meter, and it is able to give a vey accurate reading on this odd waveform. The current reading in the BMS just measures the voltage across a shunt resistor. This reading is only taken periodically, and it is not synced the the changing current from the inverter. It might take a reading at zero current, or at the peak current, but most likely, it will fall somewhere in between. Due to the shape of the wave, the reading tends to bounce a bit above and below the true RMS current. It is not perfect, but over the long term, it is "good enough" for the BMS to calculate the amp hours charged in or discharged out of the battery. This works because if you average the readings over a full hour, the high and low readings will average out.

There is not a simple fix for the short term reading fluctuations. Ideally, reading it much faster and doing a running RMS type average would be best, but that takes more memory and computation. That is basically how my Fluke meter does it. An easier and cheaper way to do it is to just put an analog low pass filter on the signal from the current shunt. This will not be perfectly accurate, but by putting in an average to RMS correction factor for a sine wave, it will be very close, as long as the current wave follows a sine wave shape. Many AC voltage and current meters do this. When you measure 120 volts AC, it is actually averaging the sine wave and doing a small correction. It is accurate for a clean sine wave, but if it is a square wave, or triangle wav etc., then the reading will be a little off. A true rms meter is still accurate, no matter the wave shape.

In the case of the BMS random reads, it is actually very accurate over the long term because it is adding up the amp hours of each reading on the waveform. If you just watch the reading for a few seconds, you can get a pretty good idea of what the average reading is. If you need more accurate, use a clamp on amp meter or install an external shunt with averaging or true rms reading.
Excellent explanation. The characteristics of the inverter make the current present the image of trigonometric function y = SiNx,
 
I have a JK-BMS on my battery bank, and I know exactly what you are talking about. Let me see if I can explain it a little better.

A pure sine wave inverter does not draw a constant current. The current from the battery follows a sine wave shape. It ramps from zero current up to peak current in 1/4 of a cycle. The peak current is actually about 40% more than the average current. Then the current will ramp back down to zero at the 1/2 cycle time. At this point, the inverter reverses polarity, and ramps the current back up again, hitting the peak at the 3/4 cycle time. The battery current is positive again, and the inversion happens in the inverter circuit. The the current ramps down back to zero again at the end of the cycle. The process them repeats for every cycle.

If you measure with an averaging meter, you will just see a fairly steady current that should be close to the true RMS current. I use a True RMS Fluke meter, and it is able to give a vey accurate reading on this odd waveform. The current reading in the BMS just measures the voltage across a shunt resistor. This reading is only taken periodically, and it is not synced the the changing current from the inverter. It might take a reading at zero current, or at the peak current, but most likely, it will fall somewhere in between. Due to the shape of the wave, the reading tends to bounce a bit above and below the true RMS current. It is not perfect, but over the long term, it is "good enough" for the BMS to calculate the amp hours charged in or discharged out of the battery. This works because if you average the readings over a full hour, the high and low readings will average out.

There is not a simple fix for the short term reading fluctuations. Ideally, reading it much faster and doing a running RMS type average would be best, but that takes more memory and computation. That is basically how my Fluke meter does it. An easier and cheaper way to do it is to just put an analog low pass filter on the signal from the current shunt. This will not be perfectly accurate, but by putting in an average to RMS correction factor for a sine wave, it will be very close, as long as the current wave follows a sine wave shape. Many AC voltage and current meters do this. When you measure 120 volts AC, it is actually averaging the sine wave and doing a small correction. It is accurate for a clean sine wave, but if it is a square wave, or triangle wav etc., then the reading will be a little off. A true rms meter is still accurate, no matter the wave shape.

In the case of the BMS random reads, it is actually very accurate over the long term because it is adding up the amp hours of each reading on the waveform. If you just watch the reading for a few seconds, you can get a pretty good idea of what the average reading is. If you need more accurate, use a clamp on amp meter or install an external shunt with averaging or true rms reading.
Thank you for the clear explanation Gary.

I also have a Victron shunt installed, it seems to measure the current just fine, guess they do some of the tricks you described ;)

The problem I had with the Daly: because of the heavy fluctuation, with a larger current draw from the inverter, it would go above the max current and shutdown instantly. These JKs have a delay, so that's better.
 
Last edited:
Hello!
Finalizing my repair story.

My previous posts:

Summary:
1) My BMS and inverter had survived all the tortures and now work fine
2) Precharching resistor is the only way to go by now

1) Repair.
Luckily there was only one burnt transistor: D-S, G-S - everything was 0 Ohm in it. Gate 100 Ohm resistor saved the driver I guess.
After soldering it out now "Discharge" and "Charge" switches work as designed: cut off current to zero amps.

P20113-185518-2.jpg

2) Experiment
I agree that next experiment is quite stupid and unnecessary.
But!
Imagine the following situations:
a) You turned off a BMS with "Discharge" switch and now want to turn it back on again using "Discharge" switch in app
b) There was some fault situation in a battery, BMS turned it off, now it waits for some timeout or fault has gone for some reason, and then BMS turns the battery back on again.

The result:
- current is extreme (500-1000 A or even higher)
- BMS goes into "Short circuit" error mode and waits for timeout (60s)
- after timeout everything repeats.

S20113-18323715.png

Case 2:
- you switched off battery with "Discharge" option
- if you switch it on again with "Discharge" option you'll get "Short circuit" and... see above.

Case 3:
- problem in balancing wire
- BMS doesn't see that cell and goes into fault mode (battery off)
- for some reason balancing wire begins work fine again -> BMS turns on battery -> "Short circuit" and see above.

Case 4:
- cell undervoltage protection occured
- ....sorry I don't remember and didn't try it now. Can anyone remind please will BMS wait (in off state) until charging starts? Or it will turn on after the cell voltage rose over Cell-Undervoltage-Release value?

Here's current measurement. I didn't set correct range but judging from skyrocketing curve slope I assume it was ... maybe around 1000A.

20210204_761914.png
 
Last edited:
Mark81,

Each case you listed is possible. This is a big reason that you really don't ever want the BMS to shut off in normal operation. It is there as a last resort protection to keep from destroying cells when something goes wrong. If you manually shut it off, you should be there o operate a pre charge resistor to turn it back on. The fault conditions are bit more difficult to deal with.

In my case, I did have a balance lead fail. This caused two cells to show under volt. When it disconnected, it also tripped an under volt error in my Schneider XW inverter/charger. So it locked out as well. My system never tried to reconnect on it's own. I am not sure how it would have acted if the balance lead re-connected. It took me 2 days to find and fix the problem, and I again used a pre-charge resistor before turning on the manual disconnect.

I have only a 100 amp fuse on each of my battery strings. But in my old bank, both strings connect to the one JK-BMS. My hope when setting it up was that any surge that might damage the BMS would pop those fuses first. On my second battery bank, I am using a pair of 100 amp Daly BMS units, each has it's own 100 amp fuse. I may step down the fuse sizes a little to be on the safe side. I never pull that kind of current, so I really don't need it, but I do want to be able to run on either one of the battery banks if something goes wrong. So I can probably get away with each string having a 60 amp fuse. Any 2 strings can then supply the worst case load I have run yet. And with all 4 strings on, I am still well over the maximum rating of the XW inverter.

Is this problem enough of a worry to add another supervisor circuit around the BMS units? That is a tough question. If you are using questionable cells that might cause frequent disconnects, then you have a bigger problem. Also if you charge and discharge even close to the BMS disconnect levels, it could be a concern. I have always recommended leaving a fair bit of room at both the fully charged and discharged conditions. That way, even if a cell is getting a bit out of balance, it should not trip.
 
Hello!
Finalizing my repair story.

My previous posts:

Summary:
1) My BMS and inverter had survived all the tortures and now work fine
2) Precharching resistor is the only way to go by now

1) Repair.
Luckily there was only one burnt transistor: D-S, G-S - everything was 0 Ohm in it. Gate 100 Ohm resistor saved the driver I guess.
After soldering it out now "Discharge" and "Charge" switches work as designed: cut off current to zero amps.

View attachment 79602

2) Experiment
I agree that next experiment is quite stupid and unnecessary.
But!
Imagine the following situations:
a) You turned off a BMS with "Discharge" switch and now want to turn it back on again using "Discharge" switch in app
b) There was some fault situation in a battery, BMS turned it off, now it waits for some timeout or fault has gone for some reason, and then BMS turns the battery back on again.

The result:
- current is extreme (500-1000 A or even higher)
- BMS goes into "Short circuit" error mode and waits for timeout (60s)
- after timeout everything repeats.

View attachment 79604

Case 2:
- you switched off battery with "Discharge" option
- if you switch it on again you'll get "Short circuit" and... see above.

Case 3:
- problem in balancing wire
- BMS doesn't see that cell and goes into fault mode (battery off)
- for some reason balancing wire begins work fine again -> BMS turns on battery -> "Short circuit" and see above.

Case 4:
- cell undervoltage protection occured
- ....sorry I don't remember and didn't try it now. Can anyone remind please will BMS wait (in off state) until charging starts? Or it will turn on after the cell voltage rose over Cell-Undervoltage-Release value?

Here's current measurement. I didn't set correct range but judging from skyrocketing curve slope I assume it was ... maybe around 1000A.

View attachment 79603
This is just a WAG of a possible way to to avoid the in-rush current to the inverter when the BMS turns one.
Could you wire the inverter to a high-amp normally open contactor and have it in parallel with a pre-charge resistor? The control for the contactor would run through a delay relay so that when the BMS turns on, the relay holds the contactor closed for a time to allow the resistor to pre-charge.
 
@GXMnow which would you consider the better choice for a pre-charge resistor in the Schneider? A 100w 50 Ohm or a 100w 10 Ohm resistor. Which would pre-charge the XW inverter faster? When i use the 100w 50 Ohm on my Schneider, and I hold it more than a quick second, the inverter starts pulsing and clicking and tries to start but is not getting "enough" to actually start until I turn on the main breaker. I do not want to damage the inverter, so I am using a pre-charge resistor, but I also do not want to damage the inverter due to the resistor.

How long does the Schneider take to actually Pre-charge up?
 
@GXMnow

"Balance lead fail" was a test condition to see how BMS operates under it.
It would be good if BMS just contuniue stay OFF in fault state until further manual restart.
What do you think, @Nami ?

"would pop those fuses first"
What type of fuses do you use?
As you can see from my oscilloscope graphic surge lasted only 1 ms. I don't think a fuse will react faster than a transistor.

@hwse
"WAG of a possible way to to avoid the in-rush current to the inverter"
WAG? Sorry, I think I didn't find context wise correct translation of this word.
If you have any solution to inrush current problem then please post a link or describe it here.

Pre-charge resistor should have its own switch too. Otherwise inverter will try to work through it in some unpredictable case. So you see things become a bit complicated. At this moment I think @upnorthandpersonal 's solution with push button for resistor is the easiest.


@MrM1 ,
are you trying to precharge turned on inverter?) Turn it off before connecting battery.
For me using 1Watt 5.6 Ohm resistor it takes 5 seconds to precharge (current drops to less than 10mA). So 0.5W or even less powerfull resistor will work fine.
 
@MrM1 ,
are you trying to precharge turned on inverter?) Turn it off before connecting battery.
For me using 1Watt 5.6 Ohm resistor it takes 5 seconds to precharge (current drops to less than 10mA). So 0.5W or even less powerfull resistor will work fine.
Trying to precharge an inverter that is off b4 connecting battery cable. So would a 0.25 work faster than a 5.6 ohm? And what is the difference say between a 100w 0.25 and a 1w 0.25? Why would you choose a 1w?
 
I typically use an 8 ohm resistor. I have a pair of 500 watt ones I use for amplifier testing. It takes about 1.5 seconds and the Schneider XW going into standby. It holds enough current to stay on, but not inverting.
 
Trying to precharge an inverter that is off b4 connecting battery cable. So would a 0.25 work faster than a 5.6 ohm? And what is the difference say between a 100w 0.25 and a 1w 0.25? Why would you choose a 1w?
Then why does it try to start?

choose a 1w - it's smaller and could be integrated directly into push button housing.
0.25 - divide battery voltage by this value and decide whether such potential inrush current is OK for your system.
 
I typically use an 8 ohm resistor. I have a pair of 500 watt ones I use for amplifier testing. It takes about 1.5 seconds and the Schneider XW going into standby. It holds enough current to stay on, but not inverting.
Did you place it in stand by b4 shutting the XW down or does it just power back up in standby because of the resistor
 
At present, because Android 12 is the latest system, engineers are already updating the app. The current app version is v4 2.0, but it still needs to be updated for Android 12 system to be compatible. Please wait patiently
Yes, have the same issue on Android 12 with JK BMS app for JK-B2A8S20P.
 
From a dead battery condition, it appears to come on in standby mode. The two times it has shut down from the BMS issue, it was in the inverting mode doing "grid support" supplying about 1,000 watts. But when I went to power it up, it was in the time when it would normally be charging and grid support is in the blocked time slot. If the battery is at 56 volts, the 8 ohm resistor could supply about 1 amp with the voltage at the inverter still over 48 volts to go into operate mode.
 
@GXMnow

"Balance lead fail" was a test condition to see how BMS operates under it.
It would be good if BMS just contuniue stay OFF in fault state until further manual restart.
What do you think, @Nami ?

"would pop those fuses first"
What type of fuses do you use?
As you can see from my oscilloscope graphic surge lasted only 1 ms. I don't think a fuse will react faster than a transistor.

@hwse
"WAG of a possible way to to avoid the in-rush current to the inverter"
WAG? Sorry, I think I didn't find context wise correct translation of this word.
If you have any solution to inrush current problem then please post a link or describe it here.

Pre-charge resistor should have its own switch too. Otherwise inverter will try to work through it in some unpredictable case. So you see things become a bit complicated. At this moment I think @upnorthandpersonal 's solution with push button for resistor is the easiest.


@MrM1 ,
are you trying to precharge turned on inverter?) Turn it off before connecting battery.
For me using 1Watt 5.6 Ohm resistor it takes 5 seconds to precharge (current drops to less than 10mA). So 0.5W or even less powerfull resistor will work fine.
If the normal BMS performs the protection function and turns off the power, it needs to be restarted,
 
I'd like to know the baud rate of the most used CANbus inverter.
We are going to customize a BMS with CANbus protocol.
At present, the baud rate of the customized 2A24S20P is 250kbps.
But I want to know more....
NICE WEEKEND
 
Back
Top