## 3 Methodology
### IoT Systems  
By leveraging the power of the model, we seamlessly integrated the ESP32-CAM and buzzer to craft an innovative IoT system. The ESP32-CAM acted as the central hub, efficiently capturing and transmitting real-time video and image data to our network. This allows us to monitor and control devices remotely, enhancing the system's versatility. The buzzer played a vital role in providing audio feedback and alerts, enabling timely notifications for critical events. **(1) Hardware Components**  
**ESP32-CAM:** The ESP32-CAM is a highly versatile and compact development board [32], bringing together an ESP32 microcontroller module, an OV2640 Camera Module with 2 MP resolution and a small 802.11b/g/n Wi-Fi BT SoC module. This powerful combination allows for a wide range of applications, including the exciting possibility of face recognition [33] and object detection [34]. With its minimal 40 \(\times\) 27 mm footprint, the ESP32-CAM can function independently, making it an excellent choice for projects requiring a small and self-contained system. The convenience of its DIP package and features like GPIO pins and a microSD card slot further enhance its utility. Additionally, programming the ESP32-CAM is made easy using the Arduino IDE with the ESP32 core installed. **Buzzer:** A buzzer is a fundamental electronic sound-producing device that finds applications in a wide array of scenarios, such as alarms, timers, notifications and electronic games. By being driven by a DC voltage, this small PCB mountable 5V active device generates a simple, continuous and often monotonous sound. It typically consists of two positive and negative pins, allowing for straightforward integration into various circuits and systems. **Future Technology Devices International Limited (FTDI) module:** ESP32-CAM does not have a program chip. To program this board, an FTDI [35] to TTL module was used. This device handles all serial data communication to the board. Figure 3 depicts the diagram of our proposed IoT system. **(2) Hardware implementation**  
For hardware implementation, the ESP32-CAM module was used. Since the board does not have a program chip, an FTDI module was connected to the ESP32-CAM in order to program it. Figure 3 shows the pin diagram of our IoT system. A modified YOLOv8 model was trained with 2362 images. Since the ESP32-CAM module has limited memory, the model needed to be as light as possible. Therefore, the model was converted into TensorFlow (TF) Lite format and that TFLite model was converted to a C array header file in order to implement it in ESP32-CAM. Figure 4 depicts the proposed IoT system's implementation overview. Figure 3: Hardware diagram of ESP32-CAM and buzzer. The incoming frames from the ESP32-CAM are resized to 800 \(\times\) 600 pixels with JPEG pixel formatting to ensure compatibility with the trained model. After preprocessing, the frames are routed through a C array, which facilitates the detection of endangered animals within the frame. If the detection confidence is greater than 80%, the buzzer trigger is activated, activating the alarm system to notify stakeholders of the presence of an endangered animal on the farm. This procedure is repeated for every frame captured by the ESP32-CAM, with the trained model used to determine the presence of endangered animals in the scene. Recognizing that a single device might not adequately cover a vast agricultural field, the possibility of integrating multiple IoT devices is raised. Multiple autonomously operating devices would be dispersed across the field in this scenario. Any device detecting an endangered animal within its field of view would independently activate an alarm, notifying the appropriate parties of the potential threat as soon as possible. _(3) Cloud_  
**Firebase Cloud:** Firebase is a real-time cloud-hosted NoSQL database platform that Google develops [36; 37]. It lets users store and sync data in real-time across multiple end devices. Firebase also provides secure storage for content such as images and videos.