I want to create a power meter and use arduino to log the info and send to the web. Is there any easy solution to the power meter? I live in Argentina and the power line is 220V. Thanks

  • \$\begingroup\$ Interesting question. What expectation do you have of the meter? How accurate should it be and what's your budget? I know some people did it using current measuring clamps on wires. Do you have each power wire exposed near the breakout box so you can measure it? Do you have single or three phase power supply? Please provide as much information as you can. \$\endgroup\$
    – AndrejaKo
    Commented Mar 21, 2011 at 19:56

6 Answers 6


You might check out Tweet-a-Watt and see if it will work with your 220V power line. That project should at least give you an idea of how to get started.

  • \$\begingroup\$ Very Hackerish, interesting. \$\endgroup\$
    – Kellenjb
    Commented Mar 21, 2011 at 19:59
  • \$\begingroup\$ Because why do what's already been done? It provides a clear path to learn how to do it, and if you learn more, how to do it better/do more. \$\endgroup\$
    – Nick T
    Commented Mar 22, 2011 at 1:57

Creating an accurate power meter is not a trivial task. You need a way of sensing the voltage and current with sufficient accuracy and speed that you can detect phase differences between them (power factor) and calculate the real and apparent power. You would almost want a DSP for this.

Creating a rudimentary power meter can be done by sensing and DC averaging the voltage and current, ignoring reactive power and the need to sample at high speeds. Accuracy will vary as a function of the quality of the load.

There are ICs on the market specifically for power metering, like the Microchip MCP3909 which you may be able to use with your Arduino.


This system from Smart Energy Groups may be of interest, it is based around Arduino hardware and so on.


You could use an HALL effect sensor (10-30e maybe?) with an Arduino board.


I have been working extensively building web connected Energy Monitors using the ESP8266 (with Arduino IDE) and various ADC's and dedicated Energy monitoring DSP's (ATM90E26 and ADE7763).

Fritzing diagram of basic ADC + Wifi enabled Arduino compatible NodeMCU is shown below: enter image description here

Code for using ESP8266 Energy monitor illustrated above is here. Please note that this is a low-accuracy simple to implement solution sampling the voltage using a transformer and the current using a CT. Higher accuracy solutions need to sample 240V directly (using a voltage divider ladder and shunt resistor) and require additional design considerations to handle issues arising from working with high voltages.


*  This sketch sends ads1115 current sensor data via HTTP POST request to thingspeak server.
 *  It needs the following libraries to work (besides the esp8266 standard libraries supplied with the IDE):
 *  - https://github.com/adafruit/Adafruit_ADS1X15
 *  designed to run directly on esp8266-01 module, to where it can be uploaded using this marvelous piece of software:
 *  https://github.com/esp8266/Arduino
 *  2015 Tisham Dhar
 *  licensed under GNU GPL

#include <ESP8266WiFi.h>
#include <Wire.h>
#include <Adafruit_ADS1015.h>

// replace with your channel's thingspeak API key, 
String apiKey = "XXXXXXXXXXXXX";
//WIFI credentials go here
const char* ssid     = "XXXXXXXXXXX";
const char* password = "XXXXXXXXXXXXXXXXXXXXX";
Adafruit_ADS1115 ads;  /* Use this for the 16-bit version */

const char* server = "api.thingspeak.com";
WiFiClient client;

double offsetI;
double filteredI;
double sqI,sumI;
int16_t sampleI;
double Irms;

double squareRoot(double fg)  
  double n = fg / 2.0;
  double lstX = 0.0;
  while (n != lstX)
    lstX = n;
    n = (n + fg / n) / 2.0;
  return n;

double calcIrms(unsigned int Number_of_Samples)
  /* Be sure to update this value based on the IC and the gain settings! */
  float multiplier = 0.125F;    /* ADS1115 @ +/- 4.096V gain (16-bit results) */
  for (unsigned int n = 0; n < Number_of_Samples; n++)
    sampleI = ads.readADC_Differential_0_1();

    // Digital low pass filter extracts the 2.5 V or 1.65 V dc offset, 
  //  then subtract this - signal is now centered on 0 counts.
    offsetI = (offsetI + (sampleI-offsetI)/1024);
    filteredI = sampleI - offsetI;
    //filteredI = sampleI * multiplier;

    // Root-mean-square method current
    // 1) square current values
    sqI = filteredI * filteredI;
    // 2) sum 
    sumI += sqI;

  Irms = squareRoot(sumI / Number_of_Samples)*multiplier; 

  //Reset accumulators
  sumI = 0;

  return Irms;

void setup() {

  // We start by connecting to a WiFi network

  Serial.print("Connecting to ");

  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {

  Serial.println("WiFi connected");  
  Serial.println("IP address: ");

  ads.setGain(GAIN_ONE);        // 1x gain   +/- 4.096V  1 bit = 2mV      0.125mV

void loop() {

  //Serial.print("Differential: "); Serial.print(results); Serial.print("("); Serial.print(trans_volt); Serial.println("mV)");
  double current = calcIrms(2048);

  if (client.connect(server,80)) {  //   "" or api.thingspeak.com
    String postStr = apiKey;
           postStr +="&field1=";
           postStr += String(current);
           postStr += "\r\n\r\n";

     client.print("POST /update HTTP/1.1\n"); 
     client.print("Host: api.thingspeak.com\n"); 
     client.print("Connection: close\n"); 
     client.print("X-THINGSPEAKAPIKEY: "+apiKey+"\n"); 
     client.print("Content-Type: application/x-www-form-urlencoded\n"); 
     client.print("Content-Length: "); 

  // thingspeak needs minimum 15 sec delay between updates
  • \$\begingroup\$ Welcome to EE.SE! Unfortunately, this seems to be at best an indirect answer to the question, and is mostly intended to drive traffic to your websites, which is a form of spam not allowed here. \$\endgroup\$
    – Dave Tweed
    Commented May 18, 2016 at 13:24
  • \$\begingroup\$ OK, you've removed the links. However, the OP seems to be asking more about the hardware side of the problem, not the software. Also, be aware that this is a 5-year-old question, and the OP never came back after asking it. \$\endgroup\$
    – Dave Tweed
    Commented May 18, 2016 at 15:19
  • \$\begingroup\$ I have added schematics of a proposed solution. The hardware to do this in an easy manner did not exist 5 years ago. It does now due to proliferation of wifi capable SoC's. \$\endgroup\$
    – whatnick
    Commented May 19, 2016 at 2:37
  • 1
    \$\begingroup\$ @Dave Tweed , Who cares about the OP? The whole point of SE is to be useful to the whole community, and whatnick's post added a new way to solve the problem (even without the added schematics). \$\endgroup\$ Commented May 19, 2016 at 5:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.