# Low-Cost IoT and LoRaWAN-Based System for Laying Hen Identification in Family Poultry Farms
## 2 Materials and Methods
### Technology Selection
#### 2.2.1 Nodes  
Two types of sensor nodes have been developed for the proposed system. The first one is the _nesting box node_, designed to detect the presence of laying hens inside the nesting box. The second one is the _environment node_, which is responsible for capturing environmental variables that may affect the animals in the chicken coop, such as temperature and humidity. In order to design the nesting box node, several technologies for the identification function were evaluated [24; 25]. Initially, image recognition technology was considered. This technology was ruled out due to its high bandwidth and processing requirements, which the node could not meet according to the established requirements. Another technology evaluated was the use of infrared temperature sensors and ultrasonic distance sensors. The use of sensor devices such as GY-906, MLX90614, and HC-SR04 was also ruled out, because they require a clear line of sight to the target, which is not guaranteed in the dusty and harsh environmental conditions typical of poultry farms. Furthermore, they demand specific sealing and maintenance conditions to ensure optimal performance, making them unsuitable for the intended deployment context. The advantages of using wireless technologies for monitoring have been explored by various researchers, enabling low-cost and low-consumption developments in agriculture and the food industry [26]. Finally, we opted for RFID/NFC (Radio Frequency Identification/Near-Field Communication) technology as this high-frequency, short-range wireless communication technology is particularly well suited to the proposed system, as its limited range aligns precisely with the system's operational requirements. NFC enables data exchange between devices using a reader, antenna, and either active or passive tags. In the context of this development, the constrained reading range of NFC proves advantageous, as it ensures that only hens entering the nesting box are detected. Therefore, NFC was deemed the most appropriate choice for implementing the individual identification mechanism. The RC522 NFC reader, compatible with ISO/IEC 14443A/MIFARE tags, was selected for its low cost, extensive documentation, and superior performance in terms of range and accuracy during testing. For tagging, MIFAE tags by NXP Semiconductors were chosen due to their widespread adoption in contactless smart card applications. The selected controller for this node must be able to send messages using our chosen communication protocol (described in the next section) and to read MIFAE tags with an NFC reader. After comparative testing, Heltec ESP32 WiFi LoRa v2, equipped with a Semtech SX1276 (EU 868; 863-870 MHz) long-range transceiver, was selected for its integration capabilities and compatibility with low-power, long-range communication. From a practical perspective, one of the first challenges was to determine whether an NFC reader and a LoRa module could be operated on the same controller without interference or communication issues. According to [27], this integration is technically feasible when key aspects such as pin assignment, power management, and timing of read/write operations are properly handled. These considerations were crucial in choosing the Heltec controller, which allowed us to implement both NFC tag reading and LoRaWAN message transmission efficiently within a single compact node. On the other hand, the adverse effects of high temperatures and humidity--commonly referred to as heat stress--are well documented, not only in terms of reduced egg production but also due to their negative impact on the immune function and overall health of laying hens, increasing mortality rates [28]. To address this issue, an additional node--referred to as the environment node--was integrated into the system to collect temperature and humidity data inside the chicken coop. This node is composed of the following components: an Arduino Pro Mini 328 microcontroller, an RM95 LoRa transceiver, and a DHT11 sensor for temperature and humidity measurements.