This project is a firmware modification for the open-source tCam-Mini hardware (ESP32 + FLIR Lepton 3.1R). While the original firmware is great for streaming thermal video, this modification turns it into a standalone safety device. All other functionality of tCam-Mini remains untouched.

There are 3 main functions that added to the firmware:
- Stove State Monitoring (Heat Detection): The device continuously analyzes the radiometric data from the Lepton 3.1R sensor. It tracks the maximum temperature in the frame.
- Hot Threshold: If the temperature exceeds 80°C, the stove is flagged as "HOT".
- Cooling Hysteresis: To prevent false "safe" alerts during brief temperature dips (e.g., lifting a pan), the system utilizes a 5-minute cooldown timer. The stove is only declared "OFF/COOL" if the temperature remains below 80°C for 5 continuous minutes.
- Human Presence Detection (Thermal Motion): Unlike standard PIR sensors, Stove Watcher uses the thermal image itself to detect presence. It scans specifically for pixels within the human body temperature range (25°C - 38°C).
- It uses frame-differencing to detect motion. If a cluster of "human-temp" pixels moves significantly between frames, the system registers a human presence.
- Safety Logic: Whenever a human is detected while the stove is hot, the "Unattended Timer" is reset to zero.
- Critical Alerting System: If the stove is detected as HOT and no human motion is detected for 5 minutes, the device triggers a critical alarm.
- Remote Notification: Connects to the Telegram Bot API to send a warning message ("Cooktop is unattended while hot!").
- Visual Proof: Generates a 160x120 BMP thermal snapshot of the scene and uploads it with the alert. This features Automatic Gain Control (AGC) to ensure the image contrast is optimized for the current temperature range, and supports image rotation for under-cabinet mounting.
Alex Manusovich
Martin Cejp
Bikash Narayan Panda
Eduardo Zola