INA219 Element
The INA219 is a current and voltage sensor that uses the I2C bus for communication that can measure voltages up to 26V and current in various ranges.
The chip can easily be adapted to any Arduino microcontroller including ESP6266 and EPS32 as it can be powered by 3.3V to 5V.
It can be used as a monitor for voltage and current but also provides power consumption calculation.
The INA260 based sensors can also be controlled using this element.
Sensor Connectivity
The sensor chip uses a 3.3 V Supply voltage on VCC and GND and needs to be connected to the SDA and SCL line of the I2C bus. The I2C pins are configured using the properties of the device element and the I2C bus is normally shared by multiple elements e.g. sensors.
{
"device": {
"0": {
"i2c-scl": "D2",
"i2c-sda": "D1"
}
}
}
The default I2C address of the INA219 on the I2C bus is 0x40.
Element Configuration
The following properties are available for configuration of the element.
address - The I2C address of the sensor. The default value is 0x40.
readTime -??? Time between 2 probes from the sensor are fetched. The default value is 1 minute.
Configuration Example
This example shows how to configure this element:
{
"ina219": {
"0": {
"title": "sensor",
"description": "Voltage and Current Sensor",
"range": "32",
"samples": "12bit",
"gain": "320",
"warmuptime": "2s",
"readtime": "10s",
"onVoltage": "displaytext/v?value=$v",
"onCurrent": "displaytext/a?value=$v,log/a?value=$v",
"onPower": "displaytext/p?value=$v"
}
}
}
See also
- Datasheet from Texas Instruments https://www.ti.com/lit/ds/symlink/ina219.pdf
- https://diyi0t.com/ina219-tutorial-for-arduino-and-esp/
- https://i2cdevices.org/addresses