esphome / esphome/feature-requests
INA226 configure the "Operating mode" to save power
- Dominant language
- No language data
- Stars
- 450
- Forks
- 29
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the problem you have/What new integration you would like**
The device has a power-down or triggered mode setting in the Configuration Register (00h) (Read/Write)
MODE: Operating Mode
Bits 0-2 Selects continuous, triggered, or power-down mode of operation.
These bits default to continuous shunt and bus measurement mode.
Currently there is no option in ESPHome to change this mode or any other custom parameter for the setup.
I would like to see an option to write to this register.
https://github.com/Zanduino/INA/wiki/setMode()
**Please describe your use case for this integration and alternatives you've tried:**
My setup is battery operated with the INA226 used to monitor battery voltage and current consumption to calculate remaining battery charge and circuit consumption. While the INA226 is not being read it has a current draw of 220uA while it supports a power-down mode when the power consumption of the device drops to about 2uA considerably saving more power.
When requesting to do a measurement the device mode needs to change to "triggered" then back to "power-down".
There is no alternate way to reduce the power consumption of the device.
**Additional context**
Currently it is fixed and cannot be modified:
```
void INA226Component::setup() {
ESP_LOGCONFIG(TAG, "Setting up INA226...");
// Config Register
// 0bx000000000000000 << 15 RESET Bit (1 -> trigger reset)
if (!this->write_byte_16(INA226_REGISTER_CONFIG, 0x8000)) {
this->mark_failed();
return;
}
delay(1);
uint16_t config = 0x0000;
// Averaging Mode AVG Bit Settings[11:9] (000 -> 1 sample, 001 -> 4 sample, 111 -> 1024 samples)
config |= 0b0000001000000000;
// Bus Voltage Conversion Time VBUSCT Bit Settings [8:6] (100 -> 1.1ms, 111 -> 8.244 ms)
config |= 0b0000000100000000;
// Shunt Voltage Conversion Time VSHCT Bit Settings [5:3] (100 -> 1.1ms, 111 -> 8.244 ms)
config |= 0b0000000000100000;
// Mode Settings [2:0] Combinations (111 -> Shunt and Bus, Continuous)
config |= 0b0000000000000111;
if (!this->write_byte_16(INA226_REGISTER_CONFIG, config)) {
this->mark_failed();
return;
}
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with INA226Component::setup and the configuration-register writes shown in the issue, then trace how INA226 options are exposed in ESPHome. Compare the requested continuous, triggered, and power-down modes with the existing measurement flow; done means the operating mode can be configured and the requested measurement sequence is supported without breaking current defaults.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- embedded-iot
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100