Created
January 14, 2025 13:12
-
-
Save Robotto/b2f069f78cdb18cea97767f0e779ee40 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*|----------------------------------------------------------|*/ | |
/*|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_eap_client.h" //wpa2 library for connections to Enterprise networks | |
#define SKOLEMAIL "[email protected]" | |
#define KODEORD "DetHerErIkkeMitKodeord" | |
// MAKE SURE THAT YOU TRUST THE ACCESS POINT, BECAUSE WE ARE NOT USING CERTIFICATES TO VALIDATE THEM! | |
// SO ANYONE PRETENDING TO BE "EDUROAM" WILL SEE YOUR PASSWORD! | |
//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 "[email protected]" //[email protected], or you can use also [email protected] | |
#define EAP_IDENTITY SKOLEMAIL //[email protected], at some organizations should work nickname only without realm, but it is not recommended | |
#define EAP_PASSWORD KODEORD //password for eduroam account | |
#define EAP_USERNAME SKOLEMAIL // the Username is the same as the Identity in most eduroam networks. | |
//SSID NAME | |
const char* ssid = "eduroam"; // eduroam SSID | |
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_IDENTITY, EAP_USERNAME, EAP_PASSWORD); // without CERTIFICATE, RADIUS server EXCEPTION "for old devices" required | |
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(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment