Story
This project explores the possibility of forecasting short-term temperature evolution directly on a microcontroller, without relying on any external infrastructure. In contexts such as agriculture, anticipating a frost event just two hours in advance can be enough to protect sensitive crops. The system is built around an ESP32 microcontroller, equipped with environmental sensors, a real-time clock, a display, and local SD card storage. Together, these components form a fully autonomous, compact weather prediction device tailored for offline operation.
At the core of the system lies a 1D convolutional neural network (CNN), trained to detect temporal patterns in environmental data. Every ten minutes, the device measures temperature, humidity, and atmospheric pressure. It displays the current readings, logs them to the SD card, and periodically generates a forecast of the temperature two hours into the future. The model is trained offline in Python using TensorFlow, based on historical data. Once trained, it is quantized, calibrated, it is deployed onto the ESP32 using TensorFlow Lite.
The software architecture is built around FreeRTOS, enabling multitasking operations such as data acquisition, inference, display updates, and status signaling via RGB LEDs. Power consumption is optimized by dynamically suspending non-critical tasks, enabling long-term operation on battery power—an essential feature for devices deployed in remote or degraded environments.
This approach embodies the principles of edge computing, where intelligence is moved closer to the source of data rather than relying on cloud services. Potential use cases include frost prevention in orchards, thermal management of exposed infrastructure, and energy optimization in isolated buildings or facilities.
Beyond its technical merits, this project demonstrates a practical application of embedded deep learning: a frugal, reliable, and efficient system capable of real-time, local forecasting. It proves that short-term weather prediction is now possible in fully offline mode, using a low-cost, resource-constrained platform.
Results
An example of a 2-hour temperature prediction. We can see that the magnitude of the agreement is on the order of 0.2 K.
Not for commercial use – © Selva Systems – Contact for license