Home/Tutorials/Arduino Power Meter

Arduino Power Meter

Ever wanted to measure the power consumption of an electronics project?

You easily can with the Arduino and INA219 Power Sensor! In this tutorial we’ll learn the following:

  • What the INA219 Sensor Is

  • How to Connect It to Arduino

  • What Code to Use

What the INA219 Sensor Is

The INA219 is a I2C Bi-directional DC Current Power Supply Sensor. It passes voltage through the Vin+ and Vin- pins and can output the voltage and current information via the I2C protocol. Lucky for us, Arduino can communicated via I2C and allow us to print the information onto the serial monitor.

But what if wanted to create something resembling a multimeter where the measured voltage and current were shown on a display? Well we can definitely use a small OLED screen!

How to Connect It to Arduino

The following clip is a demo where I created a breadboard circuit with the INA219 and OLED screen to measure the voltage and current going through a small motor.

Below is the wiring diagram of that demo circuit. Note that there is a GND wire going from the battery pack to the negative rail of the breadboard. This is so the Arduino can have that reference point to properly measure the voltage. You can replace the motor to be any small load.

What Code to Use

You’re going to need to install some libraries to use the OLED screen and INA219.

1) For the OLED, you can lookup “adafruit ssd1306” in the Library Manager of the Arduino IDE and download the one provided by Adafruit.

2) This library needs to be paired with the Adafruit GFX Library, so you can lookup “adafruit gfx” and download the library provided by Adafruit.

3) Lastly, we need to download the library for the INA219 sensor. In the Library Manager, lookup “adafruit ina219” and install the one provided by Adafruit.

The following is the code used in the video. Feel free to set up your own circuit and try it out! It could be a great way to test low power electronic projects.

Copy to Clipboard
By |Published On: October 11th, 2021|Categories: Tutorials|

Share This Article