Nimbin[12]?Embedded / esp_garden / commits / 049dedd

esp_garden git · master

Distributed ESP sensor and actuator system (garden)

esp32 esp-idf iot sensors c++ sql · first commit 2025-10-15 · last commit 2026-01-20 (8 months ago) · synced 3 days ago · upstream: git.ide3.de/hsnr/mic/esp_garden

C++ 70.7% Markdown 18% C 10.7%
git clone https://git.christianimmanuel.de/embedded/esp_garden.gitwget https://git.christianimmanuel.de/embedded/esp_garden/archive/esp_garden.tar.gz

Update maybe wifi is easy?

Christian Immanuel · 2025-10-25 09:49 · 049deddadd4d943e1aede4243556f565c7704b1c

 wifi_hsnr/wifi.ino                                 | 100 +++++++++++++++++++++
 .../{ => wifi_enterprise_example}/CMakeLists.txt   |   0
 wifi_hsnr/{ => wifi_enterprise_example}/README.md  |   0
 .../generate_certs/generate_certs.py               |   0
 .../main/CMakeLists.txt                            |   0
 .../main/Kconfig.projbuild                         |   0
 .../{ => wifi_enterprise_example}/main/ca.pem      |   0
 .../{ => wifi_enterprise_example}/main/client.crt  |   0
 .../{ => wifi_enterprise_example}/main/client.pem  |   0
 .../{ => wifi_enterprise_example}/main/server.crt  |   0
 .../{ => wifi_enterprise_example}/main/server.pem  |   0
 .../main/wifi_enterprise_main.c                    |   0
 12 files changed, 100 insertions(+)

diff --git a/wifi_hsnr/wifi.ino b/wifi_hsnr/wifi.ino
new file mode 100644
index 0000000..90b39c2
--- /dev/null
+++ b/wifi_hsnr/wifi.ino
@@ -0,0 +1,100 @@
+/*|----------------------------------------------------------|*/
+/*|Connection sketch to eduroam network (WPA/WPA2) Enteprise |*/
+/*|Suitable for almost any ESP32 microcontroller with WiFi   |*/
+/*|Raspberry or Arduino WiFi CAN'T USE THIS LIBRARY!!!       |*/
+/*|Edited by: Martin Chlebovec (martinius96)                 |*/
+/*|Compilation under 2.0.3 Arduino Core and higher worked    |*/
+/*|Compilation can be done only using STABLE releases        |*/
+/*|Dev releases WILL NOT WORK. (Check your Ard. Core .json)  |*/
+/*|WiFi.begin() have more parameters for PEAP connection     |*/
+/*|----------------------------------------------------------|*/
+
+//WITHOUT certificate option connection is WORKING (if there is exception set on RADIUS server that will let connect devices without certificate)
+//It is DEPRECATED function and standardly turned off, so it must be turned on by your eduroam management at university / organisation
+
+//Connection with certificate WASN'T CONFIRMED ever, so probably that option is NOT WORKING
+
+#include <WiFi.h> //Wifi library
+#include "esp_wpa2.h" //wpa2 library for connections to Enterprise networks
+
+//Identity for user with password related to his realm (organization)
+//Available option of anonymous identity for federation of RADIUS servers or 1st Domain RADIUS servers
+#define EAP_ANONYMOUS_IDENTITY "anonymous@tuke.sk" //anonymous@example.com, or you can use also nickname@example.com
+#define EAP_IDENTITY "username@tuke.sk" //nickname@example.com, at some organizations should work nickname only without realm, but it is not recommended
+#define EAP_PASSWORD "password" //password for eduroam account
+#define EAP_USERNAME "username.tuke.sk" // the Username is the same as the Identity in most eduroam networks.
+
+//SSID NAME
+const char* ssid = "eduroam"; // eduroam SSID
+
+//Intermediate CA cert (GEANT OV RSA CA 4) in .pem format
+//Used for WiFi connection as trusted CA that issued certificate for wifi.uvt.tuke.sk - Technical university in Košice (Slovakia)
+//THIS CERTIFICATE WILL NOT WORK FOR OTHER UNIVERSITIES AND ORGANISATIONS!
+/* const static char* test_root_ca PROGMEM = \
+    "-----BEGIN CERTIFICATE-----\n" \
+    "MIIG5TCCBM2gAwIBAgIRANpDvROb0li7TdYcrMTz2+AwDQYJKoZIhvcNAQEMBQAw\n" \
+    "gYgxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpOZXcgSmVyc2V5MRQwEgYDVQQHEwtK\n" \
+    "ZXJzZXkgQ2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMS4wLAYD\n" \
+    "VQQDEyVVU0VSVHJ1c3QgUlNBIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTIw\n" \
+    "MDIxODAwMDAwMFoXDTMzMDUwMTIzNTk1OVowRDELMAkGA1UEBhMCTkwxGTAXBgNV\n" \
+    "BA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kn5wbE6FxXYJ287qfRTgmhePecPc73Yrzt\n" \
+    "apdRcsKVGkOpaTIJP/l+lAHRLZxk/dUtyN95G++bOSQqnOCpVPabUGl2E/OEyFrp\n" \
+    "Ipwgu2L/WJclvd6g+ZA/iWkLSMcpnFb+uX6QBqvD6+RNxul1FaB5iHY=\n" \
+    "-----END CERTIFICATE-----\n"; */
+
+void setup() {
+  Serial.begin(115200);
+  delay(10);
+  Serial.print(F("Connecting to network: "));
+  Serial.println(ssid);
+  WiFi.disconnect(true);  //disconnect from WiFi to set new WiFi connection
+  //WiFi.begin(ssid, WPA2_AUTH_PEAP, EAP_ANONYMOUS_IDENTITY, EAP_IDENTITY, EAP_PASSWORD, test_root_ca); //with CERTIFICATE 
+  WiFi.begin(ssid, WPA2_AUTH_PEAP, EAP_IDENTITY, EAP_USERNAME, EAP_PASSWORD); // without CERTIFICATE, RADIUS server EXCEPTION "for old devices" required
+
+  // Example: a cert-file WPA2 Enterprise with PEAP - client certificate and client key required
+  //WiFi.begin(ssid, WPA2_AUTH_PEAP, EAP_IDENTITY, EAP_USERNAME, EAP_PASSWORD, test_root_ca, client_cert, client_key);
+
+  // Example: TLS with cert-files and no password - client certificate and client key required
+  //WiFi.begin(ssid, WPA2_AUTH_TLS, EAP_IDENTITY, NULL, NULL, test_root_ca, client_cert, client_key);
+  while (WiFi.status() != WL_CONNECTED) {
+    delay(500);
+    Serial.print(F("."));
+  }
+  Serial.println("");
+  Serial.println(F("WiFi is connected!"));
+  Serial.println(F("IP address set: "));
+  Serial.println(WiFi.localIP()); //print LAN IP
+}
+
+void loop() {
+  yield();
+}
diff --git a/wifi_hsnr/CMakeLists.txt b/wifi_hsnr/wifi_enterprise_example/CMakeLists.txt
similarity index 100%
rename from wifi_hsnr/CMakeLists.txt
rename to wifi_hsnr/wifi_enterprise_example/CMakeLists.txt
diff --git a/wifi_hsnr/README.md b/wifi_hsnr/wifi_enterprise_example/README.md
similarity index 100%
rename from wifi_hsnr/README.md
rename to wifi_hsnr/wifi_enterprise_example/README.md
diff --git a/wifi_hsnr/generate_certs/generate_certs.py b/wifi_hsnr/wifi_enterprise_example/generate_certs/generate_certs.py
similarity index 100%
rename from wifi_hsnr/generate_certs/generate_certs.py
rename to wifi_hsnr/wifi_enterprise_example/generate_certs/generate_certs.py
diff --git a/wifi_hsnr/main/CMakeLists.txt b/wifi_hsnr/wifi_enterprise_example/main/CMakeLists.txt
similarity index 100%
rename from wifi_hsnr/main/CMakeLists.txt
rename to wifi_hsnr/wifi_enterprise_example/main/CMakeLists.txt
diff --git a/wifi_hsnr/main/Kconfig.projbuild b/wifi_hsnr/wifi_enterprise_example/main/Kconfig.projbuild
similarity index 100%
rename from wifi_hsnr/main/Kconfig.projbuild
rename to wifi_hsnr/wifi_enterprise_example/main/Kconfig.projbuild
diff --git a/wifi_hsnr/main/ca.pem b/wifi_hsnr/wifi_enterprise_example/main/ca.pem
similarity index 100%
rename from wifi_hsnr/main/ca.pem
rename to wifi_hsnr/wifi_enterprise_example/main/ca.pem
diff --git a/wifi_hsnr/main/client.crt b/wifi_hsnr/wifi_enterprise_example/main/client.crt
similarity index 100%
rename from wifi_hsnr/main/client.crt
rename to wifi_hsnr/wifi_enterprise_example/main/client.crt
diff --git a/wifi_hsnr/main/client.pem b/wifi_hsnr/wifi_enterprise_example/main/client.pem
similarity index 100%
rename from wifi_hsnr/main/client.pem
rename to wifi_hsnr/wifi_enterprise_example/main/client.pem
diff --git a/wifi_hsnr/main/server.crt b/wifi_hsnr/wifi_enterprise_example/main/server.crt
similarity index 100%
rename from wifi_hsnr/main/server.crt
rename to wifi_hsnr/wifi_enterprise_example/main/server.crt
diff --git a/wifi_hsnr/main/server.pem b/wifi_hsnr/wifi_enterprise_example/main/server.pem
similarity index 100%
rename from wifi_hsnr/main/server.pem
rename to wifi_hsnr/wifi_enterprise_example/main/server.pem
diff --git a/wifi_hsnr/main/wifi_enterprise_main.c b/wifi_hsnr/wifi_enterprise_example/main/wifi_enterprise_main.c
similarity index 100%
rename from wifi_hsnr/main/wifi_enterprise_main.c
rename to wifi_hsnr/wifi_enterprise_example/main/wifi_enterprise_main.c