INA237 showing up as INA238?

Has anyone seen this before?

I recently purchased some INA237’s from the Adafruit store, but when connecting to my feather, I am receiving the below alert on reading the default address of 0x40 using the INA237 configuration in ESPHome:

Device model mismatch. Found device with ID = 238. Please check your configuration.

When I change the device to the INA238, the voltage/current registers in HA. On INA237, no values register. I am also unsure if they are the correct numbers as I have not compared yet to a metered reading.

Have a look what the markings on the chip say…

The chip says 237. Adafruit is saying it’s an issue with ESPHome.

Likely yes.
Though Adafruit also states “The INA237 and INA238 are completely code and hardware equivalent.”

Yes, but gain and offset need adjustment. Mainly was asking to see if I should file a bug report to address the issue.

I think you should. Assuming that Adafruit uses genuine components…

Yes and no.

Here is the code where it checks the ID:

  if (this->dev_id_ == 0x228 || this->dev_id_ == 0x229) {
    ESP_LOGI(TAG, "Supported device found: INA%x, 85-V, 20-Bit, Ultra-Precise Power/Energy/Charge Monitor",
             this->dev_id_);
  } else if (this->dev_id_ == 0x238 || this->dev_id_ == 0x239) {
    ESP_LOGI(TAG, "Supported device found: INA%x, 85-V, 16-Bit, High-Precision Power Monitor", this->dev_id_);
  } else if (this->dev_id_ == 0x0 || this->dev_id_ == 0xFF) {
    ESP_LOGI(TAG, "We assume device is: INA237 85-V, 16-Bit, Precision Power Monitor");
    this->dev_id_ = 0x237;
  } else {
    ESP_LOGE(TAG, "Unknown device ID %x.", this->dev_id_);
    this->device_mismatch_ = true;
    return false;
  }

with this commit INA228/INA229, INA238/INA239, INA237 power/energy/charge monitor (I2C… · esphome/esphome@b06e074

This datasheet for the INA237 INA237 85-V, 16-Bit, Precision Power Monitor With I2C Interface datasheet (Rev. A) is conspicuously missing the definition of register 3Fh (it should be in Table 7-3 on page 21, but is not there).

This is likely because the INA237 is just an INA238 that did not meet the specs when it was tested and so it was rebranded as an INA237. There is always process variation and some parts will be better than others. Sometimes these get thrown out. Other times they end up in the gray market. Here, TI is avoiding throwing them out and sells them for less because they are not as good as the others.

The log you sent shows that your chip (despite saying it is an INA237 on the cover) identifies as an INA238 on the inside. So to make esphome happy, you should tell it that it is an INA238. Maybe some INA237 devices identify as all zeros or all ones. The datasheet doesn’t say anything about what they should do. So, really the right answer (for yours) is to say you have an INA238 (it just isn’t quite as good as the ones you have to pay extra to get).

2 Likes