# Real-Time Farm Surveillance Using IoT and YOLOv8 for Animal Intrusion Detection
## 2 Methodology and Implementation
### Hardware Architecture  
The SFSS's hardware design has been rigorously built, taking into account a plethora of elements while stressing simplicity, practicality, and usefulness. The physical components of the system have been carefully chosen to function in tandem, providing smooth and effective operation. An ESP32 microcontroller, a camera module, a speaker, a motor, and the necessary power supply make up the main hardware. Figure 10 presents the hardware architecture of the proposed system and compares it with the ancient method.  
* Microcontroller ESP32: The ESP32 microcontroller serves as the central control unit at the core of the hardware design. It acts as the system's brain, directing the operation of all other physical components. The microcontroller serves as the major data transmission interface, guaranteeing a smooth connection between the camera module, speaker, motor, and cloud servers.
* Camera Module: A critical component of the system, the camera module is tightly tied to the ESP32 microcontroller. It is critical in enabling real-time video transmission from the farm to cloud servers. This continuous video stream serves as the basis for AI-driven intrusion detection, allowing for quick reaction mechanisms in the event of an abnormality.
* Speaker: Another essential component of the hardware design, the speaker is directly connected to the ESP32 microprocessor. The ESP32 activates the speaker when it re  
Figure 10: Design of the system’s hardware.  
ceives intrusion detection orders from the cloud server. This activation is successful in repelling intruders, whether they be animals or people, and so improves farm security.
* Motor: The motor is a specialist component developed to improve the camera module's efficiency. It is completely integrated with the camera and allows for 360-degree camera rotation. This function provides thorough coverage of agricultural land, guaranteeing that no blind patches go unnoticed. The regulated rotation of the motor offers an added degree of protection to the farms.
* Power Supply: The system's power supply is critical since it provides the necessary energy for all other hardware components to operate. It guarantees that the ESP32 microcontroller, camera module, speaker, and motor run smoothly, resulting in smooth and continuous functioning.  
The harmonic combination of these hardware pieces emphasizes the SFSS's simplicity and efficiency. This design not only enables the continual monitoring and preservation of agricultural fields, but it also serves as proof of technology's potential within current farming techniques. This well-thought-out hardware ensemble serves as the foundation of a dependable and efficient farm intrusion detection system by addressing both security and functionality.  
Figure 11 demonstrates a complicated electrical arrangement that includes several linked components. It shows the hardware of the system in the real world. Central to this arrangement is the ESP32 camera module, which permits the collection and processing of visual information. Adjacent to it is a power supply unit that enables the continued operation of the linked modules. On the left side, an FTDI Adapter acts as a USB-to-serial converter, enabling the connection of the ESP32 to PCs for programming and data transmission. Additionally, the design contains a distinctive lit buzzer, which works as either an alarm mechanism or a feedback tool for end users. The colored lines connecting the components illustrate the intricacy of their interconnections and symbolize the movement of data and power between the modules. Their painstaking arrangement on a green backdrop accentuates the relevance of each component of the system and emphasizes the requirement for perfect connections to ensure maximum performance. Also, Figure 12 presents the training of the ML models.  
Figure 11: Circuit diagram of the hardware system.