added documentation for my first trial runs

This commit is contained in:
simonox 2023-02-19 16:40:44 +01:00
parent 4777a2d2eb
commit 37dce7e991
10 changed files with 95 additions and 4 deletions

View File

@ -31,13 +31,21 @@ NodeRed is running here: http://localhost:1880/
## Hardware
### USB-C
We are using HelTec Automation Wirelsess Sticks ESP32 Dev-Boards.
### PinOut
The PinOut of our version 3 modules can be found here: https://docs.heltec.org/en/node/esp32/dev-board/hardware_update_log.html#wifi-lora-32-hardware-update-logs
![PinOut](https://resource.heltec.cn/download/Wireless_Stick_V3/HTIT-WS_V3.png "PinOut")
### USB-C
Our HelTec Automation Wirelsess Sticks ESP32 Dev-Boards already have USB-C. But they do not support Power Deliver (PD). If your computer tries to do PD, just plug a cheap USB hub between the board and your computer.
### Arduino IDE
We are using HelTec Automation Wirelsess Sticks ESP32 Dev-Boards. Their GitHub repo can be found here: https://github.com/HelTecAutomation/Heltec_ESP32
HelTecs GitHub repo can be found here: https://github.com/HelTecAutomation/Heltec_ESP32
I had to install VCP Drivers, first: https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers?tab=downloads

View File

@ -0,0 +1,83 @@
# Energy Monitor
Our energy monitor is based on the openenergymonitor.org project (Licence GNU GPL V3). It uses our HelTec Wireless Stick. Power Measurement is done by a SCT013 clamp (100A:50mA).
## Used materials
* ESP32 module (e.g. Heltec Wireless Stick)
* 3 x SCT-013-100 (100 A), see: http://openenergymonitor.org/emon/node/156
* 6 x 10 kOhm Resistors 1/4 W
* 1 x 22 Ohm Resistor 1/4 W (TODO: I am using a 47 Ohm Resistor to be replaced)
* 3 x 10 uF Elko 10 V
* 3 x 3,5 mm audio jack connector
### PinOut
![PinOut](https://resource.heltec.cn/download/Wireless_Stick_V3/HTIT-WS_V3.png "PinOut")
We use A1, A2 and A3 because the are free (most ADCs are already used on the HelTec Board)
### Sensors
The SCT-013 sensors are small current transformers (SCT). They have a ferromagnetic core that can be opened and in which we can enclose our conductor. This conductor is the primary winding and the secondary winding is fixed in the sensor and can have 2000 turns. This gives us a ratio of 1:2000 as an example.
When AC current flows through the conductor, a magnetic flux is generated in the ferromagnetic core, which in turn generates an electric current in the secondary winding.
I could not meassure "small" power consumptions (like a LED lamp or a light stripe, as the magnetix flux in the ferromagnet core seems to be too small).
![clamp on wire](./docs/images/clamp1.jpeg "clamp on a wire")
I was able to measure high loads (like a heater the can be switched between 1 kW and 2 kW).
![heater](./docs/images/example-heater.png "serial out of a heater")
Make sure the clamp is *always positioned towards the consumer*, otherwise it does *not* work. There is a small arrow on the case.
![point the clamp](./docs/images/clamp2.jpeg "point the clamp")
### Breadboard
Let's start with a simple breadboard layout.
![Breadboard](./docs/images/breadboard.png "breakboard layout")
![Photo of breadboard](./docs/images/photo-breadboard.jpeg "photo of breadboard")
To understand this, have a look at this plan:
![Plan](./docs/images/plan.png "plan")
R1 & R2 are a voltage divider that provides the 1.65 V source. We use 10 kΩ for mains powered monitors. If we want to run on batteries, we have to choose differnt ones (like 470 kΩ resistors to keep the power consumption to a minimum).
Capacitor C1 has a low reactance - a few hundred ohms - and provides a path for the alternating current to bypass the resistor. A value of 10 μF is suitable.
R3 is the burden resistor. Ideal burden would be 19 Ω. As this is not a common value, you could choose 18 Ω or 22 Ω (I am still using a 47 Ω restistor, that has to be replaced).
See the Fritzing file for [details](./energy-monitor/energy-monitor.fzz).
### Code
#### Print to serial out
Start with a simple code that just prints the values. The code is quite simple, as we can use the existing *[EmonLib libary V1.1.0 by OpenEnergyMonitor](https://docs.openenergymonitor.org/electricity-monitoring/ct-sensors/)*.
The only interesting part is this line:
```C
emon1.current(current1Pin, 8); // Pin and Calibration
```
The calibration value "8" was done with a Fluke multimeter (and maybe a not so ideal burden resistor).
The code just prints the current power consumption to serial out:
```
16:28:18.915 -> 2853.16 Watt - 12.41 Ampere
16:28:19.998 -> 2854.63 Watt - 12.41 Ampere
16:28:21.119 -> 2850.93 Watt - 12.40 Ampere
16:28:22.207 -> 1702.19 Watt - 7.40 Ampere
16:28:23.289 -> 400.62 Watt - 1.74 Ampere
16:28:24.367 -> 94.42 Watt - 0.41 Ampere
```
#### Post to MQTT
// TODO: Continue here

Binary file not shown.

After

Width:  |  Height:  |  Size: 686 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 KiB

View File

@ -7,13 +7,13 @@ Based on EmonLibrary examples openenergymonitor.org, Licence GNU GPL V3
#include "EmonLib.h"
EnergyMonitor emon1;
const byte current1Pin = A0; // ADC-PIN
const byte current1Pin = A1; // ADC-PIN
const byte voltage = 230; // Power voltage in Europe = 230 V
void setup() {
Serial.begin(115200);
analogReadResolution(ADC_BITS); // activate 12 Bit resolution for our ESP32
emon1.current(current1Pin, 4); // Pin and Calibration
emon1.current(current1Pin, 8); // Pin and Calibration
}
void loop() {