I’m using a nice little board for monitoring a 12V solar system by Stephen Rodgers based around ESP8266 and INA226:
the code for this board is very good, but it is complex to set-up the build environment as it need Linux, and some of the dependencies are outdated resulting in need for code update. I thought to give it a try and port it to platform.io, but I don’t even know where to start.
I already use several OMG gateways for RTL and BT, and like it very much. As it already have support for the INA226, I gave it try. I’ve got it to work by changing the required I2C pins and hardware address for the chip, and I’ve set the correct shunt resistance. For reasons unknown I get wrong values for the current, voltage is fine.
The board works fine with the example code and libary by Korneliusz Jarzebski. I don’t know if the ZsensorINA226.ino is based on this or not? Also ZsensorINA226.ino seems to do the calculation of current in the code, not by the INA itself, why is this?
I’m planning to use the modified example code by Korneliusz in OMG, and let the INA do the calculation, where inputs are “shunt resistance” and “max current”, ideally configurable trough MQTT, but we will see how far I get…
I have a question; can I just add the dependencies (INA226.cpp and INA226.h) or would it be best to merge it to one file, similar to ZsensorINA226.ino?
Is adding the library files (INA226.cpp and INA226.h) an option or does to project structure not allow for this? or maybe there are other good reasons for not doing this?
This worked.
Version 1.0.0 of the library had error on the calculation of shunt parameters. In 1.1.0 this has been corrected. I will share the config once everything is completed, and tested properly. I will now try to figure out how to enable setting the shunt value and max current from home assistant trough MQTT, I see that sliders has been use for other inputs, but for the shunt resistance value a number input would be most suited.
I have another question.
As the board I’m using have to mosfet outputs I also configured the on off actuator, which works fine, however is it possible to configure two individual outputs?
I’m now quite happy with the result and wanted to share what I did in case others may be wanting to to the same.
I’ve made some changes to the “ZsensorINA226.ino” file:
And provided some info here:
I don’t know if this is the correct way of doing this, by generating forks I mean, and making changes?
As mentioned before, I wish to try and implement configuration functionality such as measurement interval and perhaps shunt resistance and range setting, based how configuration is done in the BT gateway, I will report back if I’m successful.