On previous blog page https://solarduino.com/pzem-017-dc-energy-meter-with-arduino/ ,we have discussed on how to read the PZEM-017 using PC and LCD Display Shield using Arduino Uno. Today, we go a bit further by sending those measurement values to the internet web interface using Blynk App for online remote monitoring.
For those who are new, PZEM-017 DC Energy Meter is a commercial DC Energy module using RS485 communication to send measurement data. It does not have a display thus user has to provide a display platform such as LCD Display module or display on the web interface. For people that do not want to DIY and setup the whole monitoring system, they might consider this energy module which already provided the necessary sensors, just the matter of some wiring and send data to the web interface for display.
Let us go step by step on the hardware that required for the monitoring, then slowly go to the software. The hardware required are PZEM-017 DC Energy Meter , NodeMCU micro-controller , MAX485 UART TTL RS485 converter and some dupont wires. As for software, we will need Arduino IDE software and Blynk App which will be further discussed below.
Warning ! You are now dealing with high power source ! We assumed that you have the basic electrical knowledge and know what you are dealing with. You may need guidance from experienced guys if you are new to electrical work. Safety and Precaution must be always have in mind. We shall not be responsible for anything happening to you.
PZEM-017 DC Energy Module
PZEM-017 is a DC Energy Module that can support up to 300Vdc and the current measurement is subject to external shunt installed. It can be up to 50A, 100A, 200A and 300A. You can get it at a very competitive price at our affiliate link here !!!
PZEM-017 is a DC communication module that can measure DC power up to 300VDC and current measurement is subject to external shunt installed ranges 50A, 100A, 200A and 300A. It is a module that made from Peacefair, a very famous Chinese brand with good quality and price that specialize in Metering products. This module can measure Voltage, Current, Power and Energy. However, it only can measure in one direction.
PZEM-017 does not have Display on it, that is why it is cheap to own. It has a built in RS485 communication interface using Modbus-RTU protocol similar to most industrial devices. The measured values can be displayed on your PC using UART to RS485 converter with its come-along software. You can download the software here !!!
It sounds complicated and useless, but I have done the hard work so you don’t need to. I’ll be dealing with the programming which all you need to do is just the physical wiring. Today I will show you how easily to read the measurement values using Node MCU Micro controller and display on the Blynk App. Has it convinced you? Let’s get started !
NodeMCU micro-controller
The NodeMCU micro-controller is similar to Arduino micro-controller board. It is compatible with Arduino IDE software and is built-in with the ESP8266 module which can be connected to the internet. You can grab some at our affiliate link here !!!
Node MCU Micro controller Base
The based below the Node MCU can provide more flexibility on the connection ports to support more sensors. Besides, it also has 12V input port and able to provide 5V power supply to support the sensors. Support us by purchase it from our affiliate link here !!!
Since this AC Energy Measurement Device uses RS485 communication, we need a converter module that can convert RS485 to Serial communication in order to communicate with Node MCU board. We need a UART TTL to RS485 converter module. Generally there are 2 types of RS485 converter module 1) only 2 communication output pins named Tx and Rx and 2) 4 communication output pins named DI, DE, RE and RO). In this example we are using the 4 pins module (Type 2).
MAX485 UART TTL RS485 converter
This is a module that converts between RS485 communication and Serial (UART TTL) communication. This module enables Arduino to communicate, read or provide command to devices that using RS485 communication. Quickly grab this module at our affiliate link here !!!
Dupont line Wires
In order to connect wiring between Arduino board and module fast and easy, you need the dupont line cables. These cables are suitable during testing and troubleshoot where a lot of wire modifications. You can get it at our affiliate link here !!!
Hardware Connection
You may dealing with High Power Source, any exposed conductors need to be isolated and fused. Turn the measurement power source OFF during hardware connection. I recommend to use ferrule lug for terminal tight connection and prevent stranded conductor accidentally touching adjacent cable line which might cause short circuit and fire risk. Furthermore, no conductive materials are placed around the workplace and use non-metallic enclosure or project box.
If you get a PZEM 017 DC energy meter, it may comes with a shunt of different sizes, you can program the shunt value into the energy module so that it could display the correct current value. Any direct connection from power source need to be protected with over-current device such as fuse. The fuse rating must be lower than the cable current carrying capacity to avoid cable burn and fire risk. It is highly recommend to use ferrule lugs at cable terminals.
Wiring of Serial to RS485 Converter Summary :
- A to A terminal of Energy Module
- B to B terminal of Energy Module
- Vcc to 5V positive
- Gnd to 5V ground
- RO to D2 Pin of Node MCU
- DI to D3 Pin of Node MCU
- RE to D1 Pin of Node MCU
- DE to D0 Pin of Node MCU
Blynk App – The Online Data Monitoring Platform
Blynk is a user friendly platform that provide web interface for data display. It provide smart phone app for easy setup and monitoring. In the app, there are a lot of Widget Boxes which suits a lot of measurement data. However, if you want to use the Widgets, it will consume energies based on the Widget types, similar to online games that you may need to top up the energy when you require more widgets. Upon creating an account, there will be some energy which should be enough for small project.
Ferrule Lugs and Crimper Set
Ferrule lugs are used at terminals for tight and secure connection. Besides, it also prevent stranded cables accidentally touching adjacent power line that may cause short circuit. Grab 1 at our affiliate link here !!!
Software Step by Step Guideline
The software part will be divided into 2 parts: 1) the smart phone web interface Blynk App and the 2) programming part using Arduino IDE Software.
On phone
- Download Blynk App on your smart phone (Google Play / AppStore).
- Open and create an Account on Blynk App.
- Add New Project (see below section)
- Blynk will send a Auth Token to your email specifically for this project.
- At your project main page, swap to the right to open Widget Box.
- Add Widget based on your desire:
Widget settings :
Virtual pin V0 = DC Voltage Value
Virtual pin V1 = DC Current Value
Virtual pin V2 = DC Power Value
Virtual pin V3 = DC Energy Value
Virtual pin V4 = Energy Reset Button
On Laptop / PC
- Install Arduino IDE Programming Software (If you do not have the software, click here to download)
- Install Node MCU Board Manager for using Node MCU in Arduino IDE Programming Software (see below section)
- Install Node MCU ESP8266 Library for using Wifi codes in Node MCU (see below section)
- Install Modified Modbus Library for using Modbus communication codes in Node MCU (see below section)
- Install ESPSoftwareSerial Library to convert Digital Pins to Serial virtual ports so that we can have additional Serial Port to communicate with the Module.
- Install Blynk Library for enable the Node MCU using Blynk server (see below section)
- Copy Auth Token from the email, note down the Wifi name & password.
- Upload the code to Node MCU Board.
Install Node MCU Board Manager
If this is the first time you are dealing with NodeMCU, you need to add NodeMCU board manager file into the IDE software so that the software can support the Node MCU board. To add the Support File, open Arduino IDE Software, go to files>preferences>Additional Boards Manager URLs, paste this link http://arduino.esp8266.com/stable/package_esp8266com_index.json to the black space and click OK. Go to Tool > Board > make sure the board is showing NodeMCU 1.0 (ESP-12E module).
Terminals Crimping Plier Set
This is a crimping tool with interchangeable jaw for crimping many types of terminals. It is a must have for DIY electronic and electrical for professional installation work. You may choose at out affiliate link here !!!
Install ESP8266 Wifi Library
If this is the first time you are dealing with Wifi programming, this ESP8266 Wifi Library file is needed to be installed to the Arduino IDE Software so that it can understand the programming function. Go to Tools > Boards > Boards Manager and download the ESP8266 library by ESP8266 Community
Install Modified Modbus Master Library
If this is the first time you are dealing with modbus communication, this Modified Modbus Master Library file is needed to be installed to the Arduino IDE Software so that it can understand the programming function. If you have installed the original ModbusMaster.h library from library management, kindly look into the folder and delete it or it will clash with this library.
The Modified Modbus Master Library I get it from EvertDekker.com and I have uploaded the zip file here so that you can download and install it. Go to Sketch > Include Library > Add.ZIP Library…. and locate the zip file. Make sure you download it to your PC first (preferably download at desktop)
Relay Switches Module
Relay is often important to enable micro-controller to control larger loads. More relay switches are used especially for smart home remote controlling. You may get one of those at our affiliate link here !!!
Install ESP Software Serial Library
If this is the first time you use the Software Serial to add Serial Port, you may need to install and download the ESPSoftwareSerial Library in the manage library section. This Library is different with the standard Software Serial, so be sure to install the correct library. Go to Tools > Manage Libraries … and type “ESPSoftwareSerial”. Download from Peter Lerup.
Install Blynk Library
If this is the first time you are dealing with Blynk server, this Blynk Library file is needed to be installed to the Arduino IDE Software so that it can understand the programming function. Go to Tools > Boards > Boards Manager and download the Blynk library by Volodymyr Shymanskyy
Arduino Starter Kit
It is a complete set which include most of the components you need to start Arduino Projects. Kindly support us by grabbing one set at our affiliate link here !!!
NOTE : You need to provide DC Voltage in order for the Communication Module to be ACTIVE. Optionally you can add Auxiliary Power via the Micro USB Port provided. If possible, power the RS485 Converter and communication Module with external 5V power source.
The smart phone Blynk app and Arduino IDE software are two independent parties. As long as you do it right, the Node MCU board should be able to send toe data to the Blynk server so that you can see the values from your smart phone. One of the advantage of using Blynk is that the Blynk server can allow for data storage so that you can trace or download previous record. All the hard part have been done, all you need is just following the instruction and it should work well. You can customize your web interface at Blynk App. Below is one of the example how it would look like.
Before we end, we would like to give gratitude to you for taking the time to read the post. We would need readers like you to support us in order to keep growing. You can support us in the following ways :
Donate & Fund Raising
If you like my work, please send me a donation to encourage me to do more. Thanks
Aliexpress Affiliate
We are the member of Aliexpress affiliate marketing. Do support us by clicking the affiliate product links if you do wish to purchase them.
Like and Share
If you like our post, we need your support to like and share our posts or videos so that it can reach more and more people like you !!
https://solarduino.com/pzem-017-dc-energy-meter-online-monitoring-with-blynk-app/
is this mandatory need to use PZEM-017
Hi,
Different communication protocol or model has different communication command. The code provided is proven working for PZEM-017. If you have different energy meter but with same communication protocol & command, this code should be also able to work with other meter as well, but slight modification is needed for the code. Hope it explains.