IoT

ESP32 with DHT11 Temperature Measurement and Smartphone Notification

This project uses an ESP32 board with a DHT11 temperature and humidity sensor to measure temperature and send the data to a smartphone.

Haythem

Step-by-Step Guide

1

Materials List

- 1 x ESP32 board - 1 x DHT11 temperature and humidity sensor - 1 x Breadboard - 1 x Resistor (10kΩ) - 1 x Jumper wire

2

Assembling

1. Connect the DHT11 sensor to the breadboard. 2. Connect the VCC pin of the DHT11 sensor to the 3V3 pin of the ESP32 board. 3. Connect the GND pin of the DHT11 sensor to the GND pin of the ESP32 board. 4. Connect the DOUT pin of the DHT11 sensor to the D2 pin of the ESP32 board. 5. Connect the resistor between the DOUT pin of the DHT11 sensor and the VCC pin of the ESP32 board.

3

Arduino Code & Libraries

arduino #include <WiFi.h> #include <HTTPClient.h> #include <DHT.h> #define WIFI_SSID 'your_ssid' #define WIFI_PASSWORD 'your_password' #define DHT_PIN 2 #define DHT_TYPE DHT11 WiFiClient client; HTTPClient http; DHT dht(DHT_PIN, DHT_TYPE); void setup() { Serial.begin(115200); WiFi.begin(WIFI_SSID, WIFI_PASSWORD); while (WiFi.status() != WL_CONNECTED) { delay(1000); Serial.println("Connecting to WiFi.."); } Serial.println("Connected to the WiFi network"); dht.begin(); } void loop() { float temperature = dht.readTemperature(); if (temperature != NAN) { http.begin(client, "http://example.com/temperature?value=" + String(temperature)); http.GET(); http.end(); } delay(10000); }

Project Resources

No downloadable resources added yet.

Please login to leave a comment.

0 Comments

No comments yet. Be the first to share your thoughts!