IoT-Based Motion Detection and Environmental Monitoring System for Agriculture Security Using ESP32
Abstract
Manual patrolling continues to be used on many small farms to locate trespassers, any stray animals and any changes to the field conditions, leaving the site open for much of the day. The low cost Internet of Things (IoT) systems reported in literature typically concentrate on environmental sensing tasks or intrusion detection tasks, and few of them couple an on-site deterrent with off-site notification. A mini-monitoring unit with the integration of motion detection and environmental monitoring using a single ESP32 microcontroller is presented here. A passive infrared (PIR) sensor is used for detecting movement in the monitored area, a DHT11 sensor is used for measuring ambient temperature and relative humidity, and an LED and an active buzzer are used as a local visual and audible alarm. The sensor data and system status are transmitted wirelessly via Wi-Fi to the Blynk IoT platform, and a dashboard is created to display information such as the system's motion state, real-time temperature and humidity readings. The firmware was programmed using the Arduino IDE, tested on the Wokwi simulator and deployed to a breadboard prototype placed next to a scaled up planting enclosure. The two cases that were operating were assessed. In the absence of the motion, the output of the PIR remained LOW, both alarm outputs were off and the unit continued to report temperature and humidity every 2 s. Once the motion was enabled the output from the PIR was HIGH, then the LED and buzzer were turned ON in the same control cycle, the motion status report was displayed on the dashboard, and the environmental readings were not interrupted. During the tests the data of temperature and humidity were successfully displayed on the Blynk dashboard. The results confirm that the unit works as designed in both cases and that a level of farm surveillance can be realised that is practical and achieved using low cost and widely available parts at approximately RM 56 per unit. Sensing range and sensor accuracy and reliance on Wi-Fi are also addressed.