Turn a NodeMCU and a DHT11 into a tiny web server: open its IP address on your phone and see live temperature and humidity from anywhere in the house.
What you’ll build
The ESP8266 NodeMCU connects to your WiFi and serves a small auto-refreshing web page. Every visit reads the DHT11 and returns the latest temperature and humidity — no cloud account, no app, just your local network.
Components you’ll need
| Component | Qty | Price |
|---|---|---|
| ESP8266 NodeMCU V3 WiFi Development Board | 1 | ₹199 |
| DHT11 | 1 | ₹69 |
| 400 Point Breadboard | 1 | ₹299 |
| Jumper Wires MM | 1 | ₹299 |
| Total | ₹866 |
Step-by-step guide
- In the Arduino IDE add ESP8266 board support (Boards Manager → search “esp8266”), and select “NodeMCU 1.0”.
- Wire the DHT11: VCC to 3V3, GND to GND, DATA to D4 (GPIO2).
- Install the Adafruit DHT sensor library.
- Put your WiFi name and password into the sketch and upload.
- Open the Serial Monitor at 115200 baud — the ESP prints its IP address once connected.
- Browse to that IP from any device on the same WiFi; the page refreshes itself every 5 seconds.
The code
A dozen lines of ESP8266WebServer code is all it takes to publish sensor data on your LAN.
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <DHT.h>
DHT dht(2, DHT11); // D4 = GPIO2
ESP8266WebServer server(80);
void handleRoot(){
float t=dht.readTemperature(), h=dht.readHumidity();
String html = "<meta http-equiv='refresh' content='5'>";
html += "<h1>Arrowtron Weather</h1>";
html += "<p>Temperature: " + String(t,1) + " °C</p>";
html += "<p>Humidity: " + String(h,0) + " %</p>";
server.send(200, "text/html", html);
}
void setup(){
Serial.begin(115200); dht.begin();
WiFi.begin("YOUR_WIFI", "YOUR_PASSWORD");
while(WiFi.status()!=WL_CONNECTED){ delay(500); Serial.print("."); }
Serial.println(WiFi.localIP());
server.on("/", handleRoot); server.begin();
}
void loop(){ server.handleClient(); }Build this project
Add all 4 required components to your cart in one click — total ₹866.
Add all components to cart