# Low-Cost IoT and LoRaWAN-Based System for Laying Hen Identification in Family Poultry Farms
## 2 Materials and Methods
### Requirements  
This section describes the fundamental requirements that guided the system's development, meticulously organized into discrete categories. Functional Requirements: The high-level functional requirements that influenced the selection of technologies are as follows:  
* Individual identification of hens in mobility (i.e., not confined to cages) (for flocks ranging from 1 to 1000 hens);
* Identification of nesting boxes (ranging from 1 to 100 nesting boxes);
* Logging the duration of nesting box usage by each hen;
* Monitoring of environmental variables such as temperature and humidity inside the chicken coop. Connectivity: The system must be capable of operating in rural areas where cable or fiber-optic connectivity is limited, and mobile coverage is not guaranteed. Energy: Due to the remote location of the nesting boxes, the devices must be autonomous and battery-powered. Minimizing energy consumption is a priority. Processing and Storage: Assume a maximum of 1000 hens, 170 m\({}^{2}\), and 150 nesting boxes and that each hen lays one egg per day (under optimal conditions, commercial laying hens are capable of laying about 300 eggs per year, free-range hens lay about 200 eggs per year, and finally, pure-bred hens lay about 100 eggs per year). Based on this scenario, the required capacity for message storage and data logging is low, and the system's processing performance requirements are minimal. Consequently, it is viable to utilize a low-performance computer, such as a Raspberry Pi, to host the system's application service. Size, Shape, and General Characteristics: The IoT device to be installed in a node should be compact and low-profile in order to minimize spatial requirements and prevent obstruction of bird movement. Due to the potential for the nesting environment to contain moisture, dust, and fluctuations in temperature and humidity, the device should be resilient and well protected. It should also be safeguarded against damage from hens or external elements. The components should be efficiently integrated into the device design to optimize space and facilitate both installation and maintenance. Ease of access is also necessary. Although the device will be installed inside the nesting box, its components must remain accessible to facilitate initial setup, battery replacement (if necessary), periodic maintenance, and secure mounting. The device should be able to be securely mounted in the nesting box to avoid unwanted movement or damage. Scalability: To ensure that the solution is as scalable as possible, the following factors have been considered in both its infrastructure and architecture:  
* The modular design divides the system into independent, well-defined modules, allowing each component to be scaled independently without affecting the rest of the system. This facilitates the addition of new features or the expansion of capabilities without having to redesign the entire product. This strategy has been applied to both hardware and software. * The utilization of open standards is essential for the seamless integration of systems and the adoption of novel technologies in a progressive manner. This approach employs standardized and widely accepted communication technologies and protocols for IoT, ensuring interoperability and facilitating the implementation of advanced functionalities as technological advancements evolve. * Distributed architecture: The system has been designed as a distributed architecture across multiple nodes or devices, avoiding reliance on a single central unit. This enables horizontal scaling by adding more nodes as required to accommodate larger workloads. * Our system has been developed for utilization as a cloud service, with the purpose of data storage, information processing, and communication management between devices. A key feature of cloud services is their capacity for automatic scalability, which enables them to adapt to fluctuations in demand in a dynamic manner, thus obviating the need for manual intervention.