Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
sagar saini
Published © GPL3+

Arduino based simple Watt-meter shield

This is an Arduino compatible shield which is able to measure the real time current, voltage and power ratings accurately.

BeginnerFull instructions provided1.5 hours845
Arduino based simple Watt-meter shield

Things used in this project

Story

Read more

Custom parts and enclosures

ARDUINO UNO SHIELD GERBER

ARDUINO NANO WATTMETER

Schematics

Circuit diagram shield

Circuit diagram Arduino Nano based

Code

Wattmeter code

Arduino
// Suitable with 12v battery, adaptor wattage, current and voltage monitoring.
// Resistor divider network need more upgradation if voltage is higher that 15.6
// Try 0x3D OLED address if screen did not work.
// Precision of the voltage depends on the tolerance of the resistors.

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

#define OLED_RESET -1
Adafruit_SSD1306 display(128, 64, &Wire, OLED_RESET);

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // Change the address to your's one
  display.clearDisplay();
}

void loop() {
  // put your main code here, to run repeatedly:
  int adc = analogRead(A0);
  int adc2 = analogRead(A1);
  float voltage = adc * 5 / 1023.0;
  float voltage2 = adc2 * 16.24/1023.0;        // resistor divider basics needed to be learn 
  float current = (voltage - 2.5) / 0.100; 

//0.100 for 20A, 0.185 for 30A, 0.66 for 5A
// follow this link:
//https://startingelectronics.org/articles/arduino/measuring-voltage-with-arduino/

  if (current < 0.16) {
    current = 0;
  }
  
   display.clearDisplay();
   display.setTextSize(1);
   display.setTextColor(WHITE);

   display.setCursor(10,10);
   display.print("Current : ");
   display.print(current);
   display.display();

   display.setCursor(10,20);
   display.print("Voltage : ");
   display.print(voltage2);
   display.display();

   display.setCursor(10,30);
   display.print("Power ");
   display.print(current*voltage);
   display.display();
   delay(1000);
}

Credits

sagar saini
81 projects • 85 followers
I am Sagar Saini an electronic hardware enthusiast

Comments