Introduction

Gravity: I2C Digital Wattmeter is a high-resolution, high-precision, large-scale measurement module that can measure the voltage, current and power of various electronic modules and electrical equipment within 26V 8A, and the maximum relative error is less than ±0.2% (A simple manual calibration is required before usage). It can be used for power consumption or battery life evaluation of solar energy systems, battery, motors, controller or electronic modules.

The module adopts TI INA219 zero temperature drift current/power monitoring chip and 2W high power low temperature drift 10mΩ alloy sampling resistor. The voltage and current resolution can reach 4mV and 1mA respectively. Under the full scale measurement condition, the maximum relative error of voltage and current measurement is lower than ±0.2%. It provides also four I2C addresses that can be configured via the 2P DIP switch. The module accurately measures bi-directional high-side currents (current flowing through the power supply or battery positive), which is especially useful in solar or battery fuel gauge applications where the battery needs to be charged and discharged. This status can be simply determined by positive or negative current readings. In the motor applications, the current can be monitored in real time by monitoring whether the motor current is too large due to overload. In addition, you can use this module to measure the power consumption of various electronic modules or the entire project to evaluate battery life.

Features

Application

Specification

Board Overview

No. Label Description
1 VCC Power VCC(3.3~5.5V)
2 GND Power GND
3 SCL I2C clock signal
4 SDA I2C data signal
5 ADDR I2C address DIP switch
6 3P TERMINAL Voltage and current measurement terminal 3P

Arduino Tutorial

This tutorial presents a basic usage of the module with Arduino UNO.

Requirements

Connection Diagram

Calibration

Sample Code


/*!
   file getVoltageCurrentPower.ino
   SEN0291 Gravity: I2C Digital Wattmeter
   The module is connected in series between the power supply and the load to read the voltage, current and power
   The module has four I2C, these addresses are:
   INA219_I2C_ADDRESS1  0x40   A0 = 0  A1 = 0
   INA219_I2C_ADDRESS2  0x41   A0 = 1  A1 = 0
   INA219_I2C_ADDRESS3  0x44   A0 = 0  A1 = 1
   INA219_I2C_ADDRESS4  0x45   A0 = 1  A1 = 1

   Copyright    [DFRobot](http://www.dfrobot.com), 2018
   Copyright    GNU Lesser General Public License
   version  V0.1
   date  2018-12-13
*/

#include <Wire.h>
#include "DFRobot_INA219.h"

DFRobot_INA219 ina219;

// Revise the following two paramters according to actula reading of the INA219 and the multimeter
// for linearly calibration
float ina219Reading_mA = 1000;
float extMeterReading_mA = 1000;

void setup(void)
{
    Serial.begin(115200);
    while (!Serial) {
        delay(1);
    }

    Serial.println("Hello!");
    ina219.setI2cAddr(INA219_I2C_ADDRESS4);     //Change I2C address by dialing DIP switch
    while(!ina219.begin(&Wire)){                //Begin return True if succeed, otherwise return False
        delay(2000);
    }
    ina219.linearCal(ina219Reading_mA, extMeterReading_mA);
    //ina219.reset();                           //Reset all registers to default values



    Serial.println("Measuring voltage and current with INA219 ...");
}

void loop(void)
{
    float shuntVoltage = 0;
    float busVoltage = 0;
    float current_mA = 0;
    float power_mW = 0;

    shuntVoltage = ina219.getShuntVoltage_mV();
    busVoltage = ina219.getBusVoltage_V();
    current_mA = ina219.getCurrent_mA();
    power_mW = ina219.getPower_mW();

    Serial.print("Bus Voltage:   "); Serial.print(busVoltage,3); Serial.println(" V");
    Serial.print("Shunt Voltage: "); Serial.print(shuntVoltage,2); Serial.println(" mV");
    Serial.print("Current:       "); Serial.print(current_mA,0); Serial.println(" mA");
    Serial.print("Power:         "); Serial.print(power_mW,0); Serial.println(" mW");
    Serial.println("");

    delay(1000);
}

Results

Raspberry Pi Tutorial

This tutorial presents a basic usage of the module with Raspberry Pi.

Requirements

Connection Diagram

Installation

pi@raspberrypi:~ $ sudo raspi-config
pi@raspberrypi:~ $ sudo apt-get update
pi@raspberrypi:~ $ sudo apt-get install build-essential python-dev python-smbus git
pi@raspberrypi:~ $ git clone https://github.com/DFRobot/DFRobot_INA219.git

Run Sample Code

pi@raspberrypi: $ cd ~/DFRobot_INA219/RaspberryPi/Python/example
pi@raspberrypi:~/DFRobot_INA219/RaspberryPi/Python/example $ python getVoltageCurrentPower.py

Results

Applications

FAQ

For any questions, advice or cool ideas to share, please visit the DFRobot Forum.

More Documents

DFshopping_car1.png Get SEN0291 Gravity: I2C Digital Wattmeter from DFRobot Store or DFRobot Distributor.

Turn to the Top