From 31c95b9ed15e8706829cc5de50342aa2fb851484 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?King=20K=C3=A9vin?= Date: Sun, 22 Jan 2017 15:56:40 +0100 Subject: [PATCH] document PZEM-004T connection --- README.md | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 82e84cd..1773ebe 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,7 @@ DDM100TC This 3-phase 4-wire electricity meter provides an S0 interface. On my model this would output 1600 impulse/kWh, thus each impulse corresponds to a power consumption of 0.625 Wh). +This rate is hard coded in `main.c`. To record these impulses a timer input capture is used. The number of impulses determines the energy used. It is stored in a backup register, keeping the value in memory even when the board is powered down as long as a (coin cell) battery is connected to VBAT. @@ -61,7 +62,27 @@ The time has a resolution of 0.91 ms (leading to a power calculation error of <1 Connections DDM100TC <-> board: - S0+, pin 8; +3.3V or +5V -- S0-, pin 7; TIM4_CH1, PB6 (use pull-down resistor) +- S0-, pin 7; PB6, TIM4_CH1 (add pull-down resistor) + +PZEM-004T +--------- + +This 1-phase 2-wire electricity meter provides a UART interface. +For the 3-phase 4-wire power distribution installation I used 3 meters, one per phase. + +Because each command includes a device address, they can be connected to the same UART port (one individual addresses have been set). +All meters are periodically (see RTC) sequentially queried for their measurements (voltage, current, power, energy). +The used addresses are hard coded in `main.c` +A timer is used to guarantee a minimum (undocumented in the specification) time between requests in order to improve the response success. + +Connections 3xPZEM-004T <-> board: + +- 5V, 1; +5V (+3.3V is not sufficient) +- RX, 2; PA2, USART2_TX +- TX, 3, PA3, USART2_RX +- GND, 4; ground + +Note: when connecting multiple meters one the same UART bus only keep one of the pull-up resistors (across all meters) on the TX pin (on the opto-coupler output), else the low level is not low enough for the micro-controller to correctly decode the signal. ESP8266 -------