I²C Current Sensor Board INA219

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

DescriptionWorth
Supply voltage3-5V
Current measurement max+/- 3.2A
Test voltage0-26V
Accuracy 1%
Mit 12 Bit ADC Auflösung 0.8A
Interface I²C
Schnittstellenadresse per Lötpunkt wählbar0x40 ( 0x41 / 0x44 / 0x45 )
Dimensions (l/w)25,2 / 22,2
Chip I219A
Technical data from various sources (see below)
A0A1Address
openopen0x40 (delivery state)
closedopen0x41
openclosed0x44
closedclosed0x45
Address selection, Source: https://wolles-elektronikkiste.de/ina219

Areas of application

  • Measure power consumption
  • Determining the remaining battery life

Views

Programming

Wiring

Spanish

Arduino

Connection to the Arduino, source: https://wolles-elektronikkiste.de/ina219

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.

Arduino Gui 2- Installation Adafruid INA219 über Bibliothekar

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:

Steckbrett aufbau für INA219 mit ESP32 Node MCU
Serial monitor output of test program

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

https://github.com/adafruit/Fritzing-Library/blob/6e7cef636e276699652a9fcb8b7384e1f6e868f3/parts/retired/INA219%20DC%20Current%20Sensor%20Breakout.fzpz

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

Sources

Data sheet

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

https://botland.de/stromsensoren/19255-bidirektionaler-strom-leistungssensor-ina219-26v-32a-stemma-at-qwiic-adafruit-904-5904422379377.html

DateChangeAuthor
29.01.2024Post createdSuffocation

1 thought on “I²C Strom Sensor Board INA219

  1. 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).

Leave a Reply

Your email address will not be published. Required fields are marked *