OpenEnergyMonitor Community

DIYBMS v4 Shunt Design and discussion

Tags: #<Tag:0x00007fc9bd7aeb60>

Right, I get that you can change the pcb variations.

I’ve been using easyeda. It annoyingly has you choose the particular package in the schematic and does not really have a good way to swap out the physical components easily. Maybe I am using it wrong, but its a pain to draw the schematic, then swap out the dang component to get the right footprint to then update PCB.

Hi George
Nice design, but please add a polyfuse before the LTC3639 so you’re not melting the complete board if a cap or something else shortens

Hi @GeorgeBoudreau and @John_Taves

Thank you for fleshing out the current shunt design. To recap I think the decisions so far are:

  1. Use LTC2944CDD-PBF as the main “gas gauge”
  2. Build on a separate PCB board with connections back to controller and shunt
  3. Shunt is something like this Murata Power Shunt, 300 A, 50mV Output
  4. Isolate the monitor using i2c isolator (as previously seen in DIYBMS v3)

I’ll throw my spanner into the works now! I know the trouble a lot of people had with long i2c cables (over about 30cm were troublesome).

Perhaps now is the time to move this monitoring board to use CAN bus ?

We could either use a i2c to CAN converter like this (reference design PDF) or introduce a very small microcontroller to interface between CAN and i2c (this could potentially do other stuff as well).

JLCPCB has a good range of generic CAN drivers and transcevers like

Just an aside - the LTC3639 is very expensive, how about LM2576HV ?

1 Like

@SteenA… Can do. Littlefuse minimum 60v, 100ma hold, 1206 should do the trick and not too expensive

This shunt is beginning to take on a life of its own.

The board as drawn could fit neatly in a small enclosure… It has to be an enclosure everyone has easy access to and not that expensive.

CAN interface:; PIC18(L)F25 with integrated CAN protocol module. You only need the transceivers. You can integrate the ALCC as a CAN message.

If the design is done properly it could be an external card that connects to the isolated I2C and ALCC connector. The board would communicate with the new ESP32 board via the built in CAN interface. For those using the original ESPcontroller without a CAN interface they could use the I2C interface and hope for the best.
Create 2 PCB layout. One with CAN interface and one with only I2C.

My own spanner… How about dropping the I2C isolation and using the ESP8288 as a Bluetooth enabled current shunt… Absolute isolation :slight_smile:

1 Like

I wouldn’t want people to have a 3rd type of micro to program, might as well reuse the ATTINY841 (or 441).

If you can get an ATTiny841 to talk SPI to the MCP2515 and I2C to ADuM1251 then we can add the MCU to the current. Parts count is going up on this project.

The ATTINY841 only natively supports i2c slave mode, but software library can bit bang i2c master mode on any two pins. Should be possible to use i2c and SPI with TINY841.

However, it may be simpler to use the ATMEGA328P-AU, if we are considering JLCPCB to build these, then that chip is always in stock compared to the 841.

They also stock MCP2515-I/SO and TJA1050T/CM,118 as basic parts - although the TJA1050 needs 5v not 3.3v.

Did you see my comment on the LTC3639 being expensive, any alternatives? (how about LM2576HV ?)

Does JLCPCB support the LM2944. This is a teeny package to solder after all else is soldered.

The LM2576HV is $6+ vs $9+ for the LTC3963. The current design draws <100 ma I don’t think an average 3A switcher will run at this low a draw. More poking about needed.

If you are swtiching processors give me pros/cons of the PIC18F25K83 and ATMEGA328P. Include all support components in the comparison.

No it doesn’t! All the parts supported by the assembly service are listed here []

JLCPCB lists the parts as $1.33 vs $7.47

I can’t - I haven’t used a PIC micro for 15 years. However in the diyBMS eco system, the end user will already have a programmer for the ATTINY and hence the ATMEGA.

Costs wise (based on assembled JLCPCB prices), we seem to have:

ATMEGA328P = $1.61
LM2576HV = $1.33
MCP2515-I/SO = $1.02
TJA1050T/CM,118 = $0.45

plus LTC2944CDD-PBF, about $8

If we still plan to do a JLCPCB assembly (I can’t find anything cheaper) then we also have to watch the number of “extended components” think 12 per board is the max - this includes some parts like inductors and large caps.

LM5009 is 95v 150ma A better choice and hand solderable if necessary. Extended part @ 1.53.

PIC18F25K83 ext.part 2.55 but you don’t need MCP2515 so total price is similar.

Mounting of the LTC2944 will be dificult but I guess folks will have to give it a try.

That looks good. The LTC2944 is going to be a nightmare to handsolder, its a shame a JLC stock some of the other units like 2943 and 2941 !

@stuart and @GeorgeBoudreau I don’t see the point of having the current monitor board physically separate from the controller board. The beauty of the controller is that it has no LCD, and thus no requirements to be visible, and thus no need to be far from the battery. Maybe I am wrong, but it seems that a lot of the builds using DIYBMS don’t have enclosures and tape is the mounting “system”. I am not buying George’s argument that an enclosure is important.

Some will mount one side of the shunt to the battery post. Some will have a short cable to it. The shunts come in a variety of shapes, so it seems unlikely any PCB that mounts to the shunt will satisfy many. And I don’t see why a 1 meter kelvin wire will degrade accuracy enough to care. I can’t think of a use case where one cares that the controller shut off the loads when the soc showed 3% (or -3%)

So my take is to maximize ease of build. I would avoid surface mount like the plague.

The 2944 can be used on the CJMCU-294, which makes it THT.
The INA226 can be had in a DIP, so maybe there is a way to use a voltage divider to handle higher voltages than 36?

Also, regarding Stuart’s cost calculations, I think it is important to remember the min 5 qty and shipping. Those costs swamp $5 chip costs. I think it is better to make 2 different controller boards. One with the state of charge counting and one without, than it is to make 1 controller board and 1 state of charge add-on board. That way you order just one controller.

Indeed, I want the 4 relays built onto the controller so that I don’t have to fiddle with yet another board to wire up. Maybe this circuit will do the job? My understanding of P4-7 is that they are used to read a switch, so that I can manually turn off my inverter with a switch, so I figured more JST connectors were the right answer.

Hi @John_Taves. Everybody has a different end solution in mind and different design goals.

The original concept of the diyBMS was to cater for Powerwall like solutions - often with 48V+ and hundreds of amps of current into an inverter. Catering for that current and voltage on a small all in one PCB without isolation worries me.

What sort of design goals are you trying to achieve? What voltage and current loads are you using?

An all in 1 PCB sounds great, but getting it built can be a problem with the limits of JLCPCB - I know there are other providers but the cost really jumps up!

I’m not going to avoid SMD parts/PCBs as the design is already using those. I’m not planning to hand assemble (or at least avoid it as much as I can).

Using the pre-assembled CJMCU-294 boards might be a way to avoid soldering the nasty LTC2944 part, if these could be integrated neatly.

I have an ESP32 controller board simmering on the back burner as my time is stretched thin. I will release is soon. As you can see the relays are onboard. There is or will be the I2C bus as well as a CAN interface. The relays can handle 5A and traces will support this amount

I go to great lengths to isolate this board and the shunt interfaces from the high voltage and power of the battery packs. This is a DIY project and the usual caveats apply about non-certified electrical designs. You burn down your house or in your case your RV don’t knock on my door.

Even Batrium, who charges through the nose for their products, have their shunt monitor external to their main board.

ESPcontroller-NG PCB

@stuart Right, I meant avoid hand soldering SMD. If jclpcb can do the SMD, then great, use it.

Just to be clear, I am saying the goal to make it so that it can be built by jclpcb with just through hole soldering, is excellent.

I am doing 24v, 280ah battery, and 4kw inverter, so less than 200amps.

If we are using a shunt to get the current sense, I don’t see why it matters what amps the system is capable of with respect to the controller and the current sense board. There would be 26ga wires from the shunt to the controller. They are a fusable link

@GeorgeBoudreau, sorry I’m a novice, so I am not trying to change your opinion, so much as understand.

I think I understand the reason to isolate the circuits, but I don’t see the point of physically isolating to a different board. I did not look at the Batrium solution, but there are plenty of BMSs where they run the current into the BMS. The designs you and Stuart are debating have no current going through the boards. I mean, don’t support an onboard shunt.

With respect to physical isolation (2 boards) it seems like you are violating that with your relays. They will be able to have an unknown voltage with up to 5a of current x 4 relays, but you seem resistant to having ltc2944 (really cjmcu-294) on the same board, even if it is properly isolated electrically. The 2944, just needs low power sense wires. Yes, at battery voltage. Again, just trying to understand.

Also, those relays seem rather overblown. I mean 5a is a lot of current to signal some load or charger to stop, right? I guess, I am asking whether you are inviting pathetic solutions by enabling 5a of current. Why not use the TLP22A-2 (2 relays per chilp and they are THT)?

As one use case example, I have a solar “controller” that is nothing more than a relay and a diode to shut off the solar and it uses maybe 20mA. The 24vDC to 12vDC converter also uses less than 30mA. Both of those are at battery voltage. The charger has a different voltage, because it’s not connected to the battery until it has shore power, but it too uses less than 30mA for control. The inverter was the only pain in the butt. It has its LED display board wired in series with the switch, so it seemed to peak at like 150mA, but was quite variable.


Hi guys
No doubt, that some kind of galvanic isolation is required between current shunt circuit and main controller.
If a person power the controller from one of the batteries, and there is no isolation between gnd on shunt circuit and gnd on controller circuit, the outcome will not be pretty.
George has a I2C isolation between the circuits.
If you want a CPU in the current monitor circuit, how do you make the isolation then ?
A CAN bus solution will not isolate anything, since it requires a common gnd
And is CAN bus really the smartest implementation?
It’s difficult to implement in software, and requires MPU’s with hw CAN bus.
Why not go with RS485 and a simple protocol, or MODBUS.
But it still needs galvanic isolation

And if you add an MCU in the current shunt circuit, maybe the best way is to use a AMC1301 together with a SN6501 to power the isolated part.
This way the shunt will be isolated from the rest of the setup
Then the added MCU can perform all the calculations, and the main controller can just request values from the shunt-MCU by eg. RS485 and the MODBUS protocol

It looks like that is open to debate. []

TI say “may be”, Microchip say no common ground needed!

The reason for looking at CAN bus is two fold, the first is that it provides better comms over longer distances in noisy environments (much better than i2c).

The second reason is that once the controller is CAN enabled, it can now start communicating with inverters and potentially emulate other battery systems to provide a well connected eco-system, removing the need for relays and the like.

It doesn’t need hardware dedicated MPU’s and the libraries for software implementation are widely available. We are not reinventing the wheel here.