This project uses an ESP32 to monitor temperature via an NTC thermistor and control a relay-connected LED in two operating modes:
- Relay (and LED) turns ON if the temperature exceeds a defined threshold.
- Relay turns OFF when the temperature drops below the threshold.
- Relay can be turned ON/OFF remotely using MQTT commands from a PC or another MQTT client.
- Copy
esp32_code/main.pyto your ESP32. - Connect hardware:
- NTC Thermistor + 10kฮฉ resistor as a voltage divider โ GPIO34
- Relay Module control pin โ GPIO2
- LED connected between NOโCOM on the relay
- Run the code on ESP32.
- Open Serial Monitor to verify:
- โ Wi-Fi connection
- โ MQTT broker connectivity
- Install required library:
pip install paho-mqtt
