ESP32 Temperature Monitor | REES52 AcademyClass 8 · IoT Projects
ESP32 Temperature Monitor
A complete sensor project using 3.3 V logic, a local wiring diagram, working serial code, measured results and practical invalid-reading checks.
A complete sensor project using 3.3 V logic, a local wiring diagram, working serial code, measured results and practical invalid-reading checks.
- 1Connect DHT11 VCC to 3V3, DATA to GPIO 4 and GND to GND.
- 2Install the matching DHT sensor library and select the ESP32 board.
- 3Upload the sketch and open Serial Monitor at 115200 baud.
- 4Record three readings at least two seconds apart.
#include <DHT.h>
#define DHTPIN 4
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(115200);
dht.begin();
}
void loop() {
float temperature = dht.readTemperature();
float humidity = dht.readHumidity();
Serial.printf("T: %.1f C H: %.1f %%\n", temperature, humidity);
delay(2000);
}
- If values are invalid, wait two seconds and recheck the sensor type.
- If upload fails, hold BOOT only when required by the board variant.
- If readings jump, shorten signal wires and verify the pull-up connection.
Back to Project Library