Monitoring and Automation System for Bird Feeding and Drinking Based on Internet of Things Using ESP32

. Birds are vertebrate animals characterized by feathers and wings. Their melodious sounds and colorful plumage make them a popular choice for bird breeders, which presents a promising business opportunity. Manual feeding and drinking requires farmers to feed and drink every day, which often results in delayed feeding and drinking or inconsistent dosing, causing birds to become susceptible to disease and death. Therefore, this study is intended to create an automated system for monitoring feed and drink at predetermined times utilizing the Internet of Things (IoT) concept. The system's schedule can be remotely accessed and monitored through a website, and it operates in real-time without requiring manual intervention. This allows farmers to monitor and provide birds with food and water even from a distance. The Internet of Things (IoT) system utilized in this research employs an ESP32 microcontroller as the primary controller, which connects to a Wi-Fi network. It features a servo motor designed to refill bird feeders and drinkers. Further, a mini pump is used to replenish water in the drinker based on the owner's predetermined schedule set via the application. The research concludes that the tool functions based on the input time on the website. The system sends notifications to the breeder's smartphone regarding successful feeding and drinking, with an error rate of less than 20% in system testing and over 80% accuracy in system functioning. The outcome is in the form of a tool dispensing feed and drink daily, in accordance with the breeder's specified hours.


Introduction
With the development of technology today, many activities require technology to facilitate daily work and business.One of them is the Internet of Things (IoT) technology.IoT is a computing and communication model used in everyday objects that are connected to the internet [1].IoT, or the Internet of Things, refers to objects that are able to exchange data with other objects over the internet.The IoT architecture consists of three layers: the physical layer, the transport layer, and the application layer.The physical layer is comprised of a range of devices, such as sensors and actuators, that can be controlled and manipulated remotely.The transport layer is responsible for the network layer used to transmit data and connect to servers.While the hardware layer refers to the physical components of a system, the application layer encompasses software such as apps and websites which serve as user interfaces for obtaining information and remotely controlling devices [2].With IoT, we can utilize applications that require data, automation, and control [3].IoT has consistently influenced and changed our society, such as urban areas, agriculture, animal husbandry, transportation, residential environment, and health [4].IoT plays a vital role in the real-time monitoring of livestock [5].
Birds belong to the class Aves, as determined by expert and scientific data.The global population of birds comprises approximately 9,700 species (~92% of all existing bird species) [6].Birds that are kept can basically give satisfaction to their owners because they can produce melodious sounds and colors of bird feathers [7].Many people have a hobby of breeding birds making it a promising business opportunity, ranging from small to large-scale operations [8].Regularly providing proper nutrition, feeding, and hydration is crucial in maintaining bird husbandry [9].Birds that lack of nutrients are susceptible to disease which can decrease the health state of birds and cause death [7].To solve this problem, an IoT system that can monitor bird feeding and drinking automatically with a specified time using a website is needed so that birds do not experience hunger when left by the breeder.
ESP32 is a microcontroller introduced by Espressif System Company (Shanghai, China) which is the successor of the ESP8266 microcontroller.The ESP32 features a dual-core processor, Wi-Fi and Bluetooth connectivity, general-purpose input/output (GPIO) pins, and low power consumption.ESP32 is often recognized as a metal-cased module positioned on a larger board for the addition of other components [10].The ESP32 microcontroller has gained popularity due to its technical characteristics, software support, and the ability to use multiple programming languages [11].Usually, the ESP32 microcontroller serves as the core of a range of tools to support specific applications such as real-time audio processing or Internet of Things-based systems [12].The microcontroller is affordable and includes a built-in module for WiFi and dual-mode Bluetooth, embedded within a small chip [13].
In the research conducted, the author found one farm that still feeds and drinks birds by hand.On this farm there are 2 types of cages, livestock cages and hanging cages.The livestock cage contains 2 birds and there are 2 sizes, namely 15 large cages with a size of 2m x 3m and 15 small cages with a size of 1m x 40cm, while the hanging cage contains 1 bird and there are 2 sizes, namely 7 round cages with a diameter of 60cm and 15 box cages with a size of 40cm x 40cm.The farmer manually feeds the birds every morning from 7:00 to 9:00 and supervises their feeding and drinking every afternoon at 4:00.Each bird requires 10g-15g of feed and 50ml-100ml of drinking water per day.Inconsistent dosage of food and water can lead to starvation or overfeeding of the birds, resulting in deaths that cost $10-15 million per bird.. Problems in nutrition management using manual techniques often result in human error and inconsistent feeding and drinking patterns, primarily caused by delays in managing bird feed and water [14].
In previous research [15] discussed the design of an automatic chicken farm monitoring system using Arduino Uno, this system can monitor temperature, humidity and calculate the average weight of chickens.The results of the study [15] are a circuit that is able to measure the temperature and humidity of the cage and the average weight of chickens in the cage and in this study using the Blynk application for cage control.In research [16] discusses the feed monitoring system in lovebird cages using the ESP8266 microcontroller.The system designed in research [16] can provide automatic feed remotely using the Blynk application.From research [15], [16] can be developed by adding features of automatic animal feeding and drinking and the system can be monitored using a website so that it can be opened using several devices to make it easier for farmers to monitor livestock.
To develop the system, Monitoring and Automation System for Bird Feeding and Drinking Based on Internet of Things using ESP32, was using ESP32 as the main controller.Bird owners can input the time of feeding and drinking using the website, which can be accessed by multiple devices facilitating monitoring of the coop.The data will be sent to the firebase database to be seen by the microcontroller and give commands to the servo motor which is the driving force to fill the bird feeders and in the bird drinking place.A mini pump has been provided to channel water from the water storage to the bird drinking container.The HC-SR04 ultrasonic sensor detects the availability of feed and water in the bird's feed and water supplies.Additionally, a DHT22 sensor measures the temperature and humidity of the bird cage.The ESP32 microcontroller camera serves as a real-time camera sensor to monitor the bird's feed and drink place.This system must be connected via a Wi-Fi network to function properly.All schedules for bird feeding and drinking will be automatically uploaded to the Firebase database for display on the website.

Methods
In this research, there are research stages which are divided into several stages, namely identifying problems, literature study, observation and determination of case studies, data collection, system design, tool assembly, testing, and evaluation and conclusions.

Figure 1. System Block Diagram
In Figure 1, the circuit can be explained as follows, the ESP32 microcontroller functions as the main control that can carry out pre-programmed instructions both in processing data, reading sensors, and moving sensors.The Servo Motor will open and close the bird feed container door.Ultrasonic Sensor serves to control the height of feed and water in the bird feed and drinking water supply.Relay module serves to connect electric current to the water pump so that the water pump can run.DC Water Pump will suck the water in the water supply and then flowed to the minimal place of the bird.DHT22 sensor serves to measure temperature and humidity in bird cages.ESP32 Camera functions as a camera that can monitor the condition of the bird cage directly and in real-time.The website is used for inputting and monitoring the bird's feed and drink schedule.Firebase serves for data storage on the system.12V adapter serves to convert AC current into DC current.

Figure 2. System Workflow Diagram
Figure 2 is the workflow of the monitoring system when the farmer (user) inputs a bird feeding and drinking schedule containing the dose and time of bird feeding and drinking.After the data is inputted and sent to firebase to be stored, it is displayed on the schedule input page and sent to the microcontroller.On the microcontroller there is a real-time clock API that will synchronize with the time that has been inputted on the website.The microcontroller also adjusts the feed and drink doses according to what is inputted, then sends a signal to the servo motor and water pump to remove the bird feed and drink.After removing the feed and drink, the sensor will send a data report to the microcontroller, continued to Firebase and then displayed on the website.In the feed and water supply, the ultrasonic sensor will measure the availability of bird feed and water and send it to the microcontroller, continued to Firebase and displayed on the website.In the camera sensor, a webcam will appear on the website and user's mobile phone the condition of the bird feed and drink directly and in real-time, and the temperature 0230308-04 sensor will calculate the temperature and humidity in the cage which will be stored on Firebase so that it can be displayed on the website.

Figure 3. Website Workflow Diagram
Figure 3 displays a flowchart available on the website.Upon opening the website, several menus are visible, including schedule, report, inventory, temperature, and camera.The user can input the bird's feeding and drinking schedule, monitor the cage's condition, and receive notifications when successfully provided feed and drink.The website was created with the use of HTML and JavaScript through Visual Studio Code, a text editor created by Microsoft for use in multiplatform operating systems [17].HTML is a markup language designed to manage the structure and content of web pages [18].JavaScript adheres to the ECMAScript standard, a high-level programming language utilizing Just-In-Time (JIT) compilation to enable users to execute code as it runs.It is also classified as a multi-paradigm programming language due to its features [19].The database used in this study is Firebase which can be stored in the Cloud in real-time [20].The research data used in this investigation pertains to livestock farming, with two distinct types of cages.There are 30 livestock cages, measuring 2m x 3m and 1m x 40cm, containing two birds each, as well as 22 hanging cages that have a round shape of 60cm and a boxy shape of 40cm x 40cm, accommodating one bird each.The livestock cages hold 31 birds altogether, comprising Blackhoroat, Canary, Murai, and Cucakrowo.Among the hanging cages, there are 13 birds -canaries and magpies.A daily intake of 10g-15g of bird feed and 50ml-100ml of water was provided for each cage.

Results and Discussion
In this research, the results are obtained in the form of a series of tools and website displays described in the results section.

Tool Set Results
The bird cage is made using bamboo wood with a size of 35cm long, 17cm wide, and 23cm high.The series of tools in the cage can be seen in Figure 4 which is made by arranging and connecting the components together so that they become a tool that can run with their respective roles, then there is a program using the Arduino IDE which is then compiled into a sketch and embedded into the ESP32 as a microcontroller system.

Schedule Input Page Result
This page is used to input the time of bird feeding and drinking and the amount of bird feed and drink that you want to issue to the bird feed and drink.The schedule input page contains a sentence of instructions for inputting the time of feeding and drinking birds and the dose of bird feed and drink, if so then click Submit.The inputted time and dose will be displayed on the website page, so that users who use this website know the time and dose that has been inputted earlier.Figure 5 shows the schedule input page.

Feeding and Drinking Equipment Testing
In this report, there are results of tests carried out to test the feasibility and minimize failure or trouble on the website and the series of tools made, to find out whether the system made has been realized and in accordance with the design and meets functionally.This test includes testing the website, firebase, and the overall tool circuit.Testing the automation of bird feeding and drinking is the main stage that must be done.This test is carried out to see whether the servo motor and water pump can run according to the inputted time.The results obtained can be seen in table 1 when the time is inputted, namely 1:36 a.m. for 1 week the feed and drink equipment comes out in real-time and it can be concluded that the inputted time data can be received properly by ESP32 and the device can run properly, it's just that during system testing there is a delay of a few seconds which is the effect of the lack of network strength between the time inputted and the feed and drink equipment to come out.When the servo and water pump conditions are dead when the Wi-Fi network is dead, the system cannot run.The calculation of the percentage error value in the study follows equation 1, where the amount of delay is divided by the number of trials performed and multiplied by 100.
(1) % Error Rate = (4/25) x 100 Error Rate = 16% The calculation of the percentage value of success in the study follows equation 2, the number of successes divided by the number of trials conducted and multiplied by 100.

0230308-06
(2) % Success Rate = (21/25) x 100 Success Rate = 84% According to the data and manual calculations, the sensor accuracy is 84%.The system operates properly when the network is stable, and ceases operations when the Wi-Fi network is deactivated.The average error is 16%, in cases where network connections are unstable, device delays may occur, typically no longer than five seconds.Following the delay, the tool resumes normal function.The data entered as shown in Figure 6 in the Firebase database contains bird data which is data inputted from the website and the data will be retrieved by the ESP32, the data is also real-time data.The data that has been inputted is also stored in the database to be displayed on the website, after the tool works the ESP32 will also send information data to the database and display it on the website page.6 is a page that contains data that has been inputted and there is a button that will go to Figure 7, which is a place to input data on bird feeding and drinking.As researchers enter hours and doses, the data enters the database and the ESP32 configures the entered time using the real-time API embedded in the ESP32.When the time is right, the servo motor starts to release the food and is continued by the water pump that sucks the water supply into the bird's drinker as shown in Figure 8.

Ultrasonic Sensor Testing
On ultrasonic sensors, testing of bird feed and drinking water supplies is carried out to find out whether sensor data can be read properly by system.On Monday at 01.36, the water in the inventory is fully filled and the status displayed is "Available" when the status is available then the notification will not appear on the breeder's smartphone and on Sunday at 09.00 the water in the inventory is reduced and the status issued is "Not Available", and a notification that the water supply has run out will be sent to the breeder's smartphone.Likewise, the feed storage is also tested when the feed has run out, there is also a status of "Not Available" and there is a notification on the farmer's smartphone, when the feed is still there, the status is "Available".The test data results can be seen in table 2. Figure 9 shows the data in the database of bird feeding and drinking supplies read by the ultrasonic sensor to the microcontroller and the data is sent to the database so that it can be displayed on the website.In Figure 10 is a notification sent by Firebase to the farmer's smartphone, when the bird's feed and water supply has run out.[16] which is a bird feeding monitoring system using the Blynk application and the previous system has been developed in this study by making the bird cage monitoring system quite complex with the addition of bird drinking features, temperature monitoring using DHT22 sensors, cage monitoring using camera sensors on the ESP32 Camera, and ultrasonic sensors as sensors that detect bird feed and drink supplies and send notifications when supplies run out.In research [16] remote control can only be used in 1 device in the Blynk application, and in research Designing Monitoring Systems and Automation of Internet of Things-Based Bird Feeding and Drinking Using ESP32 the system can be opened using several devices by opening a web page so that it makes it easier for farmers to monitor bird cages.

Conclusion
Based on the results of testing the system, it can be concluded that this research can work well in accordance with the objectives of breeders can monitor the state of bird cages through the website and can provide feed and drink remotely with the accuracy of sensors that run which is 84% and presentation error 16%.Expected specifications such as the system being able to open and close feed and drinking water through control from the website and run automatically and send data on feeding and drinking on the report data page in real-time, it's just that in this study there is still a delay of a few seconds when feeding and drinking birds, and it is recommended to use a stable internet network so that the system can run well without any delay.All sensor systems such as ultrasonic sensors can read bird feed and drink supplies properly and in real-time, DHT22 sensors can read temperature conditions in cages and camera sensors that make it easier for farmers to remotely monitor the state of the cage.Future research should consider incorporating batteries as an alternative power source, as the current tool solely relies on electric power.Additionally, integrating tools such as RTC would enable the system to continue functioning even when the WiFi network is down.Improving the connectivity would facilitate real-time monitoring.

Figure 4 . 5 .
Figure 4. Implementation on Cage Figure 5. Implementation on Website 3.1 Tool Set ResultsThe bird cage is made using bamboo wood with a size of 35cm long, 17cm wide, and 23cm high.The series of tools in the cage can be seen in Figure4which is made by arranging and connecting the components together so that they become a tool that can run with their respective roles, then there is a program using the Arduino IDE which is then compiled into a sketch and embedded into the ESP32 as a microcontroller system.3.2Schedule Input Page ResultThis page is used to input the time of bird feeding and drinking and the amount of bird feed and drink that you want to issue to the bird feed and drink.The schedule input page contains a sentence of instructions for inputting the time of feeding and drinking birds and the dose of bird feed and drink, if so then click Submit.The inputted time and dose will be displayed on the website page, so that users

Figure 6 . 7 .
Figure 6.Database Firebase Figure 7. Testing the Inputted Data Page Figure 8. Tools Testing The Input Data page as shown in Figure6is a page that contains data that has been inputted and there is a button that will go to Figure7, which is a place to input data on bird feeding and drinking.As researchers enter hours and doses, the data enters the database and the ESP32 configures the entered time using the real-time API embedded in the ESP32.When the time is right, the servo motor starts to release the food and is continued by the water pump that sucks the water supply into the bird's drinker as shown in Figure8.3.4Ultrasonic Sensor TestingOn ultrasonic sensors, testing of bird feed and drinking water supplies is carried out to find out whether sensor data can be read properly by system.On Monday at 01.36, the water in the inventory is fully filled and the status displayed is "Available" when the status is available then the notification will not appear on the breeder's smartphone and on Sunday at 09.00 the water in the inventory is reduced and the status issued is "Not Available", and a notification that the water supply has run out will be sent to the breeder's smartphone.Likewise, the feed storage is also tested when the feed has run out, there is also a status of "Not Available" and there is a notification on the farmer's smartphone, when the feed is still there, the status is "Available".The test data results can be seen in table2.Table2.Ultrasonic Sensor Testing Results on Feed and Drink Supplies

Figure 9 .
Figure 9. Feed and Drinking Supplies Database Figure 10.Smartphone Notifications In previous research[16] which is a bird feeding monitoring system using the Blynk application and the previous system has been developed in this study by making the bird cage monitoring system quite complex with the addition of bird drinking features, temperature monitoring using DHT22 sensors, cage monitoring using camera sensors on the ESP32 Camera, and ultrasonic sensors as sensors that detect bird feed and drink supplies and send notifications when supplies run out.In research[16] remote control can only be used in 1 device in the Blynk application, and in research Designing Monitoring Systems and Automation of Internet of Things-Based Bird Feeding and Drinking Using ESP32 the system can be opened using several devices by opening a web page so that it makes it easier for farmers to monitor bird cages.

Table 1 .
Testing Results of Feed and Drinking Equipment

Table 2 .
Ultrasonic Sensor Testing Results on Feed and Drink Supplies