|
|
3 days ago | |
|---|---|---|
| .. | ||
| README.md | 3 days ago | |
| README_ZH.md | 3 days ago | |
| water_temperature_sensor.ino | 3 days ago | |
README.md
ESP32 Temperature Monitoring Project
This project involves an ESP32 device using MQTT to send temperature data. The ESP32 is configured with a DS18B20 temperature sensor and connects to an MQTT broker.
Requirements
- ESP32 Development Board
- DS18B20 Temperature Sensor
- Arduino IDE with ESP32 support
- Wi-Fi connection
Configuration and Setup
-
Install the Arduino IDE: Download and install the Arduino IDE from Arduino website.
-
Add ESP32 Support in Arduino IDE: Follow the instructions here to add ESP32 board support to the Arduino IDE.
-
Install Required Libraries: Open the Arduino IDE, go to
Sketch>Include Library>Manage Libraries.... Install the following libraries:WiFiPubSubClientArduinoJsonOneWireDallasTemperature
-
Configure Wi-Fi and MQTT Settings: Open the provided ESP32 code in Arduino IDE. Modify the following lines with your Wi-Fi and MQTT broker details:
const char* wifi_ssid = "your_wifi_ssid"; const char* wifi_password = "your_wifi_password"; const char* mqtt_broker = "your_mqtt_broker"; const char* mqtt_username = "your_mqtt_username"; const char* mqtt_password = "your_mqtt_password"; -
Connect the DS18B20 Sensor to ESP32: Connect the DS18B20 sensor to your ESP32:
- DS18B20 VCC to ESP32 3.3V
- DS18B20 GND to ESP32 GND
- DS18B20 Data to ESP32 GPIO 25 (or change
one_wire_busin the code if using a different pin)
-
Upload the Code: Connect the ESP32 to your computer, select the correct board and port in Arduino IDE, and upload the code.
-
Monitor the Temperature Data: Once the code is uploaded, the ESP32 will start sending temperature data to the MQTT broker.