Last Updated on 29. January 2024 by Suffocation
Der INA219 misst den Strom eines Verbrauchers und kann per I2C Bus ausgelesen werden. Ich habe diesen mal an einen ESP32 gehängt und versucht ihm ein paar Daten zu entlocken.
Facts
| Description | Worth |
|---|---|
| Supply voltage | 3-5V |
| Current measurement max | +/- 3.2A |
| Test voltage | 0-26V |
| Accuracy | 1% |
| Mit 12 Bit ADC Auflösung | 0.8A |
| Interface | I²C |
| Schnittstellenadresse per Lötpunkt wählbar | 0x40 ( 0x41 / 0x44 / 0x45 ) |
| Dimensions (l/w) | 25,2 / 22,2 |
| Chip | I219A |
| A0 | A1 | Address |
|---|---|---|
| open | open | 0x40 (delivery state) |
| closed | open | 0x41 |
| open | closed | 0x44 |
| closed | closed | 0x45 |
Areas of application
- Measure power consumption
- Determining the remaining battery life
Views


Programming
Wiring
Spanish

Arduino

Libraries
Here are a few links to libraries,
https://github.com/adafruit/Adafruit_INA219
https://github.com/RobTillaart/INA219
https://github.com/wollewald/INA219_WE
Ich habe für meine Tests die Adafruit Lib verwendet. Diese kann entweder über das Zip von Github oder über den Biliothekaren installiert werden.

Attention es gibt Abhängigkeiten die mit installiert werden müssen:
- – Adafruit BusIO
- – Adafruit GFX Library
- – Adafruit NeoPixel
- – Adafruit SSD1306
Die GFX Lib kann ich mir noch vorstellen, bei den anderen wüsste ich nicht welche Abhängigkeiten bestehen sollten, habe sie aber sicherheitshalber mal mit installiert.
Test programme
Mein Testporgamm ist auf Git zu finden, es entsprich im großen und ganzen den Beispielprogramm.
https://github.com/sfambach/sensors/blob/master/INA219/src/INA219_ESP32_TEST/INA219_ESP32_TEST.ino
This is what it looks like:


Problems
Cannot find the I2C sensor
Sometimes swap the data and time cables, or try with the I2C Test Program Have a look, maybe you have another address. When using the ESP, pay attention to which pins you've used.
Miscellaneous
Fritzing part
Conclusion
Leich einzubindender Sensor um Strom zu messen. Sein Vorteil ist die Kommunikation über I²C. Er wird nicht wie andere Sensoren über einen ADC am Microcontroller selbst abgefragt. Der Preis liegt so zwischen 3 und 4€ bei den Amazonen und noch billiger beim schnellen Ali. Auch können bis zu 4 Sensoren (Einstellung der Adresse beachten) parallel betrieben werden.
Verwandte Beiträge
- Preview – INA3221 Power Monitor
- LM2596 Step Down Voltage Converter
- Preview – Current Measurement with the ACS712
Sources
https://wolles-elektronikkiste.de/ina219 (Recommended, good description with example)
https://github.com/adafruit/Adafruit_INA219
https://github.com/RobTillaart/INA219
https://github.com/wollewald/INA219_WE
| Date | Change | Author |
|---|---|---|
| 29.01.2024 | Post created | Suffocation |
Even a small load should under no circumstances be connected via the pin header. The trace widths here are quite thin and only reach the INA219 and then the load resistor, with a few milliohms of resistance in between. This results in excessively high readings (I ended up with a reading of around 20% too high).