cleanup of documentation and image data

This commit is contained in:
Sebastian Wendel 2023-09-16 17:50:56 +02:00
parent b77dfdfcef
commit f5a448eedd
5 changed files with 34 additions and 110 deletions

View file

@ -1,55 +0,0 @@
# Hardware
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](../images/HTIT-WS_V3.png "PinOut")
## License
For some parts of the Heltec board you need a ["license"](https://docs.heltec.org/general/view_limited_technical_data.html#esp32-lora-series).
## 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
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
You can add their Board Manager to the boards managers URLs: https://github.com/HelTecAutomation/Heltec_ESP32/blob/master/library.json and find their libraries in the IDE (Sketch -> Include Library -> Manage Libraries... Search for "heltec esp32").
> These boards are already _V3_ boards, so be careful selecting the right board and port (VCP).
![Arduino IDE](../images/flash-with-arduino.png "select the right board and port")
## Install esptool
Esptool is a Pyhton program to flash ESP32. As it's a Pyhton tool you can install it using `pip`:
```sh
pip install esptool
```
## Find the port
Usually you can find the used port using `esptool.py`:
```sh
esptool.py write_flash_status --non-volatile 0
```
### Using MicroPython
Download the firmware: https://micropython.org/download/
Flash it using `esptool`: https://micropython.org/download/GENERIC_S3/
```sh
esptool.py --chip esp32s3 write_flash -z 0 ~/Desktop/GENERIC_S3-20220117-v1.18.bin
```

View file

@ -1,6 +1,6 @@
# Energy Monitor
Our energy monitor is based on the openenergymonitor.org project (Licence GNU GPL V3).
Our energy monitor is based on the [openenergymonitor.org](https://openenergymonitor.org/) project (Licence GNU GPL V3).
It uses our HelTec Wireless Stick. This - of course - can be replaced by a cheaper ESP32 module.
@ -14,6 +14,10 @@ Power Measurement is done by a SCT013 clamp (100A:50mA).
### PinOut
We are using HelTec Automation Wirelsess Sticks ESP32 Dev-Boards.
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](../images/HTIT-WS_V3.png "PinOut")
We use A1, A2 and A3 because they are free (most ADCs are already used on the HelTec Board)
@ -59,8 +63,24 @@ R3 is the burden resistor. Ideal burden would be 19 Ω. As this is not a common
See the Fritzing file for [details](./energy-monitor.fzz).
## 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.
## Code
### Arduino IDE
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
You can add their Board Manager to the boards managers URLs: https://github.com/HelTecAutomation/Heltec_ESP32/blob/master/library.json and find their libraries in the IDE (Sketch -> Include Library -> Manage Libraries... Search for "heltec esp32").
> These boards are already _V3_ boards, so be careful selecting the right board and port (VCP).
![Arduino IDE](../images/flash-with-arduino.png "select the right board and port")
### 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/)_.
@ -109,6 +129,10 @@ The `mqtt_server` in tis example posts to my local IP adress. The Wifi network i
The `mqtt_prefix` should be different per device, as this is the topic prefix used to identify the device.
We now can consume this messages in Node-RED, store them in InfluxDB and build a dashboard in Grafana.
If you haven't deployed the [IoT prototyping backend yet, check out our guide](https://code.curious.bio/curious.bio/iot-backend/).
### Testing
You can subscribe to your local MQTT server and subscribe to all or just the interesting topics:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 232 KiB

View file

@ -70,52 +70,7 @@ It will post MQTT messages unter a topic `tele/tasmota_891E97/SENSOR` like this
We now can consume this messages in Node-RED, store them in InfluxDB and build a dashboard in Grafana.
### InfluxDB Bucket
I created a bucket called `shelly`in InfluxDB, so we can store the messages in this bucket.
### Node-RED
I create a usual flow in Node-RED. A MQTT node fetches the values.
![Node-RED](../images/node-red.png)
The message is fed into a filter function to only store usefull information:
```ini
return {
payload: {
power: Number(msg.payload.ENERGY.Power),
voltage: Number(msg.payload.ENERGY.Voltage),
current: Number(msg.payload.ENERGY.Current)
}
};
```
The `payload` will be stored in InfluxDB in the bucket "shelly".
### InfluxDB Data Explorer
In Influx DB Data Explorer you can query the stored data.
![Data Explorer](../images/data-explorer.png)
The query created by Data Explorer looks like that:
```flux
from(bucket: "shelly")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "msg")
|> filter(fn: (r) => r["_field"] == "power" or r["_field"] == "voltage" or r["_field"] == "current")
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
|> yield(name: "mean")
```
### Grafana
Using this query you can crate a dashboard in Grafana.
![Grafana](../images/grafana.png)
If you haven't deployed the [IoT prototyping backend yet, check out our guide](https://code.curious.bio/curious.bio/iot-backend/).
## Links

View file

@ -1,10 +1,10 @@
# Bill of Materials (BOM)
| Part | Quantity | Note | Link |
| --------------------------- | -------: | ------------- | ------------------------------------------ |
| ESP Microcontroller | 1 | | |
| SCT-013-100 | 3 | one per phase | http://openenergymonitor.org/emon/node/156 |
| 10 kOhm Resistors 1/4 W | 6 | two per phase | |
| 22 Ohm Resistor 1/4 W | 3 | | |
| 10 uF Elko 10 V | 3 | | |
| 3,5 mm audio jack connector | 3 | | |
| Part | Quantity | Note | Link |
| --------------------------- | -------: | ---------------- | ------------------------------------------ |
| ESP Microcontroller | 1 | ESP8266 or ESP32 | |
| SCT-013-100 | 1 | one per phase | http://openenergymonitor.org/emon/node/156 |
| 10 kOhm Resistors 1/4 W | 2 | two per phase | |
| 22 Ohm Resistor 1/4 W | 1 | one per phase | |
| 10 uF Elko 10 V | 1 | one per phase | |
| 3,5 mm audio jack connector | 1 | one per phase | |