Back to Projects
AdvancedESP32 DevKit V1
40 minutes build
Wi-Fi controlled LED
Serve a web page from the ESP32 and switch an LED from your phone. Needs a real board.
Required Components Checklist
Assembly Steps
1
Install the ESP32 core
In the Arduino IDE, add the Espressif boards URL and install 'esp32'. Select 'ESP32 Dev Module'.
2
Enter your network
Put your SSID and password in the sketch (don't share it publicly).
3
Upload and connect
Open the Serial Monitor at 115200 baud to read the IP address, then open it on a phone on the same network.
Arduino Sketch
#include <WiFi.h>
#include <WebServer.h>
const char* SSID = "your-network";
const char* PASS = "your-password";
WebServer server(80);
const int LED = 2;
void page() {
String state = digitalRead(LED) ? "ON" : "OFF";
server.send(200, "text/html",
"<h1>Robotry Labs LED: " + state + "</h1><a href='/on'>ON</a> | <a href='/off'>OFF</a>");
}
void setup() {
Serial.begin(115200);
pinMode(LED, OUTPUT);
WiFi.begin(SSID, PASS);
while (WiFi.status() != WL_CONNECTED) { delay(250); Serial.print("."); }
Serial.println(WiFi.localIP());
server.on("/", page);
server.on("/on", [] { digitalWrite(LED, HIGH); page(); });
server.on("/off", [] { digitalWrite(LED, LOW); page(); });
server.begin();
}
void loop() {
server.handleClient();
}
Challenges & Extensions
Ready to take this project further? Try these challenges:
- •Add a brightness slider using LEDC PWM.
- •Show the chip temperature or a sensor reading on the page.
- •Add a simple password check.