Skip to content
Quick start Product guide

Quick Start: Live ESP32 Dashboard with Local Wi-Fi & DHT11 Sensor

This step-by-step tutorial walks you through building your first live ESP32 dashboard using same-network Wi-Fi (WebSocket) and a DHT11 temperature & humidity sensor. We will start inside the WizDash app, lay out two display widgets, export the ready-to-flash .ino sketch, wire the DHT11 to your ESP32, flash the board in Arduino IDE, and return to the app to watch live temperature and humidity readings arrive.

Before you begin, prepare the following hardware and software:

  • 1 × ESP32 development board: This guide uses the standard ESP32-DevKitC (38-Pin, ESP32-WROOM-32) as the pinout reference; ESP32-S3 or ESP32-C3 boards also work (simply select the matching board model when flashing).
  • 1 × DHT11 temperature & humidity sensor: A 3-Pin PCB breakout module (with a built-in 10kΩ pull-up resistor) and 3 female-to-female jumper wires are recommended. If you are using a 4-pin bare DHT11 component, you will also need a 4.7kΩ–10kΩ resistor.
  • 1 × USB data cable: To connect your ESP32 to your computer (make sure it is a data-capable cable, not a power-only charging cable).
  • A 2.4 GHz Wi-Fi local network: The ESP32 supports 2.4 GHz Wi-Fi only (not 5 GHz-only networks), and your phone and ESP32 must be on the same local network (avoid guest networks with AP / client isolation enabled).
  • Arduino IDE 2.x installed on your computer: With the esp32 by Espressif Systems board package installed via Boards Manager.

Step 1: Create Your First Project and Open the Project Menu

Section titled “Step 1: Create Your First Project and Open the Project Menu”
  1. On the Projects screen, tap ”+ New Project” and enter DHT11 Climate Monitor. WizDash opens Connection Settings automatically; continue with Step 2.
  2. The free version includes 1 project and up to 10 functional widgets per project (Icon and Spacer layout elements do not count toward the limit).
  3. After completing Step 2, you can return to Projects and tap “Options” (the tune icon) on the project card. The two images below show the project after Wi-Fi setup, before device binding.
WizDash Projects screen showing Free 1/1 projects quota, the DHT11 Climate Monitor project card, and the Options button
Step 1a: After Step 2, the project card shows “WiFi · Not Bound”.
Project management bottom sheet menu showing Enter Dashboard, Connection Settings, Bind Device, and Generate Arduino Code
Step 1b: Tap “Options” on the project card to access Connection Settings, the dashboard, or the Arduino sketch generator.

Step 2: Configure Local Wi-Fi Connection Settings

Section titled “Step 2: Configure Local Wi-Fi Connection Settings”
  1. Connection Settings opens automatically after project creation. If you have returned to Projects, reopen it through “Options” → “Connection Settings”.
  2. Select the second card: “WiFi (Local Network)” (Phone and ESP32 on same network).
  3. Enter your 2.4 GHz Wi-Fi SSID and Wi-Fi Password (this tutorial uses Home_WiFi_2.4G and my-wifi-password as examples), plus an optional display name.
  4. Tap “Save Settings” at the bottom.

Why enter Wi-Fi credentials in the app first? WizDash stores these settings locally on your phone for this project. When you open Generate Arduino Code in Step 5, WizDash automatically injects your SSID and password into the WIFI_SSID and WIFI_PASSWORD constants of the .ino sketch so you don’t have to type them by hand.

WizDash Connection Settings sheet with WiFi (Local Network) selected and Home_WiFi_2.4G credentials filled in
Step 2: Select “WiFi (Local Network)”, fill in your 2.4 GHz Wi-Fi SSID and password, and tap “Save Settings”.

Step 3: Enter the Dashboard and Add the Thermometer & Humidity Widgets

Section titled “Step 3: Enter the Dashboard and Add the Thermometer & Humidity Widgets”
  1. After creating a project and saving its connection settings, WizDash opens the dashboard automatically. From Projects, you can also choose “Options” → “Enter Dashboard”. An unbound project displays “No Device Bound”.
  2. Tap the second card, “Not flashed yet, design dashboard first”, to jump straight into Edit Layout mode (indicated by the dark navy top toolbar).
  3. Tap ”+”, switch to “Display”, and select “Thermometer”. The sheet closes after selection. Tap ”+” again, switch to “Display”, and select “Humidity Ball”.
  4. Tap the Grid icon in the top toolbar to enable grid snapping (highlighted in orange), then drag and resize the two widgets on the canvas.
No Device Bound screen for a WiFi project offering 'I've flashed firmware, connect device' and 'Not flashed yet, design dashboard first'
Step 3a: On an unbound Wi-Fi project, tap “Not flashed yet, design dashboard first” to lay out your widgets before flashing.
Add Element sheet open to the Display tab showing Thermometer and Humidity Ball
Step 3b: In “Add Element → Display”, add a “Thermometer” and a “Humidity Ball”.
Edit Layout mode with grid snapping enabled, showing Temperature (Thermometer) and Humidity (Humidity Ball) arranged side by side
Step 3c: Enable grid snapping in the top toolbar and arrange the “Temperature” and “Humidity” widgets on the canvas.

Step 4: Verify Widget Titles, Units, and JSON Keys

Section titled “Step 4: Verify Widget Titles, Units, and JSON Keys”

While in Edit Layout mode, tap the blue gear icon on the top-right corner of a widget (or double-tap the widget) to inspect its settings:

  1. Thermometer 1 Settings:
    • Label Name: Temperature
    • Key (JSON Key): Keep the default temp (case-sensitive)
    • Unit: °C
    • Color: Orange, then tap Confirm.
  2. Humidity Ball 1 Settings:
    • Label Name: Humidity
    • Key (JSON Key): Change the default humi to hum (case-sensitive), then tap Confirm.
  3. Tap the green checkmark ”✓” in the top-right corner of the toolbar to save your layout, then tap the back arrow to return to the Projects screen.
Dashboard WidgetLabelJSON Key (Case-Sensitive)Range / UnitDHT11 Firmware Function
Thermometer (thermo)Temperaturetemp°Cdht.readTemperature()
Humidity Ball (hball)Humidityhum0–100 %dht.readHumidity()
Thermometer 1 Settings dialog showing Label Name set to Temperature, Key set to temp, Unit set to °C, and Color set to Orange
Step 4: Open the thermometer settings dialog to verify its JSON key is set to temp and unit to °C; the Humidity Ball uses hum.

Step 5: Bind DHT11 (GPIO 4) and Export the ESP32 Arduino Sketch

Section titled “Step 5: Bind DHT11 (GPIO 4) and Export the ESP32 Arduino Sketch”
  1. Back on the Projects screen, tap “Options” → “Generate Arduino Code” on your project card.
  2. Because your dashboard includes a thermometer and a humidity ball, the dialog automatically displays the “DHT11 Temp & Humidity Sensor” hardware binding card:
    • GPIO Pin: Leave at the default 4 (which connects the DHT11 data line to ESP32 GPIO 4).
    • Bind Dashboard Widgets: Tap both filter chips so ✓ Thermometer "Temperature" uses DHT11 and ✓ Humidity "Humidity" uses DHT11 are selected.
  3. Selecting both chips updates the preview with #include <DHT.h> and readSensors(). Tap “Expand View”, then “Export File” or “Copy Code”. Wi-Fi exports are named WizDash_WiFi_<time-code>.ino; the viewer title always shows WizDash_ESP32.ino. Rename the exported file to WizDash_ESP32.ino to follow the filename examples below.
Generate Arduino Code dialog showing the DHT11 Temp & Humidity Sensor card on GPIO Pin 4 with both Thermometer and Humidity chips selected
Step 5a: Keep GPIO Pin at 4 and select both DHT11 binding chips, then tap “Export File” or “Copy Code”.
Expanded WizDash_ESP32.ino code viewer showing WIFI_PASSWORD, #define DHT_PIN 4, and readSensors() writing dhtTemperature to doc["temp"] and dhtHumidity to doc["hum"]
Step 5b: Tap “Expand View” to verify that WizDash injected your Wi-Fi credentials, #define DHT_PIN 4, and the readSensors() logic.
Expand the Wi-Fi + DHT11 reference sketch (comments and formatting have been edited; use the app export for the exact generated output)
/* ============================================================
* WizDash ESP32 (WiFi LAN) — Generated by the app
*
* >>> 3 steps before upload <<<
* 1) Arduino IDE -> Tools -> Board -> pick the ESP32 model that matches your board
* e.g. WROOM -> ESP32 Dev Module; S3 -> ESP32S3 Dev Module; C3 -> ESP32C3 Dev Module
* 2) Tools -> Manage Libraries, install:
* - WebSockets (by Markus Sattler)
* - ArduinoJson (by Benoit Blanchon, v7+)
* - DHT sensor library (by Adafruit)
* - Adafruit Unified Sensor
* 3) Plug in USB -> click Upload (right arrow)
* ============================================================ */
#include <WiFi.h>
#include <WebSocketsServer.h>
#include <ArduinoJson.h>
#include <DHT.h>
#include <ESPmDNS.h>
#include <WiFiUdp.h>
// ════════════════════════════════════════════════════════════
// 0 Wi-Fi settings (filled in by the app)
// ════════════════════════════════════════════════════════════
const char* WIFI_SSID = "Home_WiFi_2.4G";
const char* WIFI_PASSWORD = "my-wifi-password";
const int WS_PORT = 81;
const int UDP_PORT = 4210;
WebSocketsServer webSocket = WebSocketsServer(WS_PORT);
WiFiUDP udp;
char deviceId[20];
unsigned long lastSendTime = 0;
#define DHT_PIN 4
DHT dht(DHT_PIN, DHT11);
// ════════════════════════════════════════════════════════════
// 1 Send data (ESP32 -> App)
// ════════════════════════════════════════════════════════════
void readSensors(JsonDocument& doc) {
const float dhtTemperature = dht.readTemperature();
static bool dhtTemperatureErrorReported = false;
if (isnan(dhtTemperature) && !dhtTemperatureErrorReported) {
Serial.println("[DHT11] Failed to read temperature");
dhtTemperatureErrorReported = true;
}
const float dhtHumidity = dht.readHumidity();
static bool dhtHumidityErrorReported = false;
if (isnan(dhtHumidity) && !dhtHumidityErrorReported) {
Serial.println("[DHT11] Failed to read humidity");
dhtHumidityErrorReported = true;
}
// Thermometer "Temperature" (Thermo)
if (!isnan(dhtTemperature)) doc["temp"] = dhtTemperature;
// Humidity ball "Humidity" (H-Ball)
if (!isnan(dhtHumidity)) doc["hum"] = dhtHumidity;
}
// ════════════════════════════════════════════════════════════
// 2 Receive commands (App -> ESP32)
// ════════════════════════════════════════════════════════════
void onCommand(JsonDocument& doc) {
// (No control widgets found)
}
// ════════════════════════════════════════════════════════════
// Framework code below — usually no changes needed
// ════════════════════════════════════════════════════════════
void webSocketEvent(uint8_t clientId, WStype_t type, uint8_t* payload, size_t length) {
if (type == WStype_CONNECTED) {
StaticJsonDocument<64> hs;
hs["_id"] = deviceId;
hs["_name"] = deviceId;
String hsStr; serializeJson(hs, hsStr);
webSocket.sendTXT(clientId, hsStr);
} else if (type == WStype_TEXT) {
JsonDocument doc;
if (deserializeJson(doc, (char*)payload) == DeserializationError::Ok) {
onCommand(doc);
}
}
}
void handleUdp() {
if (udp.parsePacket() == 0) return;
char buf[32] = {0};
udp.read(buf, sizeof(buf) - 1);
if (String(buf).indexOf("WIZDASH_DISCOVER") >= 0) {
String reply = "WIZDASH_HERE:" + String(WS_PORT);
udp.beginPacket(udp.remoteIP(), udp.remotePort());
udp.print(reply); udp.endPacket();
}
}
void sendDataToApp() {
JsonDocument doc;
readSensors(doc);
String json; serializeJson(doc, json);
webSocket.broadcastTXT(json);
}
void setup() {
Serial.begin(115200);
dht.begin();
WiFi.config(INADDR_NONE, INADDR_NONE, INADDR_NONE,
IPAddress(8, 8, 8, 8), IPAddress(8, 8, 4, 4));
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); }
Serial.println("\nIP: " + WiFi.localIP().toString());
uint64_t mac = ESP.getEfuseMac();
snprintf(deviceId, sizeof(deviceId), "wizdash-%02x%02x",
(uint8_t)(mac >> 8), (uint8_t)(mac));
MDNS.begin(deviceId);
MDNS.addService("wizdash", "tcp", WS_PORT);
udp.begin(UDP_PORT);
webSocket.begin();
webSocket.onEvent(webSocketEvent);
}
void loop() {
webSocket.loop();
handleUdp();
if (millis() - lastSendTime >= 2000) {
lastSendTime = millis();
sendDataToApp();
}
}

Step 6: Wire the DHT11 Sensor to Your ESP32 (GPIO 4)

Section titled “Step 6: Wire the DHT11 Sensor to Your ESP32 (GPIO 4)”

Unplug the USB cable from your ESP32 before wiring. Using a standard ESP32-DevKitC (38-Pin) board and a 3-Pin DHT11 PCB module, connect the three jumper wires as shown below:

ESP32-DevKitC and DHT11 3-Wire pinout diagram connecting 3V3 to VCC, IO4 (GPIO 4) to DATA, and GND to GND
Step 6: Connect DHT11 VCC to ESP32 3V3, DATA to IO4 (GPIO 4), and GND to GND.
DHT11 Module PinWire ColorESP32-DevKitC SilkscreenElectrical & Firmware Notes
VCC (or +)Red3V3 (3.3V Power)Always power from 3.3V so the data line never exceeds 3.3V GPIO logic levels
DATA (or OUT / S)Amber / YellowIO4 (GPIO 4)Matches #define DHT_PIN 4 in the generated sketch
GND (or -)BlackGND (Ground)Common ground with the ESP32
  • 3-Pin PCB Module vs. 4-Pin Bare Sensor:
    • Most 3-Pin PCB breakout modules include a built-in 10kΩ pull-up resistor on the board—just connect the 3 jumper wires directly.
    • If you are using a 4-Pin bare blue DHT11 sensor without a breakout PCB (pins 1 to 4 from left to right facing the front grille): connect Pin 1 to 3V3, Pin 2 (DATA) to GPIO 4 with a 4.7kΩ–10kΩ pull-up resistor bridged between Pin 1 and Pin 2, leave Pin 3 (NC) unconnected, and connect Pin 4 to GND.
  • Pins to avoid if you change the GPIO: Avoid input-only pins GPIO 34–39 (which lack internal pull-up resistors) and SPI Flash pins GPIO 6–11.

Step 7: Open in Arduino IDE, Install Libraries, and Flash to ESP32

Section titled “Step 7: Open in Arduino IDE, Install Libraries, and Flash to ESP32”

Plug your ESP32 into your computer via USB and complete the four steps below in Arduino IDE:

4-step diagram for Arduino IDE: open sketch & install ESP32 board core, install 4 required libraries, select board & port to upload, and verify IP in Serial Monitor at 115200 baud
Step 7: Install the 4 required libraries in Arduino IDE, select your ESP32 board and serial port, click Upload, and check the board’s LAN IP in Serial Monitor (115200 baud).
  1. Open the .ino Sketch & Verify the ESP32 Board Core:
    • Arduino IDE requires every .ino sketch to live inside a folder of the same name (e.g., WizDash_ESP32/WizDash_ESP32.ino). When you open the exported file, let Arduino IDE create the matching folder if prompted.
    • If you have not installed ESP32 board support yet, open Boards Manager, search for esp32, and install esp32 by Espressif Systems (v2.0.17 or v3.x).
  2. Install the 4 Required Libraries in Library Manager:
    • WebSockets by Markus Sattler (provides <WebSocketsServer.h>; double-check the author name).
    • ArduinoJson by Benoit Blanchon (install version 7.x, as the generated sketch uses the v7 JsonDocument API rather than 6.x).
    • DHT sensor library by Adafruit (provides <DHT.h>).
    • Adafruit Unified Sensor by Adafruit (required dependency for the DHT library; click Install All if prompted when installing DHT sensor library).
  3. Select Board & Port, Then Click Upload:
    • Choose Tools > Board > esp32 > ESP32 Dev Module (or the matching S3/C3 board entry).
    • Choose Tools > Port and select your ESP32 serial port (COMx on Windows, /dev/ttyUSB0 or /dev/ttyACM0 on Linux, /dev/cu.usbserial-* on macOS).
    • Click the → Upload button in the top-left corner. If the console stays on Connecting........, hold down the BOOT button on your ESP32 for 1–2 seconds until upload percentages appear.
  4. Verify the ESP32 IP Address in Serial Monitor (115200 baud):
    • Open Serial Monitor (top-right magnifying glass icon) and set the baud rate to 115200.
    • Press the EN (or RST) button on your ESP32. Once it joins your Wi-Fi network, it prints its local IP address (for example, IP: 192.168.1.108), starts the WebSocket server on port 81, and begins broadcasting DHT11 readings every 2 seconds.

Step 8: Return to WizDash and Connect to Your ESP32

Section titled “Step 8: Return to WizDash and Connect to Your ESP32”
  1. Make sure your phone is connected to the same 2.4 GHz Wi-Fi network as your ESP32.
  2. In WizDash, tap “Options” → “Bind Device” on your project card (or tap “I’ve flashed firmware, connect device” on the unbound dashboard screen) to open the WiFi Connection screen:
    • Auto Scan (mDNS + UDP): Tap “Start Scan”. When your ESP32 appears in the list (e.g., 192.168.1.108, Port: 81 · mDNS), tap the green “Connect” button to complete device identification and return to finish binding.
    • Manual Input: If your router blocks local multicast/broadcast packets, type the IP address from Serial Monitor (192.168.1.108) and port 81 under Manual Input and tap “Manual Connect”.
  3. If you started binding from Projects, WizDash returns there after binding. Choose “Options” → “Enter Dashboard” to establish the ongoing connection. If you started from the unbound dashboard guide, WizDash returns to the dashboard and attempts to connect automatically.
WizDash WiFi Connection screen showing 192.168.1.108 (Port: 81 · mDNS) found via Auto Scan and the Manual Input fields below
Step 8: Connect via Auto Scan (mDNS + UDP) or enter the IP address (192.168.1.108) and port 81 from Serial Monitor.

Step 9: Watch Live Temperature & Humidity Data Arrive!

Section titled “Step 9: Watch Live Temperature & Humidity Data Arrive!”

Once connected, the Wi-Fi icon in the top-right corner of the dashboard turns blue. Every 2 seconds, your ESP32 reads the DHT11 sensor and broadcasts {"temp": 26.4, "hum": 63.0} over WebSocket:

  • The “Temperature” Thermometer on the left updates to 26.4°C.
  • The “Humidity” Ball on the right updates to 63.0% with a live animated wave.

Try breathing gently onto the blue DHT11 sensor housing—within 2 to 4 seconds you will see both the humidity wave ball and thermometer climb in real time!

Connected WizDash live dashboard showing blue Wi-Fi connected icon, Temperature at 26.4°C, and Humidity wave ball at 63.0%
Step 9: Connected dashboard example. The screenshot uses test readings of 26.4°C and 63.0%; actual values depend on your sensor. The sketch sends readings every 2 seconds.

Troubleshooting & Local Network Security Notes

Section titled “Troubleshooting & Local Network Security Notes”

1. Serial Monitor prints [DHT11] Failed to read temperature or [DHT11] Failed to read humidity

Section titled “1. Serial Monitor prints [DHT11] Failed to read temperature or [DHT11] Failed to read humidity”

This message appears when dht.readTemperature() or dht.readHumidity() returns NaN (no valid response from the sensor). Check the following:

  • Pin silkscreen: Verify that the DHT11 DATA wire is connected to the pin labeled IO4 / G4 (GPIO 4) on your ESP32 board.
  • Power & ground: Confirm VCC is connected to 3V3 and GND to GND, and that all jumper wires are seated firmly.
  • Missing pull-up resistor on 4-pin bare sensors: A bare 4-pin DHT11 without a PCB breakout requires a 4.7kΩ–10kΩ resistor between VCC (Pin 1) and DATA (Pin 2).

2. Auto Scan finds nothing or Manual Connect fails

Section titled “2. Auto Scan finds nothing or Manual Connect fails”
  • Confirm your phone and ESP32 are on the exact same 2.4 GHz Wi-Fi subnet and that no VPN is active on your phone.
  • Check Serial Monitor (115200 baud) to verify the ESP32 printed IP: 192.168.x.x. If it keeps printing dots (.), double-check your 2.4 GHz Wi-Fi SSID and password.

3. Local Network & Sketch Sharing Security Notes

Section titled “3. Local Network & Sketch Sharing Security Notes”
  • Unencrypted LAN WebSocket (ws://): Local Wi-Fi mode uses an unencrypted WebSocket (ws://<ESP32_IP>:81) intended for trusted home, lab, or classroom networks. For remote access across networks, use MQTT (Your Own Broker) with TLS encryption enabled (port 8883).
  • Scrub credentials before sharing your .ino file: The generated sketch embeds WIFI_SSID and WIFI_PASSWORD in plaintext. Replace them with placeholders before committing the file to a public repository.