From 120621b26efa79e56715013e96c2737c17728ffe Mon Sep 17 00:00:00 2001
From: fragolinux <21192010+fragolinux@users.noreply.github.com>
Date: Mon, 28 Jan 2019 17:43:54 +0100
Subject: [PATCH] added project with Wemos D1 Mini and 1602 I2C lcd display
---
PZEM004T-Energy-Monitor.md | 64 ++++++++++++++++++++++++++++++++++++++
1 file changed, 64 insertions(+)
diff --git a/PZEM004T-Energy-Monitor.md b/PZEM004T-Energy-Monitor.md
index 8c37649b..1d9a153b 100644
--- a/PZEM004T-Energy-Monitor.md
+++ b/PZEM004T-Energy-Monitor.md
@@ -40,4 +40,68 @@ Configure the GPIO's for hardware serial connection as shown below.
+# Connected Power Meter using PZEM-004T, Wemos D1 Mini and a 1602 I2C display
+## Parts needed
+- Wemos D1 Mini
+- PZEM-004T
+- Resistor 1k
+- [Enclosure](https://www.itead.cc/smart-home/sonoff-ip66.html)
+- Power cable
+- Little PSU (search for "700ma 3.5w 5v" on usual stores...)
+- I2C 1602 LCD Display (I had issues with green one, i2c address 0x3F, while no problems with blue ones, address 0x27)
+- Mammuth Clamps
+
+## Preparation
+Install Tasmota on the Wemos D1 Mini and confirm it is functional before connecting the PZEM-004T to its serial interface. You need to compile your own firmware, as none of the actual pre-made binaries have support for both display and PZEM sensor module.
+
+To compile (I used Core 2.3.0), edit these files:
+- sonoff_post.h: look for line (about 230 or so) starting with "**#ifdef USE_DISPLAYS**" and comment out the "**#undef USE_ENERGY_SENSOR**" that follows near there, so it should be like:
+```
+//#undef USE_ENERGY_SENSOR
+```
+- user_config_override.h: before last **#endif**, add this line
+```
+#define USE_DISPLAYS
+```
+- my_user_config.h: uncomment line with "**//#define USE_CONFIG_OVERRIDE**" so it's like:
+```
+#define USE_CONFIG_OVERRIDE
+```
+
+## Tasmota config parameter
+
+Set module as GENERIC (18), then GPIOs as in image:
+
+
+
+- use the "**I2CScan**" command to detect your device address, then set it with: "**DeviceAddress XXX**" (where XXX is the decimal converted address found)
+- set "**TelePeriod 10**" to have the display refresh every 10 seconds (you can't go under this value...)
+- set "**DisplayModel 1**", and "**DisplayMode 0**"
+- finally, add a Rule to display values (I choose these ones):
+```
+rule1 on tele-ENERGY#Power do DisplayText [z] [x1y0]%value%W endon on tele-ENERGY#Today do DisplayText [x8y0]%value%Wh endon on tele-ENERGY#Voltage do DisplayText [x1y1]%value%V endon on tele-ENERGY#Current do DisplayText [x8y1]%value%A endon
+```
+- remember to enable the rule, with "**rule1 1**"
+
+## Images and Wiring diagram
+
+**DANGER - MAINS VOLTAGE**. Be sure to crimp connectors and use heat-shrinking tube wherever possible/needed, and tightly secure any screw.
+
+
+
+How it looks, from web gui:
+
+
+
+How it looks, from closed box (set contrast using the little trimmer/pot on back of display, and i cut a bit of corners from display to have it flush with border, and used 2 exagonal plastic standoffs with nuts and bolts to secure it to trasparent top):
+
+
+
+Mains IN, mains OUT, all sealed:
+
+
+
+Wiring Diagram, check other images in this page for more info about the 1K resistor needed to reduce voltage from 5V to 3V3 for the serial connection.
+
+