Animal Intrusion Detection and Repellant System Using IoT and Computer Vision
By Mr.G.Subramanian, Aswanth K C, Balavigneshwaran V, Lokhesh S, Yuvan Chandran R
Department of ECE, Velammal Engineering College, Chennai, India
Abstract
Deforestation has led to increased human-wildlife conflict, with wild animals encroaching upon agricultural lands for survival thereby causing crop losses and sometimes human losses too. This study introduces an innovative Smart Agriculture application designed to mitigate this issue. By utilizing computer vision and species-specific ultrasound emission technologies, the system creates virtual fences that effectively prevent animals from entering cultivated areas. The computer vision component detects and identifies approaching animals, while the ultrasound emitter generates specific frequencies that are irritable to specific species, thus detouring them without causing harm. This solution offers 24/7 protection for various crops in different geographic locations without human presence or interaction.
Keywords: Agriculture, Animal attack, Computer Vision, Repulsion
Introduction
As human populations increase and natural habitats decrease, thus balance between wildlife and agriculture is increasingly interrupted. Wild animals, for survival, often attempt into cultivated lands, causing crop damage and conflicts with farmers. Traditional methods of crop protection, such as physical barriers or electric current fence, often causes serious injuries to the animals.
In response to this challenge, a new generation of smart solutions is emerging, using the power of technology to ensure coexistence between wildlife and agriculture. This innovative approach seeks to protect crops while minimizing harm to animals and preserving ecological balance.
Key Components
System Architecture
Our system comprises several key components working in harmony:
1. PIR Sensor
PIR sensors are crucial for initial motion detection.
Here's why we chose them:
Compact size and low cost
Low power consumption
Extended lifespan
Simple to use and integrate
Technical operation:
The sensor contains a pyroelectric element divided into two parts.
These parts are wired to cancel each other out under normal conditions.
When an object (like an animal) moves, it causes a difference in infrared radiation between the two halves.
This imbalance triggers the sensor output, indicating motion.
2. Raspberry Pi
The Raspberry Pi serves as the brain of our system. We're using the Raspberry Pi 3 Model B for its advanced features:
1.2 GHz 64-bit quad-core ARMv8 CPU
1 GB RAM
Integrated 802.11n Wi-Fi and Bluetooth
4 USB ports and Ethernet
40-pin GPIO header
The GPIO (General Purpose Input/Output) header is crucial for our system, allowing direct control of inputs and outputs. We use it to interface with the PIR sensor and control the camera module.
3. Raspberry Pi Camera Module
We're using the 8-megapixel camera module version 2 for its superior image quality.
Key specifications:
Sony IMX219 sensor
3280 x 2464 pixel static images
1080p30 video recording
Connected to the Raspberry Pi via a ribbon cable
The camera is controlled programmatically using Python, allowing us to capture images when motion is detected by the PIR sensor.
4. Speaker System
Our speaker system is designed to emit ultrasonic frequencies specific to different animal species.
It consists of:
High-frequency transducers capable of emitting sounds up to 65 kHz
An amplifier circuit to boost the signal from the Raspberry Pi
A custom-designed enclosure for optimal sound projection
The speaker drivers convert electrical signals from the Raspberry Pi into mechanical wave energy (sound), focusing on frequencies known to deter specific animal species without causing harm.
Software Architecture
Python
We use Python as our primary programming language due to its simplicity, extensive libraries, and strong community support. Key libraries used in our project:
RPi.GPIO
for interfacing with the PIR sensorpicamera
for controlling the Raspberry Pi cameraopencv-python
for image processingtorch
andtorchvision
for running our YOLO v5 model
YOLO v5 Algorithm
YOLO v5 (You Only Look Once version 5) is our chosen algorithm for animal detection. It offers several advantages:
Real-time object detection with high accuracy
Efficient performance on edge devices like Raspberry Pi
Ability to detect multiple objects in a single frame
We've trained our YOLO v5 model on a custom dataset of local wildlife to ensure high accuracy in our specific use case.
System Workflow
Motion Detection: The PIR sensor continuously monitors the protected area. When motion is detected, it sends a signal to the Raspberry Pi via the GPIO pins.
Image Capture: Upon receiving the motion signal, the Raspberry Pi triggers the camera module to capture a high-resolution image.
Image Processing: The captured image is processed using OpenCV to enhance features and prepare it for the YOLO v5 model.
Animal Detection: The processed image is fed into our trained YOLO v5 model, which identifies and classifies any animals present in the image.
Decision Making: Based on the detection results, the system decides on the appropriate response. This includes determining which ultrasonic frequency to emit and whether to send an alert.
Repellent Activation: If an animal is detected with high confidence, the system generates the species-specific ultrasonic signal and sends it to the speaker system.
Alert System: Simultaneously, an alert is sent to the designated recipients (e.g., landowners or forest department) with details of the detected intrusion.
Extended Functionality: ESP32 Camera
We've incorporated an ESP32 camera module to extend the system's capabilities:
Provides additional coverage for larger areas
Enables wireless image transmission to the Raspberry Pi
Low-power consumption for extended battery life
The ESP32 camera captures images and sends them directly to the Raspberry Pi via Wi-Fi, using the existing 34 integrated circuits for efficient data transmission. This allows for a more distributed sensor network, improving the system's overall coverage and effectiveness.
Results and Discussion
Our system has demonstrated high accuracy in animal detection using the YOLO v5 algorithm. The integration of PIR sensors for initial motion detection significantly reduces false positives and conserves system resources.
The species-specific ultrasonic repellent system has shown promising results in deterring animals without causing harm. By emitting frequencies tailored to different species, we ensure that the repellent effect is targeted and effective.
The modular nature of our system allows for easy scaling and adaptation to different environments. The addition of the ESP32 camera module demonstrates this flexibility, enabling extended coverage and improved data collection.