Skip to content

INA3221 sensor handling requires updates #3325

Description

@cwichura

The INA3221 detection in MeshCore currently looks for it at only one address, 0x42. Depending on which pin A0 is shorted to, the INA3221 chip can have an address between 0x40 and 0x43. The popular Adafruit INA3221 board allows selection of either 0x40 or 0x41, for example, neither of which is detected by the current MeshCore implementation.

Further, the Adafruit library for the INA3221 (which it looks like MeshCore is using) does chip IP detection in begin(). The INA260 module also does chip IP verification, but the INA219 (which MeshCore fixes at 0x40) does NOT do chip ID verification.

Ideally, sensor detection would be updated to look for the INA3221 before the check for INA219 and test all four possible addresses. Don't need to support multiple INA3221s -- can stop scanning on first found. If found at 0x40, it needs to mark it as "claimed" so the INA219 driver won't also try to use it.

Additionally, MeshCore hard-codes the shunt resister value to 0.1. This does not match the resistors on the Adafruit board, which are 0.05. Ideally, a preference setting named something like sensor.ina3221.shuntr should be added and allow the operator to specify the value for the specific module they are using. (Technically you could have three different resistors for each of the channels -- in practice, I don't know if any modules actually do this. But the most complete solution would store three separate preference values for the three channels.)

My use case is a Station G3 with an Adafruit INA3221 module connected. The address jumper on the INA3221 has been soldered to select the 0x41 address. The Station G3 has an INA219 on the mainboard that monitors the input power to the Station G3. This is at the default INA219 address of 0x40, and does work correctly. I need the INA3221 to monitor (solar) input power to the MPPT in the build.

I also started a thread on the MeshCore.io Discord about this: https://discord.com/channels/1495203904898728149/1543388491071885522

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions