## Micropython library for the TI INA219 voltage/current sensor

Discuss development of drivers for external hardware and components, such as LCD screens, sensors, motor drivers, etc.
Target audience: Users and developers of drivers.
jcf
Posts: 60
Joined: Wed Mar 03, 2021 11:14 am

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

I discovered a bug in the library:

Code: Select all

``````@property
def shunt_voltage(self):
"""The shunt voltage (between V+ and V-) in Volts (so +-.327V)"""    # no, +-80mV!
# The least signficant bit is 10uV which is 0.00001 volts
# NO!! It is 2.5uV
# return value * 0.00001
return value * 0.0000025
``````
Chris defined the shunt voltage LSB as 10uV, but the datasheet says 2.5uV.
Unfortunately my results are still wrong after this correction (by a factor 5 for current and power)

chrisb2
Posts: 28
Joined: Sat Apr 01, 2017 4:19 am

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

Can you tell me where in the datasheet for the ina219 (https://www.ti.com/lit/ds/symlink/ina219.pdf) you saw 2.5uV? I see 10uV in the Electrical Characteristics table on page 5 where it say 10uV in the DC Accuracy section.

Chris

chrisb2
Posts: 28
Joined: Sat Apr 01, 2017 4:19 am

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

Probably you should raise an issue against my library (https://github.com/chrisb2/pyb_ina219/issues) if believe its wrong, rarther that further discussion in this old topic in a deprecated forum.

Chris

jcf
Posts: 60
Joined: Wed Mar 03, 2021 11:14 am

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

Hi Chris,
on page 16 you have a table where a resolution of 2.5uV is mentioned for the shunt register.
Also on page 24 they say Full scale = 81.92mV and LSB = 2.5uV
I do not see where you find 10uV on p.5.

Anyway, this datasheet is a mess! Totally confusing!
Probably you should raise an issue against my library (https://github.com/chrisb2/pyb_ina219/issues) if believe its wrong, rarther that further discussion in this old topic in a deprecated forum.
Hmmm... I have never done this. I'll see if I find out how to do it.
By the way, I like the old forum more than the new one.

jcf
Posts: 60
Joined: Wed Mar 03, 2021 11:14 am

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

Oh, I'm sorry, I noticed just now that I have added some confusion to this discussion.
I found this topic when looking for an INA226 lib. And I found yours, Chris.
Somewhere under this topic there is a mention of the 226, I mentioned it too in my post.
But you, Chris, spoke of the 219, I think?

Everything I posted is in relation to the INA226, also the bug I found.
Maybe I should have started a new topic...

scruss
Posts: 359
Joined: Sat Aug 12, 2017 2:27 pm
Contact:

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

jcf wrote:
Tue May 02, 2023 9:47 am
Maybe I should have started a new topic...
best on GitHub Discussions, since this forum is moribund

jcf
Posts: 60
Joined: Wed Mar 03, 2021 11:14 am

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

I have started a thread INA226 on the Github forum