From 054cb11ad3c76476d23afed6081c30f0872a0224 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ellensohn?= Date: Thu, 22 Feb 2024 11:32:54 +0100 Subject: [PATCH] update readme --- README.md | 19 ++++++++++++++++--- platformio.ini | 16 +++++++++++++--- resources/environment.png | Bin 0 -> 9252 bytes src/WebserverModule.cpp | 15 --------------- 4 files changed, 29 insertions(+), 21 deletions(-) create mode 100644 resources/environment.png diff --git a/README.md b/README.md index e6cd8d0..62ee472 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,16 @@ This repository contains the source code for our university group project focuse - Grafana dashboard for visualizing power conditions. - Embedded webserver on ESP32 for real-time voltage and power readings and relay control. +### Important notice: +This code is supposed to work with all kinds of ESP32 devices (ESP32, ESP32-S1, ESP32-S2, etc.), but minor adjustments might be needed. Anyway you will need to adapt the pin numbering to your board. +We successfully tested the following devices: +- AZ Delivery ESP-32 Dev Kit C V4 +- ESP32-S2-Saola-1 + +The relay module is also interchangeable with other relay modules you can buy on Amazon. The code is written in a way that it should be easy to adapt to other modules. Here it is important to add that this code is written for active-low relay modules. + ### Quick start +0. ! Before connecting the ESP via USB, make sure to unplug the additional 5V power converter we use in this project. This is necessary to prevent overpowering the Computer's USB port. 1. Spin up InfluxDb and Grafana via Docker Compose: ```shell @@ -32,8 +41,8 @@ This repository contains the source code for our university group project focuse - `doc`: Here you will find the schematics and the project documentation. ### Hardware needed: -- ESP32 Devkit C (or derivative) -- Relay Module board with 2x Relays +- ESP32-S2-Saola-1 (or derivative) +- Relay Module board with 4x Relays (or whatever you like) - INA219 Power Monitoring Module - Computer/Server for hosting the Database and Grafana. The code was written using the PlatformIO plugin for Visual Studio Code. You are advised to use the same setup. @@ -65,7 +74,7 @@ On the welcome page you will see the Ardino setup tutorial. Click on the 'Arduin #### Hardware Setup Connect the INA219 module according to the schematics. Connect the relay module to the ESP32. The relay module should be connected to the pins GPIO2 and GPIO15 of the ESP32. The relay module should be powered by an external power supply. The relay module should be connected to the power circuit you want to monitor and control. The INA219 module should be connected to the power circuit you want to monitor. The INA219 module should be powered by the ESP32. -![Pinout Diagram ESP32 Devkit C v4](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/_images/esp32-devkitC-v4-pinout.png) +![Pinout Diagram ESP32-S2-Saola-1](https://docs.espressif.com/projects/esp-idf/en/stable/esp32s2/_images/esp32-s2_saola1-pinout.jpg) ![Schematics - Wiring](resources/wiring.png) @@ -82,6 +91,10 @@ INFLUXDB_URL = "http://192.168.1.100:8086" ``` WIFI_SSID and WIFI_PASS are your WiFi credentials. + +Make sure the correct environment is selected for the project. The default is the ESP32-S2-Saola-1. You can change the environment in the bottom bar of Visual Studio Code. + +![Environment selectorS](resources/environment.png) Now you can click on the upload button to flash the ESP. diff --git a/platformio.ini b/platformio.ini index 3d3923f..cc77533 100644 --- a/platformio.ini +++ b/platformio.ini @@ -18,7 +18,6 @@ lib_deps = ESP Async WebServer ArduinoJson tobiasschuerg/ESP8266 Influxdb@^3.13.1 -upload_port = COM3 monitor_speed = 115200 [env:esp32-s2-saola-1] @@ -31,6 +30,17 @@ lib_deps = ESP Async WebServer ArduinoJson tobiasschuerg/ESP8266 Influxdb@^3.13.1 -; any port that starts with /dev/ttyUSB -#upload_port = /dev/ttyUSB* +monitor_speed = 115200 + +[env:esp32-c3-devkitm-1] +# This has some issues +platform = espressif32 +board = esp32-c3-devkitm-1 +framework = arduino +lib_deps = + Wire + Adafruit INA219 + esphome/ESPAsyncWebServer-esphome@^3.1.0 + ArduinoJson + tobiasschuerg/ESP8266 Influxdb@^3.13.1 monitor_speed = 115200 \ No newline at end of file diff --git a/resources/environment.png b/resources/environment.png new file mode 100644 index 0000000000000000000000000000000000000000..7e8723e8a7c9f539232146f1caaab415585b201a GIT binary patch literal 9252 zcmZ8nWmr^Q*B%uSk&^C^P61JA6zT5nR-`)w9%(6cM7l*lLb@bGT0|OYq&tR?hHuUL z^W(Y@gu|KHd#`oZI+1EBvbflk*a!pyS6)s^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=Qq(wkLCF%^PyU zHSpe$6E48u3o?LA6V*QSBLTjL>(=}|hyyaN)|e)+Sm-nbBL5(RVit%+#b2Fb`7{G1 zgKbHK88G^>1|FVR{R*2h82SoO;?BN0qJe=%GwBQlSCe)(L2e}K;9wDmJ}*B%0$gjB z8XGzXfXael@hB5EE*6$q`x_FQohMiK%Ul*@NV)Xrr>x!|Z$U=tvh*|F#!x3BbsL7S4Nkhub~=l|MVygJ7`k7wF$SVgxYuTqy|C65k&_A@9(en4o`d$1<3h2MpXMwi`H@L>^r@6ypew{UGF}RisKJ&0hZ> Dhi+EU literal 0 HcmV?d00001 diff --git a/src/WebserverModule.cpp b/src/WebserverModule.cpp index 44a4268..ab11b56 100644 --- a/src/WebserverModule.cpp +++ b/src/WebserverModule.cpp @@ -108,15 +108,6 @@ void WebServerModule::handleRoot(AsyncWebServerRequest *request) { html += "

Leistung: W

"; html += "

Durchschnittliche Leistung: W

"; html += "

Gesamtenergie: Wh

"; - // // JavaScript-Code für die Werteaktualisierung und Schaltersteuerung (unchanged) - // html += ""; // JavaScript-Code für die Werteaktualisierung und Schaltersteuerung html += "