# Development of an Ultrasonic Chicken Counter

Ikyaator, M.T, Kurshav, P. A

► To cite this version:

Ikyaator, M.T, Kurshav, P. A. Development of an Ultrasonic Chicken Counter. Journal of Engineering Research and Reports, 2025, 27, pp.29 - 46. 10.9734/jerr/2025/v27i41453. hal-05003577

HAL Id: hal-05003577

https://hal.science/hal-05003577v1

Submitted on 24 Mar 2025

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
<figure><img src="image_2.png" /></figure>

# Development of an Ultrasonic Chicken Counter

IKYAATOR, M.T<sup>a*</sup> and KURSHAV, P. A<sup>a</sup>

<sup>a</sup> Department of Agricultural and Bio-systems Engineering, Joseph Sarwuan Tarka University, Makurdi, Nigeria.

## Authors' contributions

This work was carried out in collaboration between both authors. Both authors read and approved the final manuscript.

## Article Information

DOI: https://doi.org/10.9734/jerr/2025/v27i41453

**Open Peer Review History:**

This journal follows the Advanced Open Peer Review policy. Identity of the Reviewers, Editor(s) and additional Reviewers, peer review comments, different versions of the manuscript, comments of the editors, etc are available here:

https://pr.sdiarticle5.com/review-history/132690

Received: 14/01/2025

Accepted: 18/03/2025

Published: 22/03/2025

### Original Research Article

## ABSTRACT

In the context of mechanized poultry management, efficient and accurate chicken counting systems are essential in tracking inventory, performance management and optimizing operations. Modern counting techniques, such as image analysis, present limitations due to high costs and technical demands and the traditional or crude methods of counting are time consuming and involve drudgery. This project focuses on modifying and evaluating a prototype ultrasonic chicken counter for chain conveyor applications. Using ultrasonic sensors, positioned at entry and exit points, the study sought to optimize counting speed, efficiency, and accuracy across varied conveyor speeds. Performance evaluation conducted at speeds of 10 cm/s, 20 cm/s, and 30 cm/s revealed that lower speeds yielded higher accuracy, with the device achieving up to 98.67% accuracy at 10 cm/s and experiencing increased errors as speed rose. Notably, systematic errors averaged 1.33% at 10 cm/s but increased to 12.67% at 30 cm/s. These findings demonstrate the suitability of ultrasonic sensors for cost-effective and reliable counting in poultry farms when operated within specified speed ranges. The study concludes that the modified ultrasonic counter provides a practical solution for small- and medium-scale poultry operations, where reduced conveyor speeds can maximize accuracy while offering insights into developing low-cost automated counting solutions that address operational challenges in the poultry industry.

<footnote>*Corresponding author: Email: ikyaator.michael@uam.edu.ng;</footnote>
Keywords: Ultrasonic sensors; automated poultry monitoring; chicken counting system; sensor-based livestock tracking.

# 1. INTRODUCTION

A crucial part of contemporary farm management is counting chickens on a daily basis. Throughout the breeding phase, the number of chicks fluctuates a lot (Zhu *et al.*, 2022). The precise counting of chicken is essential for the effective management of poultry farms due to the high demand for chicken products. This is because it allows farmers to maintain inventory, monitor production levels, and optimize feed and water use. Over the years, many scholars have developed a number of technologies to help farmers precisely and efficiently count and record data in order to manage and control the production of chickens.

In a smart farm setting, counting chickens poses a variety of difficulties that call for various strategies to solve (Khanal, et al., 2024). Zhu et al. (2022), developed an automated approach for counting chickens by building a dataset and utilizing the YOLO-v5x algorithm. The average accuracy and inference time of the suggested approach for counting chickens were 95.87% and 23 ms per image, respectively, meeting the demands of real-world farming applications. A novel method for counting hens in smart farm environments was suggested and evaluated by Khanal, et al. (2024) by utilizing a Deep Learning (DL) methodology based on transformer architecture. The two primary parts of the suggested approach were a multi-scale regression head and a Pyramid Vision Transformer (PVT) backbone, together with a specially designed loss function that includes curriculum loss. Cronin et al. (2008) developed a VIA (video image analysis) prototype that could automatically perform two common tasks -- that of counting the number of hens per cage and scanning the egg collection belt to identify foreign (non-egg) objects. Li et al. (2018) also designed and constructed a Lighting Preference Test System (LPTS) for laying hens to determine the real time hen numbers in each compartment. The system consisted of five compartments (connected in tandem) with a passing door for the test birds to pass between compartments. The LPTS incorporated a variety of sensors that allowed automated data collection and monitoring with less human involvement. Two algorithms, by image analysis and by hen weight, were developed to determine the number of hens in the LPTS compartment. Montalban and

Lumauag (2023) using an Arduino microcontroller, and a robotic arm integrated with a conveyor, created a microcontroller device that does image processing based on an algorithm for sorting and counting chicken eggs. Bernardo et al., (2023) developed an automated Chick Counting machine with Mechatronics to decrease counting errors, increase counting speed, and take chick welfare into account. At various linear belt speeds, the machine's performance was assessed in terms of its theoretical capacity, actual capacity, machine efficiency, power consumption, accuracy, and precision. A system for counting ducklings on a conveyor belt using ultrasonic sensors was created by Zeng et al., (2019). The study discovered that regardless of the ducklings' size or color, the system could precisely count the number of ducklings moving through the conveyor.

Despite the fact that research on chicken counting in agriculture has advanced significantly, there is no mention of any research on ultrasonic chicken counting. It wasn't until 2023 that researchers in the Department of Agricultural and Biosystems Engineering, Joseph Sarwuan Tarka University (Formerly Federal University of Agriculture, Makurdi) started the development of a prototype Ultrasonic chicken counter for a chain conveyor. The objective of this work is to evaluate and analyze the operating performance of the ultrasonic chicken counter across different counting speeds.

## 1.1 Performance Review of Object/Poultry Counters

Infrared counters, ultrasonic counters, IR-UWBrader counters, Bag of Features (BOF) model counters, image processing and counting, automated counting in surveillance camera environments, and computer vision systems are among the most common counters that can be used in poultry (Okinda, 2018, Cao et al., 2021).

The performance (accuracy and precision) of infrared sensors in various situations has been the subject of some recent investigations. When used outside, studies have shown a systematic undercounting error that can range from 0 to -25% depending on the object's volume and the weather (Greene-Roese et al., 2008). Thermal sensors have been mounted above entryways to count people entering and exiting key locations.
Ozbay *et al.* (2010) tested a thermal sensor on trails and compared the results with that of an infrared sensor. The authors reported mean percentage errors ranging from -15% to 1% for the thermal sensor, which was considerably lower than the errors ranging between -28% and 0% for the infrared sensor.

Yusuf *et al.* (2020) carried out a sensitivity and accuracy test on a pulse infrared counter and recorded 100% sensitivity and 95% accuracy using the following formulas

$$Se = \frac{N_R}{N_R+N_U} \times 100\% \quad (1)$$

$$Acc = \frac{N_R}{N_R+N_u+N_w} \times 100\% \quad (2)$$

Where; Se = sensitivity,

Acc = Accuracy

$N_R$ = Number of times the system responded

$N_U$ = Number of undetected inputs

$N_w$ = Number of wrong detections

In a performance test conducted by Mullapudi (2020) on an Arduino based infrared visitor counter, the system was evaluated in five scenarios with results obtained presented in Table 1. Wang *et al.* (2020) investigated the use of ultrasonic sensors for object counting on a conveyor belt. They installed ultrasonic sensors above the conveyor belt to detect the presence of objects. The results showed that the ultrasonic sensor system was able to accurately count the objects with minimal errors. They also evaluated the system's performance under different conveyor speeds and found that the system was able to maintain 100% accuracy at speeds up to 1.5 m/s.

<table><caption>Table 1. Performance test results of an arduino based IR counter</caption><thead><tr><td>Scenarios Tested</td><td>Accuracy</td></tr></thead><tbody><tr><td>One person entering the room</td><td>86.66%</td></tr><tr><td>One person leaving the room</td><td>86.66%</td></tr><tr><td>Two persons entering the room at the same</td><td>93.33%</td></tr><tr><td>Two persons entering the room at the same</td><td>93.33%</td></tr><tr><td>One person entering and other person leaving the room at the same time</td><td>0%</td></tr></tbody></table>

Source: Mullapudi (2020)

## 2. MATERIALS AND METHODS

The ultrasonic chicken counter system has sub-units. These subunits are made of some components with each having their individual specifications.

### 2.1 Materials

#### 2.1.1 The arduino-uno board

The Arduino-Uno is an open source and programmable microcontroller board developed as a simplified version of arduino mega 328. The board has mainly 14 digital input/output pins, analog pins which can be programmable by using arduino IDE (Integrated Development Environment). It can be programmed by simple C/C++ programming by connecting with type B USB cable. It accepts voltage between 7 - 20 volts by connecting it with a power source. The clock speed of the board is 16MHz and SRAM capacity is 2KB. The clear details of configurations and technical specifications can be obtained from the official arduino website: https://store.Arduino.cc/usa/Arduino-uno-rev3. Arduino's cost-effectiveness, flexibility/ease of operation, as well as compatibility (Etim, 2010) with most operating systems makes it a preferred choice for our solution. Fig. 1 and Table 2 shows the pins description of an Arduino UNO and the Arduino uno board composition respectively.

#### 2.1.2 Liquid Crystal Display (LCD)

The LCD is a solid-state device that uses liquid crystals to modulate light (Fig. 2). It can be either a computerized visual display or a display screen. Liquid Crystal Display also called LCD is very helpful in providing user interface as well as for debugging purposes. LCDs do not emit light directly, so they can be used to display any image (as in a general-purpose computer display) (Cellan-Jones, 2011). The most common type of LCD controller is HITACHI 44780 which provides a simple interface between the controller & an LCD. These LCD's are very simple to interface with the controller, and are also cost effective (Etim, 2010).

This design makes use of a "2x 16" LCD. It has input ports D0, D1, D2, D3, D4, D5, D6, D7, a cathode "K," anode "A," allow "E," reset "R/S," read & write "R/W," as well as a Vdd supply pin, a variable resistor pin for setting the LCD contrast, and ground Vss. The liquid crystal display is used to view the unit's status. When
RS is low (0), the data is to be treated as a command. When RS is high (1), the data being sent is considered as text data which should be displayed on the screen. When R/W is low (0), the information on the data bus is being written to the LCD. When RW is high (1), the program is effectively reading from the LCD. Most of the time there is no need to read from the LCD so

this line can directly be connected to Gnd thus saving one controller line. The ENABLE pin is used to latch the data present on the data pins. A HIGH - LOW signal is required to latch the data. The LCD interprets and executes our command at the instant the EN line is brought low. Table 3 describes the pin functions of a 16x2 liquid crystal display.

## Arduino UNO pin Diagram

<figure><img src="image_3.png" /><figcaption>Fig. 1. Pins description of Arduino UNO board</figcaption></figure>

Source: https://hackaday.io/project/176077

<table><caption>Table 2. Arduino uno board composition</caption><thead><tr><td>Component</td><td>Function</td></tr></thead><tbody><tr><td>Reset Button</td><td>This will restart any code on the Arduino board</td></tr><tr><td>AREF(Analog Reference)</td><td>Used to set an external reference voltage</td></tr><tr><td>GND (Ground pin)</td><td></td></tr><tr><td>Digital Input/Output</td><td>Pin 0-13 can be used for digital input or output</td></tr><tr><td>PWM or (~)</td><td>Can simulate analog output</td></tr><tr><td>USB Connection</td><td>For powering up Arduino and uploading sketches</td></tr><tr><td>TX/RX</td><td>Transmit and receive data indication LEDs</td></tr><tr><td>ATmega Microcontroller</td><td>Stores and controls the written programs</td></tr><tr><td>Power LED Indicator</td><td>lights up when the board is plugged in a power source</td></tr><tr><td>Voltage Regulator</td><td>Controls the amount of voltage supplied to the board</td></tr><tr><td>DC Power Barrel Jack</td><td>Used for powering the Arduino with a power supply</td></tr><tr><td>3.3V Pin</td><td>This pin supplies 3.3 volts of power to the projects</td></tr><tr><td>5V Pin</td><td>This pin supplies 5 volts of power to your projects</td></tr><tr><td>Ground Pins</td><td></td></tr><tr><td>Analog Pins</td><td>Convert analog signals to digital</td></tr></tbody></table>

Source: Okolo et al. (2022)
<figure><img src="image_4.png" /><figcaption>Fig. 2. LCD Device</figcaption></figure>

Source: Nerd (2020)

<table><caption>Table 3. Pin functions of a 16x2 Liquid Crystal Display (LCD)</caption><thead><tr><td>Pin</td><td>Symbol</td><td>Functions</td></tr></thead><tbody><tr><td>1</td><td>Vss</td><td>Ground</td></tr><tr><td>2</td><td>Vdd</td><td>Supply Voltage</td></tr><tr><td>3</td><td>Vo</td><td>Contrast Setting</td></tr><tr><td>4</td><td>RS</td><td>Register Select</td></tr><tr><td>5</td><td>R/W</td><td>Read/Write Select</td></tr><tr><td>6</td><td>En</td><td>Chip Enable Signal</td></tr><tr><td>7-14</td><td>DB0-DB7</td><td>Data Lines</td></tr><tr><td>15</td><td>A/Vee</td><td>Gnd for the backlight</td></tr><tr><td>16</td><td>K Vcc</td><td>For backlight</td></tr></tbody></table>

Source: Nerd (2020)

<table><caption>Table 4. Battery specification</caption><thead><tr><td>No</td><td>Item</td><td>Specifications</td><td>Remarks</td></tr></thead><tbody><tr><td>1</td><td>Nominal Capacity</td><td>5Ah ± 5%</td><td>0.05C20A discharge, 25°C</td></tr><tr><td>2</td><td>Nominal Voltage</td><td>12.8V</td><td>0CV</td></tr><tr><td>3</td><td>Charge Current</td><td>Standard: 0.2 C20A: Max: 0.5C20A</td><td>Working temperature: 0~45°C</td></tr><tr><td>4</td><td>Charge Cut-Off Voltage</td><td>15.2 ± 0.05V</td><td></td></tr><tr><td>5</td><td>Discharge Current</td><td>Standard: 0.05 C5A: Max: 2 C5A</td><td>Working temperature: 25°C</td></tr><tr><td>6</td><td>Discharge Cut-Off Voltage</td><td>9.6V</td><td></td></tr><tr><td>7</td><td>Voltage</td><td>12.8~13.6V</td><td>Shipment Status</td></tr><tr><td>8</td><td>Impedance</td><td>≤50mΩ</td><td>50% SOC at 25°C</td></tr><tr><td>9</td><td>Weight</td><td>Approx:0.67kg</td><td></td></tr><tr><td>10</td><td>Dimension (mm)</td><td>90x70x101</td><td>Approx.</td></tr></tbody></table>

Source: Obah (2021)

### 2.1.3 Power Supply Unit (Battery)

This supplies the power needed for the circuit to run. This unit comprises the Polymer Lithium Battery. The lithium iron phosphate battery (LiFePO battery) or lithium ferro phosphate battery (LFP battery) is a type of rechargeable battery that uses LiFePO as the cathode material and a graphitic carbon electrode with a metallic backing as the anode. LiFePO has a greater specific capacity than the related lithium cobalt oxide (LiCoO) chemistry, but it has a lower energy density due to its lower operating voltage. LiFePO's primary disadvantage is its low electrical conductivity. Due to low costs, low

toxicity, excellent performance, long-term stability, etc. LiFePO is being used in cars, utility-scale stationary applications, and backup generators. The battery has a working voltage of 12 V which is enough to power the whole system (Obah, 2021). The battery specification is found in Table 4.

### 2.1.4 Ultrasonic sensor

Short and high-frequency signals are emitted by the ultrasonic sensor. These signals travel at the speed of sound in the air. It can bounce back to the module if it encounters an object or obstacle on its way. The multi-vibrator that makes up the
ultrasonic sensor is connected to the base (Saleh, 2019). The multi-vibrator is a combination of resonator and vibrator. An ultrasonic wave generated by the vibration is supplied by the resonator. Actually, the ultrasonic sensor is made up of two parts; the emitter that generates a 40 kHz sound wave and a 40 kHz sound wave detector that sends an electrical signal back to the Arduino microcontroller. Fig. 3a is a figure of a HC-SR04 ultrasonic module. As seen in Fig. 3b, the ultrasonic sensor sends out sound waves and receives sound that is reflected off of an object. Diffuse reflection occurs over a broad solid angle, potentially reaching 180 degrees, when ultrasonic waves strike an object (Vidhya et

al., 2016). Ground, VCC, trig, and echo are the four pins on the HC-SR04 ultrasonic module used in this project.

The module's Ground and VCC pins should be connected to the ground and 5 volts pins on the power supply, and the trig and echo pins should be connected to any digital I/O pin on the Atmega382 microcontroller. Set the Trig to a High State for 10 µs to produce the ultrasound, as shown in Fig. 4. This will generate an 8-cycle sonic burst that will travel at the speed of sound and be received by the Echo pin. The Echo pin will output the time it took for sound waves to travel in microseconds (Etim 2010).

<figure><img src="image_5.png" /><figcaption>Fig. 3a. Pin layout of ultrasonic sensor</figcaption></figure>

Source: Gopi and Dimple (2020)

<figure><img src="image_6.png" /><figcaption>Fig. 3b. Working of ultrasonic sensor</figcaption></figure>

Source: Gopi and Dimple (2020)
<figure><img src="image_7.png" /><figcaption>Fig. 4. HC-SR04 timing diagram</figcaption></figure>

Source: Etim (2010)

## 2.2 Methodology

The methodology implemented is divided into software and hardware methods. The software methods involved a simulation of the project using Proteus 8.6 and Arduino IDE while the hardware involved soldering/interfacing the components and casing.

### 2.2.1 Circuit development/simulation of the counter

The simulation as shown in Fig. 5 represents an Arduino-based counting system that utilizes ultrasonic sensors and an LCD display. This system is designed to count chickens entering or exiting a designated area, by detecting their movement using two ultrasonic sensors. The setup ensures accurate tracking of entries and exits, which can be useful in poultry management.

At the heart of the system is the Arduino Uno, which serves as the microcontroller responsible for processing data from the ultrasonic sensors and displaying results on the LCD screen. The Arduino is programmed to read input signals from the sensors, compute distance values, and determine whether an object has crossed the counting threshold. The results are then shown

on the LCD, allowing real-time monitoring of the count. The system includes two ultrasonic sensors (HC-SR04), each responsible for detecting motion in a specific direction. These sensors work based on the time-of-flight principle, where an ultrasonic pulse is emitted and the time taken for its echo to return is measured. The sensors are connected to the Arduino through four pins: VCC (Power, 5V), GND (Ground), Trig (Trigger Pin), and Echo (Echo Pin). The Arduino sends a pulse via the Trig pin, and the Echo pin receives the reflected pulse. By calculating the time delay, the Arduino determines the distance of an object from the sensor. If an object crosses between the two sensors within a predefined distance threshold, it is counted as either an entry or an exit.

To display the results, the system uses a 16x2 I2C LCD display, which simplifies wiring by requiring only two communication lines: SDA (Serial Data) and SCL (Serial Clock). The LCD provides a user-friendly interface to monitor the count in real-time. The I2C interface allows efficient communication between the Arduino and the display, reducing the number of required pins. The LCD is powered by the Arduino's VCC (5V) and GND connections. The working principle of this system involves continuous monitoring of distance data from the ultrasonic
sensors. When an object moves past the sensors within a specific range, the Arduino determines whether it corresponds to an entry or exit. Based on the movement direction, the count is updated accordingly and displayed on the LCD.

### 2.2.2 Program development

#### Arduino IDE

The IDE (Integrated Development Environment) is a computer program that enables you to write sketches for the Arduino board in a plain language modeled after the processing (www.processing.org) language. It is designed to introduce artists and other newcomers to software development programming. It comes with a code editor that includes features like syntax highlighting, brace matching, and automatic indentation, as well as the ability to compile and upload programs to the board with a

single click. A sketch is a program or code written for Arduino. C or C++ is used to write Arduino programs. The Arduino IDE includes the "Wiring" software library from the original Wiring project, which simplifies many common input/output operations. The Arduino programming language has a simple structure and is divided into at least two parts; void setup() and void loop() statements. Blocks of statements are enclosed by these two necessary components or functions. The program can't run without both functions. The setup function should come after any variable declaration at the start of the program. It is the first function in the program, and it is used to set pin Mode or initialize serial communication. It only runs once. The loop function comes next, and it contains the code that will be run repeatedly - reading inputs, triggering outputs, and so on. This function is at the heart of every Arduino program and is responsible for the majority of the work.

<figure><img src="image_8.png" /><figcaption>Fig. 5. Circuit diagram of the counter</figcaption></figure>
For this project, C++ programming language is used to write the system program. The preparation symbol which is the “START” begins the programming process. The system is then initialized, connecting the various units of the circuit. After this, the status of the ultrasonic sensor is checked to know the state of the device. Then a decision is made; if there is an object at the range of the ultrasonic sensor, it displays on the LCD and the process is repeated as shown in Fig. 6.

To implement this system in the Arduino IDE, several libraries are required. The NewPing.h library is used in this project to facilitate ultrasonic sensor operation, simplifying distance measurement and reducing errors. The LiquidCrystal_I2C.h library enables communication with the LCD screen via the I2C protocol, allowing the display of counted values in a structured format. These libraries ensure efficient and reliable performance of the counting system.

<figure><img src="image_9.png" /><figcaption>Fig. 6. Counter flow chart loop</figcaption></figure>
### 2.2.3 Device components interface

Fig. 7 represents an automated chicken counting system that uses ultrasonic sensors and an LCD display, all controlled by an Arduino Uno microcontroller. The entire system is powered by a battery pack, which provides a regulated 5V supply to the Arduino Uno. The battery serves as an independent power source, making the system portable and suitable for use in poultry farms without a stable electricity supply. The device components interface is as thus:

The positive terminal (+) of the battery is connected to the V-in pin of the Arduino Uno. This allows the Arduino's internal voltage regulator to manage power distribution. The negative terminal (-) of the battery is connected to the GND pin of the Arduino, completing the circuit. From the Arduino, power is distributed to the other components. The 5V pin on the Arduino supplies power to both ultrasonic sensors (US1 and US2) and the LCD module. The GND pin on the Arduino is connected to the GND pins of the ultrasonic sensors and LCD module, ensuring a common ground reference. This power setup allows the entire system to operate reliably, with the battery ensuring uninterrupted functionality even in areas with limited electricity access.

The system utilizes two HC-SR04 ultrasonic sensors to detect and count chickens. Each sensor has four pins: VCC, GND, Trigger (Trig), and Echo. The Trigger pin sends out an ultrasonic sound wave, and the Echo pin receives the reflected wave to determine if a chicken is passing through.

For the entry sensor (US1):

The Trigger pin is connected to Digital Pin D7 on the Arduino while the Echo pin is connected to Digital Pin D6.

For the exit sensor (US2):

The Trigger pin is connected to Digital Pin D9 while the Echo pin is connected to Digital Pin D8.

These connections allow the Arduino to send trigger signals to the ultrasonic sensors and receive distance measurements via the Echo pins. By analyzing which sensor detects movement, the system determines whether a chicken is entering or exiting.

The 16x2 LCD display is used to visually display the real-time chicken count. To simplify communication, the display is equipped with an I2C module, reducing the number of required connections. Instead of using multiple digital pins, only two data lines (SDA and SCL) are required. The LCD has four connection pins: VCC, GND, SDA (Serial Data Line), and SCL (Serial Clock Line). The connections are as follows:

* SDA (Serial Data Line) is connected to Analog Pin A4 on the Arduino while

* SCL (Serial Clock Line) is connected to Analog Pin A5.

These connections allow the Arduino to transmit data to the LCD efficiently using the I2C communication protocol, ensuring fast and reliable updates to the display.

### 2.2.4 Casing and packaging

The importance of casing a circuit is to prevent it from distortion from external harm. The casing is made of plastics with dimensions 8cm x 8cm x 4cm. Then holes are perforated to enable cooling. Figs. 8, 9 and 10, give a representation of the Counter when initializing, counting and the position of the ultrasonic sensors respectively.

### 2.2.5 Testing and performance evaluation of the chicken counter

The performance efficiency of the counter was tested based on its accuracy and its percentage systematic error. The values of the actual number of chicken passed and the number of chickens counted by the counter was obtained and the accuracy, systematic percentage error in the count and the sensitivity of the device was calculated at different conveyor speeds of 10cm/s, 20cm/s and 30cm/s. The following formulae were used.

$$ \% error = \frac{c_c - c_A}{c_A} \times 100 \quad (\text{Indeed Editorial Team, 2023}). \quad (3) $$

$$ A = 100\% - |\% error| \quad (\text{Cuemaths, 2022}). \quad (4) $$

Where % error is the percentage systematic error of the counter,

$c_c$ is the number of chickens counted by the counter,

$c_A$ is the actual number of chickens and,

A is the accuracy of the counter.
<figure><img src="image_10.png" /><figcaption>Fig. 7. Components interface of the counter</figcaption></figure>

<figure><img src="image_11.png" /><figcaption>Fig. 8. Initialization state of the counter</figcaption></figure>
<figure><img src="image_12.png" /><figcaption>Fig. 9. Counter display during counting</figcaption></figure>

<figure><img src="image_13.png" /><figcaption>Fig. 10. Ultrasonic Sensors Positioned at Entry and Exit</figcaption></figure>
# 3. RESULTS AND DISCUSSION

## 3.1 Results

The results of the testing and performance evaluation of the ultrasonic chicken counter are presented in Tables 5, 6 and 7. Table 5 shows the collected data for the number of chickens passed, number of chickens that were counted and the number of undetected chickens for the various conveyor speeds. These values were analyzed using One-way ANOVA (Table 6) and the estimated percentage error and accuracy of the ultrasonic counter in Table 7. Table 8 shows the summary of the average mean of both performance indices. Figs. 11 and 12 are the mean plots for Entry and exit sensors respectively.

## 3.2 Discussion

### 3.2.1 Analysis of passed, counted and undetected chickens by the counter

Table 5 shows the observed data of the counter in respect to the number of chickens passed, counted, and undetected at 3 different conveyor speeds. For each speed, a total number of 50 chickens were passed and each counting level had its specific number of counted chickens. At a speed of 10cm/s, two rounds of the entry sensors

were observed to have counted more than the stated number of chickens passed and this was because the counter is programmed to recount at half second and because the speed was slow, some chickens didn't pass before the set time and were double counted. With conveyor speeds of 20cm/s, two rounds of the entry sensor counted less while the exit sensor counted more and less at the 2nd and 3rd rounds respectively and this was as a result of the increase in speed. At 30cm/s counting rounds, the counting device didn't count as much as it was supposed to and this was as a result of the increase in the speed of the conveyor system and this shows that an increase in speed could alter the readings of the system.

### 3.2.2 Analysis of results at three different speeds

Table 6 shows the analysis of results at three different conveyor Speeds. The analysis indicates substantial differences in means for both the entry sensor (Ec) and the exit sensor (Exc) across the speed groups. Specifically, as the Speed value increases, the means for both Ec and Exc tend to decrease significantly, particularly evident at the speed of 30 cm/s. Figs. 11 and 12 also shows the reduction in the means due to increase in speed.

<table><caption>Table 5. Results of counter at 3 different conveyor speeds</caption><thead><tr><th>Speed (cm/s)</th><th>Replication</th><th>1<sup>st</sup></th><th>2<sup>nd</sup></th><th>3<sup>rd</sup></th></tr></thead><tbody><tr><td rowspan="5">10</td><td>Np</td><td>50</td><td>50</td><td>50</td></tr><tr><td>Ec</td><td>51</td><td>51</td><td>50</td></tr><tr><td>Exc</td><td>50</td><td>50</td><td>50</td></tr><tr><td>Nu<sub>1</sub></td><td>0</td><td>0</td><td>0</td></tr><tr><td>Nu<sub>2</sub></td><td>0</td><td>0</td><td>0</td></tr><tr><td rowspan="5">20</td><td>Np</td><td>50</td><td>50</td><td>50</td></tr><tr><td>Ec</td><td>49</td><td>50</td><td>48</td></tr><tr><td>Exc</td><td>50</td><td>51</td><td>49</td></tr><tr><td>Nu<sub>1</sub></td><td>1</td><td>0</td><td>2</td></tr><tr><td>Nu<sub>2</sub></td><td>0</td><td>0</td><td>1</td></tr><tr><td rowspan="5">30</td><td>Np</td><td>50</td><td>50</td><td>50</td></tr><tr><td>Ec</td><td>46</td><td>42</td><td>43</td></tr><tr><td>Exc</td><td>46</td><td>47</td><td>45</td></tr><tr><td>Nu<sub>1</sub></td><td>4</td><td>8</td><td>7</td></tr><tr><td>Nu<sub>2</sub></td><td>4</td><td>3</td><td>5</td></tr></tbody></table>

N<sub>P</sub> = No. of Chickens Passed; Ec = Entry Count; Exc = Exit Count; Nu<sub>1</sub> = No. of Undetected Chickens for Entry; Nu<sub>2</sub> = No. of Undetected Chickens for Exit
<table><caption>Table 6. Analysis of results at three different speeds</caption><thead><tr><th rowspan="2"></th><th rowspan="2">N</th><th rowspan="2">Mean</th><th rowspan="2">Std. Deviation</th><th rowspan="2">Std. Error</th><th colspan="2">95% Confidence Interval for Mean</th></tr><tr><th>Lower Bound</th><th>Upper Bound</th></tr></thead><tbody><tr><td rowspan="3">Ec</td><td>10.00</td><td>3</td><td>50.6667</td><td>.57735</td><td>.33333</td><td>49.2324</td><td>52.1009</td></tr><tr><td>20.00</td><td>3</td><td>49.0000</td><td>1.00000</td><td>.57735</td><td>46.5159</td><td>51.4841</td></tr><tr><td>30.00</td><td>3</td><td>43.6667</td><td>2.08167</td><td>1.20185</td><td>38.4955</td><td>48.8378</td></tr><tr><td rowspan="3">Exc</td><td>Total</td><td>9</td><td>47.7778</td><td>3.38296</td><td>1.12765</td><td>45.1774</td><td>50.3782</td></tr><tr><td>10.00</td><td>3</td><td>50.6667</td><td>1.15470</td><td>.66667</td><td>47.7982</td><td>53.5351</td></tr><tr><td>20.00</td><td>3</td><td>50.0000</td><td>1.00000</td><td>.57735</td><td>47.5159</td><td>52.4841</td></tr><tr><td rowspan="3"></td><td>30.00</td><td>3</td><td>46.0000</td><td>1.00000</td><td>.57735</td><td>43.5159</td><td>48.4841</td></tr><tr><td>Total</td><td>9</td><td>48.8889</td><td>2.36878</td><td>.78959</td><td>47.0681</td><td>50.7097</td></tr></tbody></table>

Ec = Entry Count; Exc = Exit Count

<figure><img src="image_14.png" /><figcaption>Fig. 11. Mean plot for entry sensor</figcaption></figure>

<table><caption>Table 7. Performance evaluation of counter at 3 different speeds</caption><thead><tr><th rowspan="2">Speed (cm/s)</th><th rowspan="2">Rep</th><th colspan="2">S<sub>E</sub> (%)</th><th colspan="2">A<sub>C</sub> (%)</th></tr><tr><th>Ec</th><th>Exc</th><th>Ec</th><th>Exc</th></tr></thead><tbody><tr><td rowspan="3">10</td><td>1<sup>st</sup></td><td>2</td><td>0</td><td>98</td><td>100</td></tr><tr><td>2<sup>nd</sup></td><td>2</td><td>0</td><td>98</td><td>100</td></tr><tr><td>3<sup>rd</sup></td><td>0</td><td>4</td><td>100</td><td>96</td></tr><tr><td></td><td>Mean</td><td>1.33</td><td>1.33</td><td>98.67</td><td>98.67</td></tr><tr><td rowspan="3">20</td><td>1<sup>st</sup></td><td>2</td><td>0</td><td>98</td><td>100</td></tr><tr><td>2<sup>nd</sup></td><td>0</td><td>2</td><td>100</td><td>98</td></tr><tr><td>3<sup>rd</sup></td><td>4</td><td>2</td><td>96</td><td>98</td></tr><tr><td></td><td>Mean</td><td>2.00</td><td>1.33</td><td>98</td><td>98.67</td></tr><tr><td rowspan="3">30</td><td>1<sup>st</sup></td><td>8</td><td>8</td><td>92</td><td>92</td></tr><tr><td>2<sup>nd</sup></td><td>16</td><td>6</td><td>84</td><td>94</td></tr><tr><td>3<sup>rd</sup></td><td>14</td><td>10</td><td>86</td><td>90</td></tr><tr><td></td><td>Mean</td><td>12.67</td><td>8.00</td><td>87.33</td><td>92.00</td></tr></tbody></table>

Ec = Entry Count; Exc = Exit Count
<figure><img src="image_15.png" /><figcaption>Fig. 12. Mean plot for exit sensor</figcaption></figure>

<table><caption>Table 8. Summary of mean effect of conveyor speed on the counter performance</caption><thead><tr><th>Parameter</th><th></th><th colspan="3">Conveyor speed level (cm/s)</th></tr></thead><tbody><tr><td rowspan="3">Error (%)</td><td>Ec</td><td>10</td><td>20</td><td>30</td></tr><tr><td>Exc</td><td>1.33</td><td>2.00</td><td>12.67</td></tr><tr><td></td><td>1.33</td><td>1.33</td><td>8.00</td></tr><tr><td rowspan="2">Accuracy (%)</td><td>Ec</td><td>98.67</td><td>98</td><td>87.33</td></tr><tr><td>Exc</td><td>98.67</td><td>98.67</td><td>92</td></tr></tbody></table>

$$Ec = \text{Entry Count}; Exc = \text{Exit Count}$$

### 3.2.3 Systematic error (%)

Table 7 presents different mean systematic errors for the two sensors at various conveyor speeds (10cm/s, 20cm/s and 30cm/s). At a speed of 30cm/s, the highest systematic error was observed to be 12.67%. The lowest systematic error was found to be at a speed of 10cm/s which gained an average of 1.33% of systematic error. This goes in line with the research carried out by Shafique et al. (2019). Overall, the result suggests an increase in systematic error at a relatively high conveyor speed; therefore, the efficiency of the chicken counting device is dependent on the increase or decrease in the conveyor speed.

### 3.2.4 Accuracy of the counting device (%)

Table 8 also presents the calculated results for the accuracy of the counter in respect to the various speeds used in the performance evaluation (10cm/s, 20cm/s and 30cm/s). It was observed that at a conveyor speed of 10cm/s, both the entry and exit sensors had the highest efficiency of 98.67%. Also, the lowest efficiency was determined to be 87.33% and 92% for the entry and exit sensors respectively after evaluation at a conveyor speed of 30cm/s. This aligns closely with observations by Wang et al. (2020) reporting higher accuracy and lower errors were recorded at low speeds. In addition to these, it was
also observed that the efficiency of the
counter depends on the number of chickens
the conveyor can allow to pass by the
sensors per second (Accurate Chicken
Counting in Smart Farm Environments,
2024).

4. CONCLUSIONS

The aim of this project was to develop and
evaluate the performance of an ultrasonic
chicken counter for a chain conveyor
application. The study made use of two
sensors (entry and exit) to improve
Efficiency programmed the counter to
overcome environmental (temperature,
air pressure and sound wave) interference,
and arrived at the following
conclusions:

* At a speed of 30cm/s, the highest systematic error was observed to be 12.67%. The lowest systematic error was found to be at a speed of 10cm/s which gained an average of 1.33% for systematic error.

* The highest accuracy for the counter was reached at a conveyor speed of 10cm/s gaining an accuracy of 98.67% and the lowest accuracy was determined to be 87.33% after evaluation at a conveyor speed of 30cm/s.

5. RECOMMENDATIONS

The carrying out of this research had its
challenges and successes. Therefore, based on
these findings the following suggestions were
arrived at.

1. It is recommended that the conveyor be operated at a range of 10-15 cm/s due to the minimal systematic error of the device at this operating speed range.

2. It is recommended that for higher accuracy, the conveyor should allow only one chicken to pass by the counting device in half a second.

It is suggested by the researchers that more
studies and experimentation on the specificity of
sensory counting devices be made so as to
reduce the possibility of inaccuracy in counting of
the chickens.

DISCLAIMER (ARTIFICIAL INTELLIGENCE)

Author(s) hereby declare that NO generative Al
technologies such as Large Language Models
(ChatGPT, COPILOT, etc.) and text-to-image
generators have been used during the writing or
editing of this manuscript.

ACKNOWLEDGEMENTS

We express our profound gratitude to the
Department of Agricultural and Bioresources
Engineering, Joseph Sarwuan Tarka University,
Makurdi, for providing the necessary facilities,
resources, and a conducive research
environment for this project.

We are grateful to the Technical staff of the
department for their invaluable support,
guidance, and dedication throughout the
research process. We deeply appreciate their
efforts and remain grateful for their commitment
to fostering academic and technological
advancements.

COMPETING INTERESTS

Authors have declared that no competing
interests exist.

REFERENCES

Accurate Chicken Counting in Smart Farm Environments (2024). Sensors, 24, 2977.https://doi.org/10.3390/s24102977

Bernardo, J. G. U., Adrias, A. R., & lii, W. G. T., (2023). *Development of Automated Chick Counting Machine using Mechatronics*. 8(1), 59–66.

Cao, L., Xiao, Z., Liao, X., Yao, Y., Wu, K., Mu, J., Li, J. and Pu, H. (2021). Automated chicken counting in surveillance camera environments based on the point supervision salgorithm: LC-DenseFCN. *Agriculture, 11*(6), 493. https://www.mdpi.com/2077-0472/11/6/493

Cronin, G. M. A., Borg, S. S. A., & Dunn, M. T. B., (2008). *Using video image analysis to count hens in cages and reduce egg breakage on collection belts*; Australian Journal of Experimental Agriculture (48)768-772.

Cuemaths,(2022).Accuracy formula. Retrieved
from https://www.cuemath.com/accuracy-
formula/#/e-cna/exit-parent/
Etim, B.D. (2010). Design and Construction of a
Microcontroller Based Traffic Light
Control with Vehicle Counter
(Doctoral dissertation, Department of
Computer Engineering Faculty Of
Engineering, University Of Uyo).
120pp

Gopi M. V. and Dimple T. (2020). Hand Gesture Gaming using Ultrasonic Sensors & Arduino International Journal of Engineering Research & Technology (IJERT) http://www.ijert.org ISSN: 2278-0181 Vol. 9

Greene-Roesel, Ryan D., Mara C. R., David R. (2008). Effectiveness of a Commercially Available Automated Pedestrian Counting Device in Urban Environments. Uc Berkeley Research reports: http://escholarship.org/uc/item/2n83w1q8

Indeed Editorial Team, (2023) Errors accuracy and precision. Retrieved from https:www.indeed.com.

Khanal, R.; Choi, Y.; Lee, J. (2024). Transforming Poultry Farming: A Pyramid Vision Transformer Approach for

Li, G., Li, B., Shi, Z., Zhao, Y., & Ma, H. (2018). *Design and evaluation of a lighting preference test system for laying hens.* 147(January), 118-125. https://doi.org/10.1016/j.compag.2018.01.024

Montalban, L. J. T., & Lumauag, R. G. (2023). an Image Processing Approach in Counting and Sorting of Chicken Egg. Journal of Engineering Science and Technology, 18, 183-190.

Mullapudi, C.K. (2020). Implementation of Arduino-based Counter System International Journal of Engineering Research & Technology Vol. 9 Issue 09 https://www.ijert.org/research/implementati on-of-avrduino-based-counter-system-IJERTV9IS090456

Nerd, R. (2020). Complete Guide for Ultrasonic Sensor HC-SR04 with Arduino. Retrieved from https://randomnerdtutorials.com/complete-guide-for-ultrasonic-sensor-hc-sr04/

Obah, P.J. (2021) Development of Arduino-
Based Counter System. (Doctoral
dissertation, Department of Electrical
Electronics Engineering Faculty of
Engineering, Baze University Abuja,
Nigeria).150pp

Okinda, C., Lu, M., Nyalala, I., Li, J. and Shen, M. (2018). Asphyxia Occurrence Detection in Sows during the Farrowing Phase by Interbirth Interval Evaluation. Comput. Electron. Agric. 152:221-232 https://doi.org/10.1016/j.compag.2018.07.007

Okolo C, C., Okafor O. O., Omeje B. N., Iwegbuna O, N,, Ngene C, C.(2022). Introduction to an Arduino Board; International Journal of Research Publication and Reviews, Vol 3, no 5, pp 751-755

Ozbay K., Yang H., Bartin B., Wala R., and Williams R., (2010). Automated Pedestrian Counter.
https://rosap.ntl.bts.gov/view/dot/17680

Saleh, T. (2019). Movement Sensed Automatic Door Control System. (Doctoral dissertation, Department of Electrical and Electronic Engineering, Abubakar Tafawa Balewa University (ATBU) Bauchi.) 127pp

Shafique, A., Ramzan, N., Rehman, M. U. and Tanveer, M. (2019). Object Counting on Conveyor Belt using IR Sensors. In 2019 International Conference on Robotics and Automation Engineering (ICRAE) (pp. 111-116). IEEE. https://doi.org/10.1109/ICRAE47158.2019.8985968

Vidhya, D. S., Rebelo, D. P., D'Silva, C. J., Fernandes, L. W. and Costa, C. J. (2016). Obstacle detection using ultrasonic sensors. *IJFIRST–International Journal for Innovative Research in Science & Technology, 2*(11), 316-319

Wang, H., Lu, X., Guo, X., Liu, B. and Li, Q. (2020). An Ultrasonic Sensor-Based Conveyor Belt System for Counting Objects. *Measurement*, 153, 107399. https://doi.org/10.1016/j.measurement.2019.107399

Yusuf, S., Atawodi, N., Loko, Z., Lumbi, L. (2020). Design and construction of a Car Counter Using Pulse Infrared SensorJournal of Multidisciplinary Engineering Science and Technology, 124, 335-668.

Zeng, Y., Liu, J., Zhang, Y. and Chen, Y. (2019). A Novel Duckling-Counting Method Based on Ultrasonic Sensor Technology. *Computers and Electronics in Agriculture*, 160, 247-254.
Zhu, X., Wu, C., Yang, Y., Yao, Y., & Wu, Y. (2022). Automated Chicken Counting Using YOLO-v5x Algorithm. ICSAI 2022 - 8th

International Conference on Systems and Informatics.
https://doi.org/10.1109/ICSAI57119.2022.1
0005522

**Disclaimer/Publisher's Note:** The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of the publisher and/or the editor(s). This publisher and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

© Copyright (2025): Author(s). The licensee is the journal publisher. This is an Open Access article distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/4.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

Peer-review history:
The peer review history for this paper can be accessed here:
https://pr.sdiarticle5.com/review-history/132690