Source-linked AI summary
A Low-Cost IoT Device for Environmental Monitoring and Embedded Solar Forecasting with On-Device Incremental Learning
Erick Michel Lara Pinal, Abhinav Das, Stephan Schlüter
TL;DR
Hyperlocal PV forecasting needs affordable local measurements beyond sparse ground networks and coarse remote sensing. This paper combines a low-cost ESP32 sensor device with on-device incremental learning, achieving MAE 0.2975 V and R2 = 0.9165 over a clean 28-day Zapopan evaluation window while outperforming climatology but not 24-hour persistence.
Problem
Hyperlocal PV forecasting lacks affordable, sufficiently local meteorological measurements because ground networks are sparse and remote-sensing products are coarse.
Method
A modular ESP32 IoT device runs a feedforward forecasting network trained offline on site data, with on-device incremental gradient descent and no cloud connectivity.
Results
MAE 0.2975 V (4.65% of range) and R2 = 0.9165 were achieved over 28 clean daytime days, outperforming climatology but not 24-hour persistence.
Takeaways & Limitations
The results demonstrate autonomous 24-hour solar voltage forecasting on low-cost hardware without internet connectivity or remote calibration.
Takeaways & Limitations
Generalization across seasons remains un demonstrated because each deployment covered a single seasonal window, so the Zapopan R2 should not be extrapolated to the full rainy season.
Abstract
from arXiv · showhide
Hyperlocal meteorological sensing is essential for accurate solar photovoltaic forecasting, yet professional-grade meteorological stations require investments easily exceeding 1000~USD per node, making distributed deployments economically inaccessible. This work presents a modular internet of things (IoT) device based on the ESP32 microcontroller integrating temperature, humidity, luminosity, and solar irradiance sensors in an IP68-rated enclosure at a total hardware costs of about \$65~USD when components are sourced in Germany. A hybrid architecture decouples external model training, performed on a conventional computer using the software Python and the open-source library TensorFlow, from autonomous 24-hour solar voltage forecasting executed on-device via a three-layer feedforward network with 3{,}011 parameters (11.8\,KB). The network is trained offline on site-collected data and deployed on the microcontroller as static weight matrices without cloud connectivity. An on-device incremental gradient descent mechanism enables continuous model adaptation after deployment without external retraining. The system was evaluated through two field deployments: a short period of hardware and firmware validation in Ulm, Germany, and a 115-day deployment in Zapopan, Mexico, comprising 84~days of training and 31~days of autonomous operation with zero missing records. Over a clean 28-day daytime window, the embedded model attained a coefficient of determination of 0.9165 and a mean absolute error of 0.2975~V (4.65\% of the operational range), outperforming a climatology baseline (skill score 0.64) while not surpassing a 24-hour persistence baseline. A frozen-weight ablation confirms that the on-device update mechanism yields a small but statistically robust accuracy gain ($p = 0.001$), demonstrating that autonomous incremental learning is feasible on low-cost hardware without cloud connectivity.
1 Introduction
Hyperlocal meteorological variation limits short-horizon photovoltaic forecasting because national networks and satellite reanalysis lack sufficient spatial resolution. The paper addresses this gap with an ESP32-based hybrid IoT architecture that performs autonomous solar-voltage forecasting without cloud connectivity.
- Motivation: Sub-kilometer irradiance, temperature, and humidity variation is invisible to national networks and approximately 50 km-resolution NASA MERRA-2 reanalysis.National observation networks deploy at most one station per urban area, while site-level conditions can differ substantially over a few hundred meters.
- Related work: Low-cost microcontroller platforms have supported ANN-based PV prediction, on-device air-quality inference, and real-time PV monitoring with local data storage.The cited prior systems motivate the use of embedded IoT platforms for environmental monitoring and forecasting.
- Contribution: A three-layer feedforward network is trained offline in Python and TensorFlow on site-collected environmental data, then deployed as static weight matrices on an ESP32.The hybrid architecture separates external model training from embedded inference under hardware constraints.
- Contribution: Autonomous 24-hour solar-voltage forecasting runs on-device without cloud connectivity.The deployed weight matrices enable forecasting directly on the microcontroller.
2 Hardware
The device hardware emphasizes outdoor robustness, low cost, and modularity through an ESP32-centered system with environmental sensors, local storage, and wireless communication. Its solar-panel sensor provides a localized, uncalibrated irradiance proxy suitable for capturing microclimate variation.
- Design requirements: $55 USD is the combined cost of eight off-the-shelf components when sourced locally in Mexico, supporting cost-efficient distributed deployment.The design targets robustness, accessibility, and modularity for future sensor expansions.
- Processing platform: 520 KB SRAM, 4 MB flash memory, and a 12-bit ADC enable local model storage and direct sensor interfacing on the ESP32.Its dual-core processor operates at up to 240 MHz, while deep-sleep current draw is 10 µA for extended battery operation.
- System integration: The ESP32 acquires temperature, humidity, luminosity, and solar-panel voltage, stores JSON records on microSD, forecasts solar voltage, and transmits results via BLE.The sensor suite was selected for accuracy, reliability across climates, energy efficiency, and ESP32 compatibility.
- Irradiance sensing: 0–6.4 V is the operational span of the voltage-conditioned 9 V photovoltaic panel used as a localized irradiance-sensing element.Because panel voltage is nonlinear and temperature-dependent, it serves as an uncalibrated relative proxy rather than quantitative irradiance in W/m2.
- Environmental protection: IP68-rated enclosure protection supports unattended outdoor deployment against dust, continuous water immersion, rain, humidity, and particulate matter.The custom PCB uses a modular layout with expansion slots for future sensor additions without redesign.
3 Software
The software uses a lean ESP32-compatible architecture that separates offline neural-network training from on-device forecasting and adaptation. A 24-hour sliding window supports embedded inference, while incremental updates enable autonomous adjustment without cloud connectivity or external retraining.
- Architecture: Offline training is separated from online ESP32 execution because neural-network training is computationally demanding.The device records and stores sensor data while producing forecasts using a feedforward neural network.
- Forecasting model: A feedforward network uses the past 96 quarter-hourly observations, corresponding to a 24-hour window for diurnal solar forecasting.The window contains temperature, humidity, and luminosity measurements and supports the forecasting model deployed on the ESP32.
- Embedded inference: Sensor readings are cleaned, filled, and min-max normalized using training-set bounds stored as firmware constants to ensure consistent inference-time scaling.The processing pipeline then performs forward propagation with tanh activation and converts predictions back to physical voltage units with saturation limits of 0 V and 6.4 V.
- Embedded inference: 3,011 trainable parameters occupy 11.8 KB of float32 storage on the ESP32, leaving flash and SRAM for firmware, buffering, and communication.The embedded model receives a flattened 288-value input derived from 96 samples and three sensor features.
- On-device adaptation: η = 0.001 updates weights and biases after each completed 24-hour forecast day, enabling gradual local adaptation without cloud connectivity or external retraining.Updates use the current 96-point sliding window, so memory usage remains constant regardless of deployment duration.
4 Case Study
The case study evaluated the system through sequential deployments in Ulm, Germany, and Zapopan, Mexico. The extended Mexican campaign enabled autonomous 24-hour forecasting and showed improving daytime accuracy during validation.
- Field deployments: Two sequential field deployments tested the complete system first in Ulm, Germany, then under extended conditions in Zapopan, Mexico.The Ulm deployment served as an initial operational test, while Zapopan enabled comprehensive quantitative evaluation.
- Ulm deployment: 6.4 V was the maximum solar-panel voltage recorded in Ulm, with values reaching 0 V at night and varying across days.The variation reflected changing atmospheric conditions during the deployment.
- Zapopan deployment: 84 days of training preceded 31 days of fully autonomous validation in Zapopan, producing 24-hour forecasts without external retraining or connectivity.The 115-day campaign covered diverse environmental conditions spanning the local dry season and seasonal humidity transition.
- Zapopan deployment: 6.4 V was consistently reached in February and March, whereas April peaks fell to 5.5–5.6 V amid higher temperatures and humidity.These variations were captured by the sensors and incorporated into the embedded model’s training data.
- Validation performance: 0.347 V decreased to 0.227 V in mean daytime error from Week 1 to Week 4, a reduction of approximately 35%.The improvement partly reflected on-device weight updates, although frozen-weight results indicated that the declining error was also substantially driven by the moving data window.
- Validation performance: 0.2975 V was the model’s mean absolute error over 28 unaffected daytime validation days, equal to 4.65% of the 0–6.4 V operational range.The evaluation window covered 1–28 May, restricted to 06:00–19:00, excluding corrupted final days and firmware-fixed nighttime outputs.
5 Discussion
The discussion attributes forecasting performance primarily to training duration and changing meteorological conditions, while showing that on-device incremental learning provides a small, statistically significant improvement over frozen weights. Conclusions remain bounded by limited seasonal and site coverage, with Zapopan performance not yet demonstrated across substantially different conditions.
- Forecasting accuracy: Training duration influenced accuracy: Ulm’s short training period and near-binary LDR signal limited intra-day irradiance amplitude resolution.The Ulm deployment served primarily for hardware and firmware validation, and no quantitative error metrics were reported.
- On-device adaptation: 0.025 ± 0.006 V mean improvement: adaptive weights reduced mean absolute error versus frozen weights across five random initializations (paired t-test, p = 0.001).Both conditions started from identical initial parameters and used the same May inputs.
- On-device adaptation: 0.38% of the operational range: the adaptation effect was small but statistically significant and required neither external retraining nor cloud connectivity.The frozen model showed a comparable week-to-week decline in error, so most observed improvement was not attributed solely to adaptation.
- Limitations: R2 = 0.9165: the reported Zapopan performance is specific to the observed deployment window and does not establish generalization across all seasons or substantially different conditions.Ulm covered late spring, while Zapopan covered the dry-season-to-wet-season transition.
6 Conclusion
The work presents a low-cost open-source sensor box with offline forecasting suitable for deployment without internet connectivity or remote calibration. Future improvements target irradiance sensing, seasonal training coverage, and connectivity.
- Conclusion: The low-cost open-source sensor box records climate data using temperature, humidity, and solar power sensors, while supporting additional sensors such as wind.The presented setup combines hardware and software with forecasting designed to run on the box without internet connectivity or remote calibration.
- Future work: Replacing the LDR photoresistor with a quantitative irradiance sensor could improve model inputs during partial-cloud conditions.The German-site signal was near-binary, whereas quantitative irradiance sensing would provide continuous amplitude information.
- Future work: Extending training periods to complete seasonal cycles could expose the model to the full range of meteorological variability at each site.This is identified as a priority for future work.
- Data availability: The raw sensor measurements, model predictions from both field deployments, firmware source code, and companion mobile application are publicly available in the Mendeley Data repository.The study reports no external funding.
A Sensor Costs
This section presents an approximate cost breakdown for a field-ready unit, using upper-reference retail prices from Amazon Germany while noting that local sourcing in Mexico lowers the build cost. It also distinguishes operational accessories from the eight core sensing and processing components.
- A Sensor Costs: The breakdown estimates the total cost of a field-ready unit, including hardware and operational accessories.The accessories include a power bank and miscellaneous components such as resistors, capacitors, and wires.
- A Sensor Costs: Retail unit prices from Amazon Germany provide an upper reference for the estimate.Prices were accessed 28 July 2026 and converted from EUR at 1.14 USD/EUR.
- A Sensor Costs: Local sourcing in Mexico yields a lower build cost than the listed retail reference.The passage characterizes the German retail figures as an upper reference.
- A Sensor Costs: The power bank and miscellaneous components are operational accessories rather than part of the eight core sensing and processing components.They are included to provide a complete estimate of the total cost of a field-ready unit.