Notes
BLE-Based Livestock Tracking System: Implementation, Results and Future Development
3.2 Experimental Procedure
To evaluate the performance of the BLE-based tracking system, an Arduino Nano BLE beacon was attached to and carried by a human subject moving around the experimental room. The movement of the subject was intended to simulate the movement of an animal within an enclosed environment, such as a livestock pen.
As the beacon moved through the room, the ESP32 anchor nodes continuously scanned for Bluetooth Low Energy (BLE) advertisements transmitted by the beacon. Each ESP32 measured the Received Signal Strength Indicator (RSSI) of the received BLE signals in real time. Since RSSI varies according to the distance between the transmitter and receiver, these measurements provided the fundamental data required for estimating the beacon's position.
3.3 Data Collection and Communication
The RSSI measurements collected by each ESP32 were transmitted to a central Flask server over a Wi-Fi network using HTTP requests. The server received and organised the readings from the different anchor nodes, allowing the RSSI measurements to be analysed collectively rather than independently.
Once the readings from the anchors were synchronised, the server converted the RSSI values into approximate distances between the BLE beacon and each ESP32. This provided the distance measurements required for the subsequent localisation process.
3.4 Triangulation and Position Visualisation
The estimated distance between the beacon and each ESP32 was calculated using a calibrated RSSI propagation model:
d = 10^((A − RSSI) / 10n)
where d represents the estimated distance in metres, A is the measured RSSI value at a reference distance of one metre, and n is the signal propagation constant. The value of n depends on the surrounding environment and is typically between 2 and 4 for indoor environments.
After obtaining the estimated distances, the Flask server used the known positions of the three ESP32 anchor points to perform triangulation. By combining the distance measurements from the anchors, the system calculated an approximate (x, y) coordinate for the BLE beacon.
The calculated position was then transmitted to the web interface, where it was displayed visually in real time. This allowed the movement of the beacon to be monitored as it travelled through different areas of the experimental environment.
4. Results and Discussion
The prototype successfully demonstrated the ability to perform real-time BLE-based localisation and visualise the movement of a mobile beacon within an indoor environment. As the human subject moved around the experimental space, the position estimated by the system changed dynamically and was reflected on the web interface.
The results demonstrated that RSSI measurements can provide a practical basis for detecting movement and determining the approximate location of a BLE device. However, the estimated position did not always correspond exactly to the subject's actual location. Several factors contributed to these variations.
One of the primary sources of error was the presence of signal reflections, particularly from metallic objects and surfaces within the room. These reflections can cause multipath propagation, meaning that BLE signals can reach an ESP32 through multiple paths and produce inconsistent RSSI values. Physical obstacles between the beacon and anchors can also weaken or distort the received signal.
Environmental noise and natural fluctuations in BLE signal strength further contributed to variations in the calculated distance. Since the localisation algorithm relies directly on RSSI measurements, even relatively small changes in RSSI can result in noticeable changes in the estimated position.
Despite these limitations, the system was sufficiently accurate for identifying general movement patterns and determining the approximate region occupied by the beacon. This demonstrates its potential as a low-cost foundation for monitoring livestock movement within enclosed environments.
5. Future Development
Several improvements can be implemented to increase the accuracy, scalability, and practical usefulness of the system.
Increasing the number of ESP32 anchors throughout the monitoring area would create a receiver grid around the livestock pen, improving coverage, localisation accuracy, and resilience in difficult areas.
The system could also support multiple BLE beacons simultaneously. Assigning a unique identifier to each beacon would allow individual animals to be tracked within the same enclosure and reveal their movement patterns.
Proximity detection could determine when two animals move within a specified distance of one another, helping study social interactions, identify unusual behaviour, or monitor animal activity.
Machine learning could improve localisation reliability by learning the relationship between RSSI measurements and actual positions within a specific environment while filtering noisy readings.
Finally, the system should be tested in an actual livestock environment to evaluate the effects of animal movement, body orientation, pen structures, other animals, and changing environmental conditions on BLE signal propagation.
6. Conclusion
This study successfully demonstrated a proof-of-concept BLE triangulation system capable of estimating and visualising the position of a mobile beacon within an indoor environment. The system combined an Arduino Nano BLE beacon, multiple ESP32 receiver nodes, Wi-Fi communication, a Flask-based server, and a web-based visualisation interface to create an end-to-end tracking solution.
Although a human subject was used during the experiment to simulate animal movement, the underlying architecture can be adapted for livestock monitoring by attaching compact BLE beacons to individual animals. The results showed that RSSI-based localisation can provide useful information about general movement and approximate position, although environmental interference and fluctuations in signal strength limit the accuracy of the current implementation.
With additional anchors, improved signal filtering, machine learning-based localisation, and multi-beacon support, the system could be developed into a scalable livestock monitoring platform. Such a system could provide farmers with continuous information about animal movement and behaviour, supporting more efficient livestock management and contributing to smarter, more sustainable agricultural practices.
7. References
- Zafari, F., Gkelias, A., & Leung, K. K. (2019). A Survey of Indoor Localization Systems and Technologies. IEEE Communications Surveys & Tutorials.
- Bluetooth SIG. (2023). Bluetooth Core Specification Version 5.3.
- Espressif Systems. (2024). ESP32 Technical Reference Manual.
- Arduino. (2024). Arduino Nano 33 BLE Documentation and Overview.
- Flask-SocketIO Documentation. (2024). Real-Time WebSocket Communication.




