Page 2 of 2

Re: Micropython library for the TI INA219 voltage/current sensor

Posted: Sat Jun 13, 2020 6:13 pm
by elschopi
Hello everyone,

and thank you all for your help (and sorry for the long time of being quiet). I've had to deal with a few work and study issues :mrgreen: which did consume most of my time and/or motivation.
I've managed to adapt https://github.com/robert-hh/INA219 to work with my INA226. I have yet to figure out the calibration of values, but so far it looks promising - measured and computed values are not too far off of what my DMM tell me. So far I have only modified the calibration routine for 32V and 2A, but will change the rest soon accordingly.
@Roberthh: I have no experience in publishing modified libraries or such, what do I need to add or delete in my version of your library so I fulfill licenses? I do want to make it available to the public, but I also do not want to violate any licensing.
As I see it, I'd need to include credits to you in the header, as well as keep the existing "MIT License" header, and the "Adafruit" stuff too?

Greetings

Chris

Re: Micropython library for the TI INA219 voltage/current sensor

Posted: Sat Jun 13, 2020 8:09 pm
by Roberthh
Hi @elschopi, glad that it's working and that I could help. Looking at my drivers file, it seems to need some edit. Especially the hardware and software dependencies are not vaild.
About licensing: You have to copy/keep the header of file. And you have to include the first Authors copyright note. Do you not have to include me. I just changed the I2C access method, and that's just tiny change, way less than the work you have to adapt it to a INA226 device.

Re: Micropython library for the TI INA219 voltage/current sensor

Posted: Sun Jun 14, 2020 5:35 pm
by elschopi
Thanks again for your help =)
I'm in the middle of re-arranging the config register values, after I just figured out the differences. Interestingly, even though the differences are quite significant, it works even with the config register values for the INA219 device.
As soon as I have implemented these changes (and tested them), I'll be able to release the library into the wild :lol:
Maybe I can put together a small helper tool in Google sheets or something like that for the configuration register.
Anyhow, I'm learning very much from this, which I am very happy about. I've never been too involved with anything software-ish, so programming concepts and bit/byte operations are not exactly my best field :lol: I'm more a hardware / circuit-design kind of guy.

Thanks everyone, and a nice rest of the sunday (which here is a rainday)

Best regards
Chris

Re: Micropython library for the TI INA219 voltage/current sensor

Posted: Mon Jun 15, 2020 5:08 pm
by elschopi
Hello everyone,

I've managed to put it all together and am now proudly serving it on github under
https://github.com/elschopi/TI_INA226_micropython
I have a Google spreadsheet prepared for calculations and stuff, if anyone's interested - link is in the github readme.
Please feel free to educate me where and how I've done stupid things, as I'm not too experienced with this :lol:

Have a great day, and thanks to all for the great support

Best regards

Chris

Re: Micropython library for the TI INA219 voltage/current sensor

Posted: Mon Jun 15, 2020 6:32 pm
by Roberthh
Hello Chris,
the driver looks fine. One comment: I just removed from my driver these lines at the header:

Code: Select all

Implementation Notes
--------------------
**Hardware:**
* `Adafruit INA219 High Side DC Current Sensor Breakout
   <https://www.adafruit.com/product/904>`_
* `Adafruit INA219 FeatherWing <https://www.adafruit.com/product/3650>`_
**Software and Dependencies:**
* Adafruit CircuitPython firmware (2.2.0+) for the ESP8622 and M0-based boards:
  https://github.com/adafruit/circuitpython/releases
* Adafruit's Bus Device library:
  https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
They simply do not apply. You copied these too, and in your driver they fit even worse.

Re: Micropython library for the TI INA219 voltage/current sensor

Posted: Tue Jun 16, 2020 7:04 am
by elschopi
Hello Robert,

thanks for the feedback. I've removed these lines now, too.

Best regards,

Chris