YKR038 COURSE · MODULE 6 · LESSON 35
Build a Wi-Fi Sensor Dashboard
Publish live sensor readings on a simple browser dashboard.
Follow the numbered steps in order. Do not connect USB power until the wiring step tells you to. Compare every pin label before continuing.
LESSON GOAL
What you will build and learn
In this lesson, you will learn sensor sampling, HTML presentation, and refresh strategy. By the end, a browser displays current readings from the ESP32.
- Recognize the purpose of each required part.
- Make the connections in a safe, repeatable order.
- Upload or run the lesson procedure and verify the expected result.
- Use observable evidence to fix common problems.
A close, labeled photograph of this exact experiment will be added here. Until then, use the written pin-by-pin connection list below.
STEP-BY-STEP GUIDE
Build the experiment
Understand the target result
Publish live sensor readings on a simple browser dashboard. The expected result is: A browser displays current readings from the ESP32.
Prepare the board and parts
Disconnect the ESP32 from USB. Put the ESP32, breadboard, jumper wires, and the listed lesson parts in front of you. Straighten bent pins gently and never force a module into the breadboard.
Make each connection with power off
- DHT11 VCC → 3.3V, GND → GND, and DATA → GPIO 4.
- Connect the ESP32 to USB.
- Use the same 2.4 GHz network for the ESP32 and viewing device.
Power check: confirm that no 5V signal goes directly into an ESP32 GPIO and that 3.3V is not connected to GND.
Install any library and upload the code
Install “DHT sensor library” and its Adafruit Unified Sensor dependency. Select your ESP32 board and serial port before clicking Upload.
#include <WiFi.h>
#include <WebServer.h>
#include <DHT.h>
const char* ssid="YOUR_WIFI_NAME"; const char* password="YOUR_WIFI_PASSWORD";
DHT dht(4,DHT11); WebServer server(80);
void setup(){ Serial.begin(115200);dht.begin();WiFi.begin(ssid,password);while(WiFi.status()!=WL_CONNECTED)delay(500);
server.on("/",[](){float t=dht.readTemperature(),h=dht.readHumidity();String html="<h1>YKR038 Room Dashboard</h1><p>Temperature: "+String(t,1)+" C</p><p>Humidity: "+String(h,1)+" %</p><meta http-equiv='refresh' content='5'>";server.send(200,"text/html",html);});server.begin();Serial.println(WiFi.localIP());}
void loop(){server.handleClient();}Power the circuit and observe
Connect USB power only after the wiring check. Open Serial Monitor at 115200 baud when the sketch prints data. Watch the circuit for at least 20 seconds and compare it with this expected behavior: A browser displays current readings from the ESP32.
Change one value and test again
Make one small change—such as a delay, threshold, brightness, or displayed message—then upload again. This confirms that you understand which part of the program controls the result.
WHY IT WORKS
The key idea
This experiment demonstrates sensor sampling, HTML presentation, and refresh strategy. The ESP32 repeatedly reads or updates the connected hardware, applies the program logic, and produces the observable result. Changing one input or one code value helps you see that relationship directly.
TROUBLESHOOTING
If the experiment does not work
Nothing powers on
Disconnect USB. Check the USB cable, 3.3V/5V selection, GND rail, and breadboard row placement.
Upload fails
Confirm the board and port. Close other serial programs, reconnect USB, and hold BOOT only if your board requires it.
Result is unstable
Shorten jumper wires, confirm a shared ground, and verify that input pins are not floating.
Lesson-specific check
Separate sensor timing from web-request handling to keep the page responsive.
VIDEO WALKTHROUGH
Hands-on lesson video reserved
The final video will show the real YKR038 parts, every wire connection, the upload process, and the expected result.