Smart Energy Meter Using ESP32 & PZEM004T V3.0 - Configuring Tasmota on ESP32

by AmruthKumarSala in Circuits > Microcontrollers

53 Views, 0 Favorites, 0 Comments

Smart Energy Meter Using ESP32 & PZEM004T V3.0 - Configuring Tasmota on ESP32

Smart Energy Meter-02.png
danger-electrical-hazard-logo-9929FE5284-seeklogo.com.png

This article will help the reader complete the configuration and implementation of the PZEM004T V3.0 Sensor connected to ESP32 with Tasmota flashed. This is the second article, and it is suggested that the reader complete the activities mentioned in the first before starting the activities mentioned in this one.

CAUTION: Please switch off the power supply and remove the electrical connections to check the jumper wires between the ESP32 Microcontroller and PZEM004T V3 sensor. There is a chance of electrocution if not handled properly and if either microcontroller (or) the sensor is touched accidentally without disconnecting the circuit from the mains.

Supplies

ESP32 Microcontroller.jpg
USB-MicroUSB ESP32Connecting Cable.jpg
Input100-240V-50-60zOutput 5V.jpg
PZEM004V3-01.jpg
resistor-32290_1280.png
pngtree-trendy-soldering-iron-png-image_12006929.png
JumperWires-FemalePortsBothSides.jpg
computer-cable-power-500x500.jpg
gm_3202_white-white-600X600.png
ThreePinSocketExtensionBox.png

The following list of materials are required to complete this activity

  1. ESP32 microcontroller with Tasmota installed on it. I have installed Tasmota Version 14.4.1 from the tasmota web installer. Please refer to Article 01 for more details.
  2. Micro USB cable to connect ESP32 microcontroller.
  3. 5V Output power supply.
  4. PZEM004t-V3 Sensor with 100 Amps Current Transformer (CT).
  5. A 1 Kilo Ohm Resistor. The other articles I read used a 1.5 Kilo Ohm Resistor.
  6. Soldering Iron rod with soldering flux and lead.
  7. Jumper Wires to connect ESP32 and PZEM004T-V3
  8. A 3-pin power cable (As shown in the image. It is normally used to connect a home PC. The end connecting to the SMPS needs to be cut and wire has to be split to expose the three wires). I selected this wire as it can withstand the slightly heavy loads we use for testing out projects. Please identify the phase/line (Red), neutral (Black) and earth (Green) wires and properly connect them. Readers can choose the best one. It is not mandatory to use the cable shown in the image.
  9. A 4-Pin Socket Spike Suppressor. This will help us connect the Microcontroller, and to power PZEM004T-V3 Sensor.
  10. A 3-pin socket is optional, but it will help us connect a load and check the values on the dashboard.

Hardware Modifications to PZEM004T-v3

ModifiedPZEM004TV3-01.jpg
ModifiedPZEM004TV3-02.jpg
ModifiedPZEM004TV3-03.jpg
ModifiedPZEM004TV3-04.jpg
ModifiedPZEM004TV3-05.jpg

PZEM004T-V3 has four pins (GND, TX, RX, 5V) and two optocouplers (CT817C937K - One for TX and the other for RX). You may solder a 1 Kilo Ohm Resistor as shown in the pictures.

You may also remove the 102 Chip SMD Resistor as shown in the images.

Note: If you do not have the capabilities, please get help from the electronics engineers nearby as the space to solder and desolder is very less.

Let Us Connect All Components!!!

ESP32-PZEM004TV3-JumperWireConnections.png
ESP32-PZEM004TV3-JumperWireConnections-PowerrinESP32-002.png
ESP32-PZEM004TV3-JumperWireConnections-PowerrinESP32-PoweringPZEM004TV3-003.png
  1. Following will be the connections between ESP32 and PZEM004TV3
  2. VCC pin of PZEM004TV3 to 3V3 pin of ESP32 (Indicated in Red)
  3. GND pin of PZEM004TV3 to GND pin of ESP32 (Indicated in Black)
  4. TX pin of PZEM004TV3 to RX pin of ESP32 (Indicated in Green)
  5. RX pin of PZEM004TV3 to TX pin of ESP32 (Indicated in Orange)
  6. Connect ESP32 to the suggested power adaptor. I used power adaptor with specifications: "Input: 100-240V; 50-60 Hz 1.8 Amps; Output: 5V 2 Amps"
  7. Connect PZEM004TV3 to the three-pin plug, socket, and the current transformer (CT) as shown in the picture.

After you are done with all the above steps, connect the three-pin plug to the mains and move to the next section.

Configuration Changes in Tasmota

002.png
003.png
004.png
005.png
006.png
007.png
008.png
009.png
010.png
011.png
012.png
013.png
014.png
015.png

The following steps will help readers successfully configure and observe the energy parameters.

  1. Access the Web page with the IP address assigned to your ESP32 (192.168.29.195 in my case)
  2. Hit on "Configuration", then on "Module".
  3. On the next screen, select "PZEM0XX TX" from the dropdown list of "TX GPIO1", and select "PZEM016 RX" from the dropdown list of "RX GPIO3". Navigate to the bottom of the web page and hit on "Save".
  4. Tasmota will restart the ESP32 to apply the changes to the configuration.
  5. Please allow some time for "Tasmota" to settle and fetch all the energy parameters you need.

Support a Good Cause!

PhonePeQR.png
GooglePay_QR.png

If the readers feel my articles are important and good, please express your support in all the forms you can. Sharing this article with your colleagues will also be a great help. There is no obligation.

I have observed some junk values appear in the dashboard. I will try to address them and post another article when I have a fix. In my next article, I wish to discuss Message Queue Telemetry Transport (MQTT) and the transfer of data for further analysis.

Please keep yourselves tuned to my next articles.

Readers can WhatsApp me at +91 9398472594 for any questions.

Video Explanation on YouTube

pngimg.com - youtube_PNG102356.png

Please go through this YouTube Playlist to find connections and a live demonstration.


https://www.youtube.com/watch?v=3L-hY_tTx24&list=PL0eiemFx0ClTO9qRJ8L540a3W-12NzTdY