article

ks4z avatar image
ks4z posted

DIY INA226 based Smart Shunt released

I just released the first version of an INA226 based smart shunt. It's a cheap DIY altrernative to a Victron SmartShunt and can be built by anybody who can flash an ESP MCU and solder some components to a perfboard. You can find the code, some firmware files and a documentation on how to build the hardware on GitHub https://github.com/kscholty/SmartShuntINA226.

The INA226 is a shunt amplifier with an SPI interface. It can measure the small voltage drops that are produced by shunt resistors. My contribution is mainly the software that interfaces with the amplifier and implements an interface to the victrron world (or via modbus for other applications) and a hint which components to use to build the required hardware.

The current version of the software supports a PZEM-017 style modbus interface or alternatively the Victron Ve.Direct protocol. The Hex variant of that protocol is only implemented as far as it's required for connecting the shunt to a Victron GX system. It's working fine on my VenusOs RapberryPi and the Multiplus II GX I use in my production system.
It also offers a web based interface for configuration and human interaction.

I also started working on a VenusOs service that can handle this Shunt and also PZEM-017 sensors, but it's not finished yet. Let me know if you would find that useful, then I will polish it up and post it on GitHub as well.

I hope you find it useful and would like to hear your feedback.


ks4z

BMV Battery MonitorSmartShunt
8 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

von-baron avatar image von-baron commented ·

You might like to put a link to your github link above, presently it goes nowhere.

What is a 'PZEM-017 style modbus', I have not heard of it ?

Modbus is Modbus, ASCII, RTU or TCP to handle the various transport media, and modbus has nothing to do with any interface, that is always separate.

You might also like to describe the specifications of your INA226 based shunt, what are its operating parameters ?

But good to see some development.

Von Baron - VK7KPA

0 Likes 0 ·
Show more comments
robsweet avatar image robsweet commented ·

Hi, ks4z. Thanks for the project!

I've got it running and mostly working on an ESP32 WROOM (Adafruit ESP32 Feather). I've got a 12v system so I didn't do the voltage divider and I adjusted the voltage calibration accordingly. My volts/amps are coming through properly and I thought everything was working but when I connected it to the Cerbo and started reporting usage data, I realized that it's *way* over-reporting my usage. This is a tiny system (200W of solar panels ~25W of total load) but my consumption today is showing as 168kW so far today. It seems like either there's another place that needs to be adjusted for being a 12v system or something it's to do with the time calculation/alerting. I've been digging in the code but my C++ is sketchy at best and I haven't figured it out. Can you suggest any troubleshooting steps?

Thanks!

Rob

0 Likes 0 ·
Show more comments

Article

Contributors

ks4z contributed to this article WKirby contributed to this article