Preprint
Article

This version is not peer-reviewed.

SPAI-EH: An IoT and Generative-AI System for Hail and Heavy-Rain Protection in Smallholder Agriculture in Puebla, Mexico

Submitted:

03 August 2026

Posted:

03 August 2026

You are already at the latest version

Abstract
Hail and sudden heavy rainfall regularly destroy vegetable and grain crops in the state of Puebla, Mexico, with the state’s rural-development authority reporting thousands of damaged hectares within a single growing cycle. This paper presents SPAI-EH, a low-cost Internet of Things system that detects intense rainfall and hail in real time, automatically closes a protective gate over the affected plot, and routes the captured water toward irrigation reuse. The pilot implementation uses an ESP32 microcontroller simulated in Wokwi, combining a DHT22 temperature and humidity sensor with an analog potentiometer that emulates a rain and hail intensity sensor, a servo-actuated gate, a warning LED, and a liquid-crystal display. Readings are classified locally through threshold rules and, when connectivity is available, through a call to a cloud generative-AI model that returns a hazard classification and a gate action. Every reading is stored in an Oracle Application Express database accessed through RESTful web services, and a MIT App Inventor mobile application lets a grower monitor five simulated plots on a map and manually close a gate. Across the recorded test window, the system correctly distinguished normal conditions from three simulated hail events and one heavy-rain event in a single plot, while the remaining plots stayed within expected ranges. The paper also discusses the applicable IEEE IoT standards and the gap between the classroom pilot and a field-ready deployment.
Keywords: 
;  ;  ;  ;  
Copyright: This open access article is published under a Creative Commons CC BY 4.0 license, which permit the free download, distribution, and reuse, provided that the author and preprint are cited in any reuse.
Prerpints.org logo

Preprints.org is a free preprint server supported by MDPI in Basel, Switzerland.

Subscribe

© 2026 MDPI (Basel, Switzerland) unless otherwise stated

Accessibility

Disclaimer

Terms of Use

Privacy Policy

Privacy Settings