This project is a temperature monitoring and control system built with an ESP32 microcontroller. It uses an LM35 temperature sensor to continuously monitor ambient temperature and automatically controls a relay to manage connected equipment (like cooling or heating systems). The system includes an OLED display for real-time information, LED indicators, alarm functionality, and Blynk IoT integration for remote monitoring and control.
- Real-time Temperature Monitoring: Uses LM35 temperature sensor for accurate readings
- Automatic Control: Activates/deactivates a relay based on configurable temperature thresholds
- Visual Feedback:
- OLED display showing current temperature, system status, and relay state
- LED indicators for relay status (ON/OFF)
- Audio Alerts: Different buzzer patterns for various states (overheat, recovery, system toggle)
- Manual Control: Physical button to toggle system operation
- Remote Monitoring and Control: Blynk IoT platform integration allows monitoring and control from anywhere
- Fail-safe Operation: System can work offline if WiFi/Blynk connection is unavailable
- ESP32 development board
- LM35 temperature sensor
- 0.96" OLED display (SSD1306, I2C interface)
- 5V relay module
- Piezo buzzer
- 2 LEDs (for relay status indication)
- Push button
- Resistors and connecting wires
- 5V power supply
- Arduino IDE
- Libraries:
Wire.h- For I2C communicationAdafruit_GFX.h- Graphics library for the OLED displayAdafruit_SSD1306.h- Display driver for the OLEDWiFi.h- For WiFi connectivityBlynkSimpleEsp32.h- For Blynk IoT platform integrationpitches.h- For buzzer tones
| Component | ESP32 Pin |
|---|---|
| LM35 Sensor | GPIO34 |
| Relay | GPIO5 |
| Button | GPIO13 |
| Buzzer | GPIO18 |
| Relay ON LED | GPIO14 |
| Relay OFF LED | GPIO12 |
| OLED Display | I2C (0x3C) |
- Clone this repository or download the source code
- Install required libraries through Arduino Library Manager
- Create a Blynk account and set up a new project
- Replace the following credentials in the code:
#define BLYNK_TEMPLATE_ID "TMPL3MCE-W-US" #define BLYNK_TEMPLATE_NAME "TempControl" #define BLYNK_AUTH_TOKEN "rpbJiYaLbjx23ra69y84uos5Xge_dRlS" char ssid[] = "your-wifi-ssid"; char pass[] = "your-wifi-password";
In your Blynk app:
- Create a new project
- Add the following widgets with corresponding virtual pins:
- Value Display (V0): For temperature readings
- Value Display (V1): For relay status
- Value Display (V2): For system status
- Value Display (V3): For voltage
- Value Display (V4): For overheat status
- Button (V5): For toggling system on/off
- Normal Operation: When temperature is below threshold (30°C), the relay is ON
- Overheat Condition: When temperature exceeds threshold, relay turns OFF and alarm sounds
- Manual Control: Press the physical button to toggle system ON/OFF
- Remote Control: Use the Blynk app to monitor and control the system
- Temperature threshold can be adjusted by changing const float temperatureThreshold = 30.0;
- Alarm sounds and durations can be modified in the corresponding arrays
- Update intervals can be adjusted for different components:
- Temperature reading: const unsigned long updateInterval = 2000;
- Blynk updates: const unsigned long blynkUpdateInterval = 1000;
- If the OLED display fails to initialize, check the I2C connections and address
- If Blynk connection fails, the system will operate in offline mode
- For inaccurate temperature readings, check the LM35 sensor connections and power supply
This project is licensed under the MIT License. Hack it, share it, just give a shoutout to the original repo.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
- Adafruit for their excellent display libraries
- Blynk for their IoT platform
