Meter PZEM-004 + ESP8266 & Platform IoT Ubidots

In this opportunity we will integrate our active power meter or power consumption, Peacefair Pzem-004 with the IoT Ubidots platform using an ESP8266 module, later we will create a dashboard to visualize the 4 available variables such as active power, accumulated electrical consumption, voltage and current .

PZEM-004 + ESP8266 12E NodeMCU
PZEM-004 + ESP8266 12E NodeMCU

Ubidots for Education

Previous Tutorials Recommended

Tutorial Platform IoT Ubidots & ESP8266 + Sensor DHT11

This tutorial will show how to communicate an ESP8266 and a DHT11 sensor with Ubidots from scratch:

Tutorial Platform IoT Ubidots & ESP8266 + Sensor DHT11

Electricity consumption meter Peacefair PZEM 004 + ESP8266 & Arduino Nano

If you want to know more about Peacefair’s Pzem-004 meter, I recommend the following tutorial:

Features, Connections, Arduino and ESP8266.

Electricity consumption meter Peacefair PZEM 004 + ESP8266 & Arduino Nano

Tests Performed

We will measure the electrical consumption of a resistance to heat water, consume approximately 870 Watts and visualize the measurements in a platform / Dashboard called Ubidots for Education.

An extension with a multi-outlet has been manufactured and in one of its wires the CT “CurrentTransformer” has been placed, although technically the measurement of one of the led lamps is made, and the heating resistance which presents the consumption more significant.

Important Note: Do not connect these resistors without being submerged in water, the resistance could burn instantly.


Materials and where to buy them very cheap !!

Other Recommended Equipment


Simple Test Meter PZEM-004 & ESP8266 Platform IoT Ubidots


 Arduino IDE Code

The routine created in Arduino IDE, esp8266 performs the reading of the meter pzem-004 through the serial port.

Four variables have been added:

  1. Instantaneous voltage
  2. Instant current.
  3. Instant power.
  4. Accumulated power.

The sending and / or updating of data is done every 15 seconds, in this tutorial case, the recommended is 5 or 10 minutes for updating.

Note: Download links and / or github below.



Dashboards Web Version

After performing the code download to ESP8266, the variables are automatically displayed, they only need to be configured from the widgets.



Dashboard  Ubidots from Android

Tests were also performed analyzing the views from Android, you can also see the Dashboard perfectly.


Video : Quick Test Meter PZEM-004 & ESP8266 Platform IoT Ubidots in Android



Visually Ubidots is very eye-catching and intuitive with regard to uncomplicated configuration, there are no problems with the display of Decimals.

As I mentioned before, there are 2 versions of Ubidots, Industrial version or for companies and the version for education which we have used in this tutorial, if you want to know differences between both versions:

As in almost all platforms there are operating characteristics per device, widgets, dashboard or data retention time in this case are the credits, have created this table to explain those aspects of the platform:

In general there was no major complication, this is only a basic test, in future integrations with Ubidots derived from this project we could perform:

  • Measurements of temperature.
  • Heating resistance control via Rele or PWM AC.
  • Integrations with Wifimanager to facilitate configuration.
  • OTA integrations for remote programming of esp8266.

Downloads / Github



Leave a Reply