🚀 An IoT thermostat using ESP32, WebSockets, and MQTT for real-time temperature control and monitoring.
- ✅ Web-based Thermostat (Adjust temperature from a browser)
- ✅ Real-time Updates using WebSockets
- ✅ ESP32 + MQTT Communication
- ✅ Displays Current Temperature & Humidity
- ✅ Predicts Estimated Time for Setpoint & Shows in HH:MM Format
ESP32-Thermostat/
│── data/ # HTML Files for LittleFS
│ ├── index.html
│── src/ # ESP32 Firmware Code
│ ├── esp32_thermostat.ino
│── README.md # Project Documentation
│── .gitignore # Ignore compiled files
1️⃣ Hardware Needed:
- ESP32 Dev Board
- SHT21 Temperature & Humidity Sensor
- WiFi Network
- MQTT Broker (Local or Cloud) 2️⃣ Software Needed: Arduino IDE
- ESP32 Board Support (ESP32 by Espressif Systems via Boards Manager)
- Arduino Libraries:
- PubSubClient (Library Manager → Search "PubSubClient" → Install)
- WebSocketsServer (Library Manager → Search "WebSocketsServer" → Install)
- ArduinoJson (Library Manager → Search "ArduinoJson" → Install)
- LittleFS for ESP32 (Library Manager → Search "LittleFS_ESP32")
- Open Arduino IDE.
- Install required libraries (see above).
- Open esp32_thermostat.ino.
- Modify WiFi & MQTT details:
const char* ssid = "YOUR_WIFI_SSID";
const char* password = "YOUR_WIFI_PASSWORD";
const char* mqtt_server = "YOUR_MQTT_BROKER_IP";
- Connect ESP32 and Upload the Code.
- Install the ESP32 LittleFS Plugin:
- Download the plugin: ESP32 LittleFS Plugin
- Copy it to Arduino/tools/ESP32FS/tool/
- In Arduino IDE:
- Go to Tools → ESP32 Sketch Data Upload.
- It will upload index.html to ESP32.
- If using Mosquitto MQTT on Raspberry Pi/PC, install it:
sudo apt install mosquitto mosquitto-clients
- Start the broker:
sudo systemctl start mosquitto
- Subscribe to MQTT topics to test:
mosquitto_sub -h YOUR_MQTT_BROKER_IP -t "thermostat/#" -v
- Open Serial Monitor (115200 baud).
- Get the ESP32 IP Address.
- Open a browser and go to:
http://ESP32_IP/
- Adjust the Set Temperature and see real-time updates.