Abstract
This work presents the design and evaluation of a virtual fencing system for livestock using low-power microcontrollers and radio modules. The system estimates animal position by measuring distances between mobile and fixed nodes, enabling software-defined boundary enforcement through auditory or electrical deterrents. The software architecture is based on FreeRTOS, chosen for its task scheduling flexibility and ability to maximize processing throughput in dynamic loads. Multiple distance estimation methods were evaluated, with time-of-flight (ToF) ranging and trilateration demonstrating suitability as a low-power alternative to GPS in appropriate conditions. For battery life, results highlight that the most significant factor in extending battery life is efficient use of all available sleep states minimizing current consumed in the off state, as radio modules typically remain inactive between short-range interactions. This paper details the system architecture, power-saving strategies, and performance trade-offs of location finding methods observed during testing.