This is my first blog for the DIY test and instrumentation challenges. I am going to build a tiny meter for measuring DC current, Voltage, Power, etc in the range used by small devices.

The measurement of current is always a bit challenging, as we have to measure them in a series circuit. The measurement is not possible usually without breaking a circuit, inserting some

wires for the measurement.


There are some direct methods used with creating a common ground between measured device and measuring device with the help of a register between them. Bur such meathods are

never so much reliable due to the use of common ground, which might make systems unstable.


The sensors could help to solve this challange. Sensors such as INA219 from Texas Instruments operate on an I2C bus configuration which makes it possible to measure live current.


In this project, the first part was to interface this sensor with MCU. I am using ESP32 as of now with Arduino IDE due to their ease of use and capability for remote monitoring over the




The challenge I faced here was to power up the raspberry pi via GPIO using a USB to TTL converter. The RaspberryPi is not starting and also the measurements are not showing up. I will find a solution as I go.

Now, I have got the solution to power up the RaspberryPi via GPIO. The thing is that it is required to use both GPIO 2 & 4 to supply 5V power & GPIO 6 to supply ground.


The following image shows the Pi running sshed via Putty and updates, the graph is the plot of current cunsuption in mAmps by Pi, It reaches at max. around 900 mAmps only sometimes.

It remains around 500mAmps normally.


When the RaspberryPi is powered of with

sudo shutdown or poweroff

commands still there is some power required by the status LED and other internal functions. If we unplug the cable then the power comsumption will be near to zero, as from the following screenshoots.



There is still some time before this contest closes. I would love to add a small display that could show live the data for power monitoring. For now, I only have an SSD1306 LCD display to make it work.

One more idea is that the power monitoring data can be sent to the loud such as AWS IoT where data is manipulated effectively but that is too much for such a small device. Also, it does not fit the project

theme well.

One more interesting thing is that a PoE HaT for RaspberryPi(any board basically) might have current monitoring capability with LCD. It would be interesting to know which part of software/hardware is consuming more power.



#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Wire.h>
#include <Adafruit_INA219.h>

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 32 // OLED display height, in pixels

#define OLED_RESET     4 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32

Adafruit_INA219 ina219;

void setup(void) 
  while (!Serial) {
      // will pause Zero, Leonardo, etc until serial console opens
  if(!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
    Serial.println(F("SSD1306 allocation failed"));
    for(;;); // Don't proceed, loop forever
  delay(2000); // Pause for 2 seconds
  uint32_t currentFrequency;
  // Initialize the INA219.
  // By default the initialization will use the largest range (32V, 2A).  However
  // you can call a setCalibration function to change this range (see comments).
  if (! ina219.begin()) {
    Serial.println("Failed to find INA219 chip");
    while (1) { delay(10); }
  // To use a slightly lower 32V, 1A range (higher precision on amps):
  // Or to use a lower 16V, 400mA range (higher precision on volts and amps):

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

void loop(void) 
  float shuntvoltage = 0;
  float busvoltage = 0;
  float current_mA = 0;
  float loadvoltage = 0;
  float power_mW = 0;

  shuntvoltage = ina219.getShuntVoltage_mV();
  busvoltage = ina219.getBusVoltage_V();
  current_mA = ina219.getCurrent_mA();
  power_mW = ina219.getPower_mW();
  loadvoltage = busvoltage + (shuntvoltage / 1000);
  //Serial.print("Bus Voltage:   "); Serial.print(busvoltage); Serial.println(" V");
  //Serial.print("Shunt Voltage: "); Serial.print(shuntvoltage); Serial.println(" mV");
  //Serial.print("Load Voltage:  "); Serial.print(loadvoltage); Serial.println(" V");
  Serial.print("Current:       "); Serial.print(current_mA); Serial.println(" mA");
  //Serial.print("Power:         "); Serial.print(power_mW); Serial.println(" mW");

  display.print(" mA");

//  display.setCursor(0,0);
//  display.print(power_mW);
//  display.print(" mWatt");