Regression-PID: Bare-Metal Predictive Temperature Control via Multiple Linear Regression on an ESP32-Based IoT Egg Incubator - Zainal Arifin; Siti Rokhmah; Tino Feri Efendi (International Journal of Computer and Information System (IJCIS), 2026)
Abstract - The success of egg hatching depends on the stability of the incubation temperature within a highly strict tolerance (±0.3°C). Conventional PID controllers in egg incubators are reactive, correcting temperature only after an error is detected, which makes them prone to overshoot during warm-up. This study proposes Regression-PID — a PID controller augmented with a Multiple Linear Regression (MLR) predictive model deployed as bare-metal arithmetic in ESP32 firmware, without any machine learning framework. Trained offline using Ordinary Least Squares on historical temperature and duty cycle data, the optimal window W = 5 yields 11 coefficients (R² = 0.7634, RMSE = 0.1512°C) stored in 44 bytes of flash. The 30-second-ahead temperature prediction drives the proportional and derivative terms; the integral term uses actual temperature to guarantee steady-state error elimination. A comparative experiment was performed on an ESP32-based IoT egg incubator with real-time MQTT telemetry to a cloud backend. Regression-PID reduces overshoot by 68.1% (0.44 vs. 1.38°C), ISE by 89.7% (0.71 vs. 6.92 °C²·s), IAE by 74.6%, and steady-state standard deviation by 73.9% (0.014 vs. 0.053°C); both modes maintained the ±0.3°C tolerance band 100% of the time. Computational overhead is only +12.17 µs per cycle (0.0012% of the 1-second period) with deterministic latency. Performance differences are confirmed by Mann-Whitney U (p = 0.0009, r = 0.777) and Wilcoxon Signed-Rank (p < 0.0001). These results demonstrate that linear regression is sufficient for predictive thermal control in quasi-linear systems, with minimal complexity and no compromise to real-time feasibility.