Current Monitor/Shunt

Any made up spare boards in New Zealand?

Hello,
I’m quite new to Visual Studio and PlatformIO and I’m having trouble to build the code for my Shunt.
I use an Arduino Uno that seems to work because I can program it using PlaformIO - for example with the “Blink” test.
Unfortunately I get Script Errors while building the code for the Shunt. I’m quite sure that I have all dependencies installed.
Can anyone give me some hint where to search for the cause?
Many thanks.

Here the log:

> Executing task: C:\Users\Frank\.platformio\penv\Scripts\platformio.exe run <

Processing diyBMSCurrentMonitor (platform: https://github.com/platformio/platform-atmelmegaavr.git; board: ATtiny1614; framework: arduino)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
TypeError: 'NoneType' object is not subscriptable:
  File "C:\Users\Frank\.platformio\penv\lib\site-packages\platformio\builder\main.py", line 182:
    env.SConscript(item, exports="env")
  File "C:\Users\Frank\.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Script\SConscript.py", line 597:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\Frank\.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Script\SConscript.py", line 285:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Users\Frank\Downloads\diyBMS-CurrentShunt-master\Code\diybmsCurrentShunt\buildscript_versioning.py", line 31:
    env.Append(git_sha_short=git_sha[32:])
===================================================================================== [FAILED] Took 1.08 seconds =====================================================================================The terminal process "C:\Users\Frank\.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.

The built-in “Inspection” of Visual Studio points to the same issues:

PIO Core Call Error: "Processing diyBMSCurrentMonitor (platform: https://github.com/platformio/platform-atmelmegaavr.git; board: ATtiny1614; framework: arduino)\r\n--------------------------------------------------------------------------------\r\nVerbose mode can be enabled via `-v, --verbose` option\r\n\n\nTypeError: 'NoneType' object is not subscriptable:\r\n File \"C:\\Users\\Frank\\.platformio\\penv\\lib\\site-packages\\platformio\\builder\\main.py\", line 182:\r\n env.SConscript(item, exports=\"env\")\r\n File \"C:\\Users\\Frank\\.platformio\\packages\\tool-scons\\scons-local-4.3.0\\SCons\\Script\\SConscript.py\", line 597:\r\n return _SConscript(self.fs, *files, **subst_kw)\r\n File \"C:\\Users\\Frank\\.platformio\\packages\\tool-scons\\scons-local-4.3.0\\SCons\\Script\\SConscript.py\", line 285:\r\n exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)\r\n File \"C:\\Users\\Frank\\Downloads\\diyBMS-CurrentShunt-master\\Code\\diybmsCurrentShunt\\buildscript_versioning.py\", line 31:\r\n env.Append(git_sha_short=git_sha[32:])\r\n========================== [FAILED] Took 1.02 seconds =========================="

Edit - formatted text. Moderator - BT

1 Like

Anyone have a complete shunt board spare they would be willing to sell

How can I use 2 shunts/monitors on one controller? Can I use a modbus hub for this?

The controller doesn’t support more than one shunt at a time, and it probably shouldn’t need to either since it can monitor current flowing in both directions. If you have more than one battery bank they should all flow through to the same shunt via a bus bar or similar configuration.

price?

I have also problems with the SOC value…
It was the last days always at 105% and dont reset. Today (battery full) I see 1,5% and going slowly up to 3%.
What’s wrong here?

today the Battery goes under 0% and have 105% again… :crazy_face:

You can’t - the code on the controller isn’t written to support this setup. There isn’t a hardware limitation though, so technically its possible, but not supported.

Feel free to raise a GITHUB issue, and it may get included as part of a future enhancement.

When the SOC goes over 100% it usually means the capacity isn’t set correctly. Also check the “tail” voltage and currents - this is how the SOC is reset to 100% so the current monitor detects a full battery.

ok,
but why under 0% the SOC goes to 105%?

Is the INA228 available anywhere? I’ve looked everywhere, and the only option I found was to buy the TI evaluation kit for 60$ and desolder the chip…
Or is there any alternative possible? I would be willing to modify the layout if required.

I ordered direct from TI, but it looks like even they are out of stock now. You can try AliExpress or similar, but there are no guarantees of authenticity.

I’d keep looking, there are bound to be some chips out there that would be cheaper and require less work on such a small IC. I have one fully assembled shunt PCB on my bench to be reworked as there was a problem with programming the ATTiny, I need to put it under the microscope and do an in-depth inspection of the board.

It could be a software bug. Drop an issue and some screenshots over onto the GITHUB page please.

I suspect the SOC value is going negative, and the code reports that as a very large number, and hence gets scaled to 105%.

If you have a 105% SOC reading - it simply means that more calibration is needed, its likely the battery capacity is wrong.

I also tried AliExpress, but the few offers I found didn’t look trustworthy at all.
Also I had bad experiences with counterfeit chips in the past already…

Brokers ask 250-350$ per chip. ridiciulous.

Hi Stuart,
is there a way to reset the SOC to 0% at a specific charge value?

That is crazy! And worse than finding CAN ICs.

I’ve not had too many problems in sourcing parts on there but I do prefer alternatives. Sadly many of the alternatives are out of stock well into 2023 and at least one part I use in my PCBs is out until 2024 :frowning:

The CAN chip is on stock at LCSC at the moment, no issues here :slight_smile:
And the ADM2483 was available on ebay.

I hope something comes up in the near future. Or does someone have two chips spare?

@stuart is it possible to use the INA238 or INA237 instead? I’ve compared them and the main difference seems to be the precision. Just 16-bit vs 20-bit ADC.

The question has been asked many times, I think they are missing features. If that were a possibility, Stuart would have said so long ago. Chip crisis. In fact, the IC can be bought for a lot of money. I paid for the last 22.-. With shipping and taxes it was almost 60 EUR. Well, what can you do. Surely Stuart didn’t want it that way. On the other hand, I find the price affordable when I see what other systems cost.
You usually only build one or 2 shunts for the home system, so “close your eyes and through” :slight_smile: