Function Description
INA219 is a cool sensor electronic module that not only allows us to measure current, but also voltage. With a little formula, we can even measure Power.
In terms of voltage, INA219 can measure up to 26 Volt DC.
At +/- 3.2A, the current measurement range is suitable for most smaller measurements. In other words, you can measure more than 75 watts of power.
Pin Out Module
The figure and table below detail some of the module’s features, including pin outs.
Required Library
One of the INA219 libraries that is quite popular is the one released by Adafruit which can be downloaded HERE.
Extract the library file and copy it into the library folder of the Arduino IDE Installation.
Circuit Diagram
Connect Arduino as shown
You need some other components besides Arduino and INA219 :
- resistor 200 ohm
- LED 5mm
- Battery 9 volt.
Arrange as the following picture :
Program Code
The following example sketch / program to run the INA219 module. The Adafruit library also includes several sample programs that we can use to try the INA219 module.
#include <Wire.h> #include <Adafruit_INA219.h> // You will need to download this library Adafruit_INA219 sensor219; // Declare and instance of INA219 void setup(void) { Serial.begin(9600); sensor219.begin(); } void loop(void) { float busVoltage = 0; float current = 0; // Measure in milli amps float power = 0; busVoltage = sensor219.getBusVoltage_V(); current = sensor219.getCurrent_mA(); power = busVoltage * (current/1000); // Calculate the Power Serial.print("Bus Voltage: "); Serial.print(busVoltage); Serial.println(" V"); Serial.print("Current: "); Serial.print(current); Serial.println(" mA"); Serial.print("Power: "); Serial.print(power); Serial.println(" W"); Serial.println(""); delay(2000); }
Output
After the sketch / program is uploaded, open the monitor series. If everything goes smoothly, the output should look like the following picture :
Leave a Reply