Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: INA226 not reporting correctly #5969

Open
morcant opened this issue Jan 31, 2025 · 2 comments · May be fixed by #5972
Open

[Bug]: INA226 not reporting correctly #5969

morcant opened this issue Jan 31, 2025 · 2 comments · May be fixed by #5972
Labels
bug Something isn't working

Comments

@morcant
Copy link

morcant commented Jan 31, 2025

Category

Other

Hardware

Rak4631

Firmware Version

2.5.18

Description

I have this INA226 module connected via i2c bus to wisblock: https://www.amazon.com/INA226-Voltage-Current-Module-Monitoring/dp/B08MKSQSL9

I have it wired up like this, though I have tried a variety of other wiring methods as well:
Image

The voltage is off by a factor of 1000. (0.0135 vs 13.5V) and current is not reported at all, when I know there is 0.05A of current.

I have this same model in use on an esp32 with esphome wired this way, and it's reporting voltage and amperage correctly. I cannot easily swap them to see if this unit is defective, but my suspicion is that since support was just added in recent firmware that it may be a bug in meshtastic code.

Relevant log output

INFO | 19:46:54 19 [PowerTelemetry] Power Telemetry: init
INFO | 19:46:54 19 [PowerTelemetry] Init sensor: INA226
INFO | 19:46:54 19 [PowerTelemetry] Opened INA226 sensor on i2c bus

INFO | 20:09:55 1400 [PowerTelemetry] Send: ch1_voltage=0.000000, ch1_current=0.000000, ch2_voltage=0.000000, ch2_current=0.000000, ch3_voltage=0.013459, ch3_current=0.000000
DEBUG | 20:09:55 1400 [PowerTelemetry] Partially randomized packet id 2217119550
INFO | 20:09:55 1400 [PowerTelemetry] Send packet to phone
@morcant morcant added the bug Something isn't working label Jan 31, 2025
@fifieldt
Copy link
Contributor

fifieldt commented Feb 1, 2025

Thanks for the report! This is a newly-supported sensor, so this may well be a bug. Having a look at the code.

@fifieldt
Copy link
Contributor

fifieldt commented Feb 1, 2025

Yup - it looks like inside meshtastic we use milliVolts but the sensor library returns volts. Adding code to multiply that by 1000.

The lack of current is not so straightforward - everything looks to be in milliAmps there.

fifieldt added a commit to fifieldt/meshtastic-firmware that referenced this issue Feb 1, 2025
They were off by a factor of 1000 due to the difference between
Volts and MilliVolts, as reported by @morcant .

Fixes meshtastic#5969
@fifieldt fifieldt linked a pull request Feb 1, 2025 that will close this issue
fifieldt added a commit to fifieldt/meshtastic-firmware that referenced this issue Feb 1, 2025
They were off by a factor of 1000 due to the difference between
Volts and MilliVolts, as reported by @morcant .

Fixes meshtastic#5969
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants