Development of a novel Bluetooth Low Energy device for proximity and location monitoring in grazing sheep

Monitoring animal location and proximity can provide useful information on behaviour and activity, which can act as a health and welfare indicator. However, tools such as global navigation satellite systems ( GNSS ) can be costly, power hungry and often heavy, thus not viable for commercial uptake in small ruminant systems. Although, developments in Bluetooth Low Energy ( BLE ) could offer another option for animal monitoring, BLE signal strength can be variable


Introduction
Increased demand for animal products from a declining number of farmers producing livestock, is resulting in fewer but larger farms holding increasing numbers of livestock (Berckmans, 2014).Consequently, there may be less time for individual monitoring, making it more challenging to manage animals and their welfare as effectively.However, precision livestock farming (PLF) technologies have developed substantially in recent decades (Aquilani et al., 2022), and tools providing real-time or near real-time monitoring are becoming increasingly available, allowing farmers to make more informed and targeted decisions whereby animals can be managed at the individual level (Wathes et al., 2008).Whilst a range of PLF tools have been developed and incorporated into more intensive farming systems (Buller, 2020;Aquilani et al., 2022), application in more extensive systems, and for species considered to have a lower economic value, such as sheep and goats, has been much slower (Bahlo et al., 2019).Within extensive systems there are additional challenges in transmitting information, and requirements for devices to withstand variable climate and weather conditions (Bahlo et al., 2019).However, there has been growing interest in exploring the use of sensors and other technologies to assist with animal management in extensive grazing systems (Fogarty et al., 2021).
Monitoring animal location and proximity can provide useful information regarding landscape and resource use, social contacts, and animal behaviour (Maroto-Molina et al., 2019).Over time this can also provide information on animal activity, which can be a useful indicator of health and welfare status (Liu et al., 2018;Nikodem, 2021).However, many of the technologies available tend to be impractical for use within grazing systems.Given the low value of individual animals and the often large flock sizes, the cost of PLF tools will be a factor in the uptake and use of such technologies within small ruminant sectors (Umstätter et al., 2008;Maroto-Molina et al., 2019).The introduction of the Internet of Things (IoT) and low power wide area (LPWA) networks has enhanced connectivity options, and along with advancements in technology such as Bluetooth Low Energy (BLE), presents opportunities for development of real-time monitoring within extensive systems.Whilst global navigation satellite systems (GNSS) have been one of the most employed sensors within sheep research (Fogarty et al., 2018), BLE could offer a less power-intensive means of monitoring both novel animal proximity and animal location.Several studies have already begun to explore the use of BLE within livestock monitoring (Maroto-Molina et al., 2019;Lee et al., 2022, Maxa et al., 2023), both in combination with other technologies, as a means of localisation within indoor systems (Tøgersen et al, 2010;Bloch and Pastell, 2020;Szyc et al, 2023), and within sheep systems to investigate the ewe-lamb relationship (Waterhouse et al., 2019), particularly as a means of establishing maternal pedigree (Sohi et al., 2017;Paganoni et al., 2021).However, BLE signal strength is known to be a noisy measure of proximity (Lovett et al., 2020), and whilst there have been several studies exploring BLE signal strength and range within indoor environments, there have been few in outdoor systems.There has however been a growing development and application of BLE within other sectors, such as for contact tracing, asset tracking, health monitoring, and to provide proximity-based services or proximity marketing (Spachos and Plataniotis, 2020;Yang et al., 2020), demonstrating potential for this type of technology to be applied within animal monitoring.There were two main aims to this study, the first being the characterisation of the relationship between BLE signal strength and distance in an outdoor environment, using a purpose-built device containing a BLE reader alongside commercial BLE proximity beacons.The second aim was to assess the use of BLE for the location of grazing sheep.Localisation was trialled in a field environment, firstly in a static beacon localisation study, and then an on-sheep validation, where a weaned lamb was fitted with a BLE beacon.

Device design
A multi-sensor device was developed, commissioned from CENSIS: Scotland's Innovation Centre for sensing, imaging and Internet of Things (IoT) technologies.This wearable integrated sensor platform device (WISP) consisted of an IP65 enclosure containing a BLE reader, GNSS receiver, and accelerometer, as well as a long range wide area network (LoRaWAN) communication module (a category of LPWA technologies, which transmits data using a wireless modulation technique, LoRa -referring to long range) and 8 MB flash memory drive (Supplementary Figure S1.a).WISPs weighed 333 g and were designed for use as either / both a static BLE reader and wearable on-animal device.Alongside the WISP, commercial BLE 5.0 beacons weighing 14g (Supplementary Figure S1.b) were used throughout the series of studies.These had a reported operating distance of up to 130 m and received signal strength indicator (RSSI) range of 0 to ~ -127 decibels per milliwatt (dBm) (Shenzhen Feasycom Technology Co., Ltd).
The system operated most simply as a beacon which transmitted (called advertising) a unique ID, and BLE readers which received and reported these IDs along with the beacon's RSSI.Beacons were pre-programmed with an identity number and set to an advertising interval of 1 285 ms.The WISPs reported data on a 5-minute duty cycle, both in real-time via LoRa (where gateway coverage was available) and to the flash drive.The BLE reader within the WISP (operating on BLE 4.2) was programmed to report the identity and RSSI of 16 beacons with the strongest signal for that duty cycle.These were the 16 beacons with the highest average RSSI, where RSSI values within the range of -35 to -45 dBm were considered high values, and those within the range of -85 to -95 dBm considered low values.Readers operated by scanning for 30 s then idling for 30 s, where during each scanning window the RSSI of any beacon seen was added to that of any previous adverts.At the end of each duty cycle beacons were sorted based on their average RSSI (Total Power (sum of beacon RSSI) / No. of adverts (No. of times beacon seen by the reader)), and timestamp, beacon ID and single RSSI values were transmitted by LoRa and saved to the WISP flash drive (Supplementary Figure S2), along with a single WISP GNSS location (based on the average from a minimum of 10 fixes).

Study design
The WISPs and beacons were calibrated within a field environment to evaluate the relationship between a beacon's reported RSSI and its distance from a BLE reader (within a WISP), in order to assess the BLE signal range, and to develop a prediction equation whereby beacon distance from a WISP could be estimated based on its reported RSSI (Fig. 1).Five WISPs were attached to a plastic electric-fence post located at a central point within the field.Eight beacons attached to posts were rotationally located at log intervals at distances of 1 -128 m from WISPs, measured using a measuring wheel (Voche, Surveyors metric folding distance measuring wheel).Beacons were located at each of these measured distances for 29-minutes to allow opportunity for WISPs to obtain five possible RSSI readings per distance for each WISP-beacon pair.To determine whether WISP or beacon height impacted the likelihood of a beacon being received by the reader, or the RSSI values reported, both device types were tested at multiple heights.Beacons were tested at heights of 0.3 m (representing approximate ewe lying or lamb height) and 0.7 m (representing approximate ewe standing height), whilst WISPs were tested at 0.3, 0.7 and 2 m (Supplementary Figure S3).

Range of devices
The maximum measured distance at which a beacon's signal was reported by a WISP was used to assess the BLE range at different WISP and beacon heights.As the precise distance at which a beacon's signal could no longer be reported by a WISP occurred at an unknown distance between two actual measured distances, the calibration data from each individual WISP-beacon height group was structured as interval-censored data sets, whereby for each WISP-beacon pairing the lower bound was the greatest measured distance at which the beacon was reported by the WISP, and the upper bound the subsequent measured distance, from which point the WISP failed to report the beacon.The "survreg" and "surv" functions from the survival package in R (version 3.5-5;Therneau, 2023) were applied to the data set to fit a Weibull accelerated failure time model.This model was considered to encompass the features required to describe the signal strength and is often employed to model reliability and survival.The "predict" function (version 4.2.2;R Core Team, 2022) was then applied to generate survival curves of the probability of a beacon being reported with increasing distance from the WISP for each of the WISP and beacon height combinations.

Development of the distance prediction model
A distance prediction equation was developed from the RSSI values obtained at each measured distance during the calibration by applying the "lm" function in R (version 4.2.2;R Core Team, 2022) to fit a regression.This was conducted for three models: linear, natural log, and inverse square, applied to both the full data set collectively, and for each individual WISP-beacon height group.The inverse function from the regression (generated for each group) was then applied along with the "predict" function to generate predicted distances for given RSSI values of -45 to -90 dBm.The three models were assessed based on their CV and R² results to select the most appropriate prediction equation for the WISP-beacon heights used within each study stage.

Study design
A localisation study was conducted on static beacons within a ~60 x 90 m area to determine whether beacons could be located based on their RSSI from multiple WISPs.The objectives of this study were to assess the error associated with the RSSI and distance prediction equation, and to test a multilateration approach as a means of localisation, the process for which is outlined in Fig 2 .Six WISPs (numbered 1 -6) were attached to fence posts at a height of 0.7 m; two located along the width of the paddocks (~60 m) at the 15 and 45 m mark, whilst four WISPs were located along a partial length of the outer fence line at distances of approximately 30, 50, 70, and 90 m.This resulted in an average WISP-WISP distance of 50.75 m.Sixteen beacons (labelled Beacon A -P) were attached to posts (0.7 m height) and laid out in a grid-like array within the paddock (Fig. 3).As WISPs could report a maximum of 16 unique beacon identities within a duty cycle, there was no risk of competition between beacons for recording by any of the WISPs.WISPs and beacons were located at their designated position for a 2-hour period to provide a possible 24 RSSI readings per WISP-beacon pair.Locations of each WISP were based on the mean (of 17-24) GNSS coordinates from the onboard GNSS receiver, recorded during the data capture window.There was a mean difference of 1.02 -3.03 m between single and mean WISP-GNSS coordinates of individual WISPs.GNSS locations for the beacons were obtained using the Android app "GPS Logger" (version 3.2.1,Basic Air Data).A separate study was conducted to assess the error associated with this app using 2 mobile phones to obtain 12 GNSS coordinates per phone for 2 locations.There was a mean difference of 0.93 m (SD = 0.57) between individual and mean coordinates for Phone 1 (used within the static beacon study), and 1.73 m (SD = 1.13) for Phone 2. Coordinates obtained by each phone had a mean difference of 2.14 m.

Statistical analysis
Flash drive data (selected as the most complete data set) from each WISP was downloaded and combined, and the relevant 2-hour window of data selected for analysis.Data was reviewed to determine which WISPs had reported which beacons and compare variation in RSSI over time.Distances between each of the six WISPs (using mean GNSS coordinates), and between each WISP and beacon were calculated using the "disthaversine" function from the "geosphere" package in R (Version 1. 5-18;Hijmans, 2022).BLE based WISP-beacon distances (for each possible WISP-beacon pairing) were calculated by applying the RSSI of each beacon reading obtained to the distance prediction equation, and then calculating the mean of these estimated distances.These were then compared with the WISP-GNSS based distance estimates.To then calculate beacon locations, GNSS coordinates of WISPs were first converted from longitude and latitude (WGS84 / EPSG: 4 326) to that of the British National Grid (EPSG: 27 700) using the "st_transform" function from the "sf" package in R (Version 1.0-14; Pebesma and Bivand, 2023).Final estimated beacon locations were calculated using a multilateration approach (Zhou et al., 2012;Luomala and Hakala, 2022) described below.Field boundaries for the study area were calculated based on the GNSS coordinates of corner and mid-paddock fence posts.
Multilateration localisation method: Applying the multilateration approach, the beacon's predicted distance was plotted as the radius of a circle around the reporting WISP, given by: Where beacons were reported by multiple WISPs, the intersection of the resulting circles was solved to generate potential beacon locations: where: a = 1st WISP longitude; b = 1st WISP latitude; c = 2nd WISP longitude; d = 2nd WISP latitude; D = distance between 1st and 2nd WISP; r0 = beacon predicted distance from WISP 1; r1 = beacon predicted distance from WISP 2; and ∂ = area of a triangle with edge lengths r0, r1, and D.
These points were filtered to remove those which fell outside the paddock boundary.
The final estimated beacon location was calculated as the mean of the potential beacon locations falling within the paddock boundary, and the resulting coordinates were compared with the beacons GNSS based location.An example of the multilateration process for one of the beacons (Beacon E) is shown in Fig. 4.

Study design
Localisation and proximity distance using BLE was then validated in an on-sheep scenario, using data from a larger study where 24 weaned lambs (Texel x Mule) were fitted with collars containing a BLE beacon, 12 of which also had separate GNSS devices (i-gotU 200 or i-gotU 600, Mobile Action Technology).Lambs were all released into two adjoining paddocks (~1.4 ha) with connecting open gateway, which were surrounded by nine WISPs (Fig. 5).The WISPs were located at a height of 2 m, attached to canes along the fence line.Four WISPs were staggered along the length of both outer fence lines (~240 m), whilst one was located at the open gateway between paddocks (indicated by W5 within Fig. 5).

Statistical analysis
The analysis presented here examines a sample of data (24 h) from one lamb, wearing both a BLE beacon and i-gotU 200, as a validation of the developed distance prediction equation for both proximity monitoring and illustration of the use of BLE as a means of localisation in an on-animal scenario.As the most complete data set, WISP data was gathered from WISP flash drives for the selected day (8 September 2021) and combined into a single .csvfile.For each data point, the reported RSSI was applied to the prediction equation to estimate the beacons, and hence lamb's distance from the reporting WISP.
Similarly, the lamb's GNSS data was downloaded from the i-got-u and filtered using a similar approach to Hromada et al. (2023), where locations with outlying altitude data (< 210 m and > 240 m) were removed from the data set (~1%).A new variable, "movement", was derived: lambs were classed as being stationary or moving depending upon whether lamb coordinates remained consistent -moving 0 m (stationary), or there was a change in GNSS coordinates (moving) between the timestamp of interest and the preceding 5-minutes.Similarly, a variable "distance travelled" was calculated using the "disthaversine" function from the "geosphere" package in R (Version 1.5-18; Hijmans, 2022) to calculate the total distance travelled between the corresponding GNSS coordinates for the reporting timestamp and each of the coordinates over the preceding 5-minutes.A "distance travelled group" was assigned based on the "distance travelled", where 0 m = none, > 0-10 m = very low, 10-20 m = low, 20-40 m = mid, and > 40 m = high.GNSS coordinates were then transformed from longitude and latitude to British National Grid as described previously.
The timestamps of both the WISP (BLE) and i-got-u (GNSS) data sets were then rounded to the nearest minute and joined based on the rounded time.To estimate lamb locations, data was grouped to find occasions where multiple WISPs reported the lamb's beacon within any independent 5-minute interval (i.e.00:00:00-00:04:59, 00:01:00-00:05:59) over the course of the day, giving a total possible 1436 intervals.As all WISPs operated on independent time intervals, grouped data included instances where WISP reporting periods overlapped from between 1-5 minutes.
Where independent intervals resulted in the same groupings of WISPs with the same reporting timestamp, any duplicates were removed.Overall "movement" and "distance travelled group" categorisations were therefore assigned for each intervalwhere movement was assigned if listed for any of the reporting WISPs, and the highest "distance travelled group" from any of the reporting WISPs assigned overall.
Two BLE localisation methods were then evaluated to calculate lamb locations for each possible 5-minute interval.For each time interval, a single new BLE timestamp was generated by calculating the mean timestamp of all reporting WISPs.Similarly, a new GNSS timestamp and coordinates were calculated by finding the mean of the GNSS data points within the corresponding interval.The first localisation method followed the multilateration approach described previously (Fig 2).However, in this instance intersecting points which fell outside the field boundary were not filtered out, and the final estimated lamb location was based on all potential locations generated.

Midpoint localisation method:
The second localisation approach was based on calculating the midpoint (mean) between estimated coordinates on the straight-line distance between reporting WISP pairs.This was conducted for every possible WISP pairing within the time interval.Initial beacon coordinates were calculated from each WISP within a pair by plotting the predicted distance along the straight line between the two respective WISPs; calculated as follows: where: x1 = 1st WISP longitude; y1 = 1st WISP latitude; x2 = 2nd WISP longitude; y2 = 2nd WISP latitude; d1 = beacon predicted distance from WISP 1; 2 =      2;  =   1  2 .
For that pairing, the estimated beacon location was taken as the mean of these two points along the WISP-WISP distance.The final lamb location for each time interval was calculated by finding the mean of the estimated locations from all pairings of the reporting WISPs.To examine opportunities to scale up, lamb trajectories were generated from both BLE localisation methods and compared with that of the original GNSS locations reporting every 1 min.Trajectories were produced using the "ltraj" function in the adehabitatLT package in R (version 0.3.27;Calenge et al., 2023) both for the full 24-hour study period and per hour.

Calibration study
The relationship between WISP-beacon distance and RSSI was examined firstly as one data set, regardless of WISP or beacon height.Although there was an overall decline in RSSI with increasing beacon distance, there was a wide range in the RSSI values reported per distance and these values also overlapped between distances (Supplementary Figure S4).However, individual WISP-beacon pairs produced similar RSSI values across repetitions, typically reporting a consistent RSSI or varying by 1-2 dBm.Apart from three instances out of 1 463 data points, where there was a difference of 8, 9, and 16 dBm (all at distances of 1 and 2 m) pairings varied by no more than 5 dBm.Where beacons were reported by a WISP, they were generally reported in all five repetitions, particularly at shorter distances of 1-16 m, whilst at distances of 32 and 64 m there were more instances of the beacon only being reported during some repetitions.

Range of devices
The proportion of beacons reported per distance differed between WISP-beacon height groups (Supplementary Figure S5).At 16 m all groups reported ≥ 92.5% of beacons, however by 32 m this had fallen to 18.5% where both devices were at a height of 0.3 m.The total number of beacon readings per WISP and beacon for each distance is summarised in Tables 1 and 2. The Weibull accelerated failure time model indicated that the BLE signal range differed according to the height at which the WISPs and beacons were located.WISP and beacon heights were both found to be significant factors within the model (Table 3), with higher device heights resulting in a longer signal range.The interaction between WISP and beacon heights was also found to be significant at a WISP height of 2 m and beacon height of 0.7 m.The probability of a beacon being reported declined at much shorter distances when both devices were located at a height of 0.3 m, declining to a 0 % probability at distances beyond ~ 60 m.In comparison, WISPs at a height of 2 m and beacon height of 0.7 m had > 80% probability of reporting beacons beyond 60 m, reaching a ~ 0 % probability by ~ 120 m (Fig. 6).Setting a 95 % probability threshold the WISPbeacon range would therefore be between ~ 8 to 44 m depending upon both the WISP and beacon heights, whilst a 75 % probability threshold would give a range of ~ 17 to 66 m.

Development of the distance prediction model
Three prediction models (linear, natural log, and inverse square) were then applied to the obtained RSSI values for both the full calibration study data set and individually for each WISP-beacon height group.Comparison of the models, with the resulting SDs, CVs, and upper and lower confidence intervals of mean predicted distances, for each measured distance is provided within the supplementary materials (Supplementary Table S1), along with each models adjusted R 2 .Of the three models tested, the natural log model resulted in the highest adjusted R² values across all WISP and beacon height combinations and was selected for use in the distance prediction equation.As the BLE range and proportion of beacons reported varied with WISP and beacon height, the prediction equations applied within the static beacon localisation study and on-sheep validation corresponded to the WISP and beacon heights used in each scenario.We therefore report on two distance prediction equations, the first applies to the static beacon localisation study, and is based on a WISP and beacon height of 0.7 m (prediction equation 1), and the second prediction equation is based on a WISP height of 2 m and combined beacon heights of 0.3 and 0.7 m (to equate to sheep both lying and standing) which was applied to the on-sheep validation (prediction equation 2).For prediction equation 1, the regression resulted in a distance prediction equation of: =  -7.468966 -(0.126271 × ) (4) (R² Adjusted = 0.7517, F(1, 1 290) = 3 910, P < .0001).Whilst for prediction equation 2, the regression gave a distance prediction equation of: (R² Adjusted = 0.695, F(1, 2 645) = 6 031, P < .0001).
The prediction equations generated for each of the WISP-beacon height groups, and the relationship between RSSI and distance are shown in Fig. 7.All prediction equations resulted in similar distance estimations for RSSI values of ~ -45 to -75 dBm, covering an estimated distance range of ~0 -8 m, after which point the prediction equations began to diverge in their estimations.At lower RSSI values of -80 to -90 dBm there was much greater variation in the distances estimated by the different prediction equations, and a greater change in distance estimation between RSSI values where WISPs and beacons were located at higher heights.For example, at a WISP and beacon height of 0.3 m a change in RSSI from -89 to -90 resulted in a difference in distance estimation of 2.24 m, whilst at a WISP height of 2 m and beacon height of 0.7 m there was a difference of 11.45 m.In terms of the onsheep validation, this means that a lower RSSI value is likely to be reported by lambs lying down vs standing at the same distance.

Received signal strength indicator and distance prediction equation
During the static beacon study, WISPs reported a large proportion of messages via LoRa, 141 of a possible 144 messages (98%), however flash drive data was selected for analysis being the most complete data set.Fifteen of the 16 beacons were reported by at least one WISP during the study period, with individual WISPs reporting between 6 -13 beacons, thus generating at least one RSSI reading for 54 of 96 possible WISP-beacon pairings (56%).The total number of beacons reported per WISP, and corresponding number of RSSI readings is summarised in Table 4. WISP-beacon distances ranged from 1.93 to 97.77 m, and whilst RSSI readings were reported for 38 of the 44 WISP-beacon pairings (86%) located <63 m apart, RSSI readings were obtained for only 16 of 52 WISP-beacon pairings (31%) when >63 m apart.However, this was the distance at which the Weibull survival analysis estimated a 50% probability of a beacon being reported beyond.
Where multiple RSSI readings for a WISP-beacon pair were obtained across the 2hour data collection period, reported RSSI values had a maximum difference of 6 dBm and mean difference of 2.21 dBm.Estimated beacon distances from WISPs were calculated by applying the reported RSSI values to prediction equation 1, as this used the 0.7 m height settings.The final estimated beacon distance was classed as the mean predicted distance generated from all RSSI values for that pairing (Fig. 8).Overall, there was a mean underestimation of 12.13 m (SD = 15.97) by the prediction equation in comparison with the WISP-GNSS estimated beacon distances.Of the 54 WISP-beacon pairings for which a distance was obtained, 21 beacons (39%) were estimated to within 10 m of the GNSS distance, and 41 beacons (76%) to within 20 m.The largest differences between GNSS and BLE distance estimations occurred at distances over 64 m, which was beyond that of the calibration data, and the 50% probability of being reported.

Localisation: static beacons
Applying the predicted distances to the multilateration method (with a minimum of 2 intersecting WISPs reporting a given beacon) allowed locations for 11 of the 16 beacons to be generated (Table 5).The localisation error was classed as the distance between final estimated beacon locations and their respective GNSS coordinates.The error ranged from 5.34 -37.34 m, with a mean distance of 22.02 m (SD = 9.77).Where beacons were unable to be located using the multilateration approach, this was either the result of not being reported by the required number of WISPs (Beacons C and L), or the predicted distances resulted in circles which did not intersect (Beacons D, I, J).

Received signal strength indicator and distance prediction equation
Of the 24 lambs within the study, data from a single lamb was selected as a proof of concept and illustration of the system.The lamb selected for analysis had a total beacon count of 323 of a possible 2 592 messages (12.46%) reported for the chosen study day.This was considered typical with beacon counts obtained for other lambs, which ranged from 197 -454, with a mean beacon count of 280.This averaged at 1.12 WISP readers reporting the selected lamb's beacon in each 5-minute interval, however, distribution in time and space was very varied.Individual WISPs reported between 17 (5.90%)and 64 (22.22%)RSSI readings, of a maximum 288.This was not unexpected as the paddock was ~236 m in length, which was beyond the WISPbeacon range, and therefore not possible for every WISP to report on every occasion.However, the staggering of WISPs around the paddock resulted in a maximum distance of 73 m between WISPs along each paddock length, and 77 m between WISPs located on the opposite fence line.The maximum distance of a lamb's beacon from at least one WISP at any given time would therefore be ~39 m, a distance at which the Weibull accelerated failure time model indicated that >90 % of beacons would be reported beyond.
In comparison with the WISP-beacon mean GNSS estimated distances, the corresponding BLE predicted distances resulted in an error ranging from an underestimation of 104.22 m to an overestimation of 70.72 m, and mean underestimation of 1.59 m (SD = 18.52) (Fig. 9).Overall, prediction equation 2 underestimated beacon distance, however mean errors by individual WISPs varied from an underestimation of 9.09 m to an overestimation of 7.69 m.Instances where the lamb was considered stationary resulted in a mean underestimation of 0.40 m (SD = 17.72) and moving points in a mean underestimation of 2.80 m (SD = 19.23);t (1 638.9) = -2.64,p = 0.008.A one-way ANOVA also found a difference in prediction error between "distance travelled group", (F(4, 1 651) = 16.24,p = 4.74 × 10 -13 ), with Tukey's HSD post hoc tests indicating a higher prediction error in "low" vs "high" levels of movement (p = 0.043) and "low" vs "mid" levels of movement (p = 0.093).

Localisation: on-sheep
The lamb's beacon was reported by a maximum of 4 of 9 WISPs during any given independent 5-minute interval (i.e.00:00:00-00:04:59, 00:01:00-00:05:59).In most cases the lamb was reported by a single WISP, whilst reported by two or more WISPs in 26% of intervals (Table 6).There were also periods during which the lamb was not observed by any WISP, the longest of which was a period of 1 h 8 min.Both localisation methods were then applied and filtered to ensure unique groupings of reporting WISPs across intervals.The midpoint method generated a greater number of lamb locations, primarily where there were just two reporting WISPs (Table 7).
When the resulting lamb locations were compared with the lamb's mean GNSS coordinates for the corresponding interval, the distance between locations (the localisation error), ranged from 1.39 -74.67 m using the multilateration method, and 0.87 -71.58 m using the midpoint method (Fig. 10).The multilateration method resulted in a slightly higher localisation error with a mean of 23.77 m (SD = 12.49), whilst the midpoint method resulted in a mean of 19.00 m (SD = 11.00);t (205.38)= 3.15, p = .002.There was also a greater proportion of locations estimated to within 10 and 20 m of the GNSS location using the midpoint method, with 26 of 150 locations (17.33%) within 10 m and 89 of 150 locations (59.33%) within 20 m.In comparison, the multilateration method estimated 9 of 105 locations (8.57%) to within 10 m, and 44 of 105 locations (41.90%) to within 20 m.The midpoint method appeared to generate similar mean localisation errors for both 2, 3, and 4 reporting WISPs, of 19.20, 18.05, and 19.76 m, respectively.Mean localisation errors appeared marginally higher with an increased number of reporting WISPs for the multilateration method, with mean localisation errors of 22.55, 25.42, and 28.19 m.However, due to the low number of observations where there were 4 reporting WISPs, this was not analysed further.
A two-way ANOVA showed no statistically significant interaction between the localisation method and movement variable -lamb moving vs stationary (F(1, 251) = 0.90, P = 0.34), however simple main effects analysis indicated that both localisation method (p = 0.001) and movement (p = 0.043) had an effect on the localisation error.
There was very little difference in mean localisation error however between moving and stationary points within both localisation methods.The multilateration method resulted in a mean localisation error of 21.01 m (SD = 12.02) for stationary and 25.68 m (SD = 12.54) for moving points; t (92.876) = 1.92, p = 0.058, whilst the midpoint method resulted in slightly lower mean localisation errors of 17.90 (SD = 10.16) for stationary points and 19.72 (SD = 11.51) for moving points; t (134.6)= 1.01, p = 0.31.When compared based on the lamb's "distance travelled group", instances where the lamb had a very low level of movement resulted in the highest mean localisation errors, using both the multilateration and midpoint methods (Fig. 11).A one-way ANOVA indicated that there was a difference in localisation error between "distance travelled group" within both the multilateration (F(4, 100) = 2.70, p = 0.035) and midpoint methods (F(4, 145) = 2.86, p = 0.026).Tukey's HSD post hoc tests found that for the multilateration method the mean localisation error was higher in instances where the lamb had a "very low" level of movement compared with both "mid" (p = 0.097) and "none" (p = 0.037).Whilst for the midpoint method there was a higher mean localisation error for "very low" compared with a "mid" level of movement (p = 0.065).

Lamb trajectories
Given the low total number of lamb locations generated by both localisation methods, the trajectories produced from the BLE were based on much fewer data points than the full GNSS data.When split into hourly trajectories there were six hours for which the multilateration method, and three hours for which the midpoint method failed to produce a single location.During hours in which trajectories were generated, these were based on a maximum of 14 (multilateration) and 16 (midpoint) locations.The GNSS was set to report every 1-minute, however, some locations were given more frequently, and as a result hourly trajectories contained between 58 and 71 lamb locations.An example trajectory from 0100 h -0200 h is displayed in Fig. 12; chosen as this period contained the greatest number of data points from both BLE localisation methods, as well as 59 GNSS locations.Whilst having similar start and end points for the hour, the trajectories generated by both BLE methods show greater movement patterns and changes in direction than displayed by the GNSS trajectory, which indicated that lamb travelled ~40 m during this period.This pattern was similarly observed across hourly trajectories, including those where the GNSS indicated that the lamb was stationary throughout.

Received signal strength indicator: distance, device height, and range
One of the aims of this study was to characterise RSSI in terms of beacon distance from the BLE reader within the WISP and investigate the potential range and limitations of the BLE devices in an outdoor environment.As observed from the overall pattern of the calibration study, there is a natural decrease in the strength of a radio wave over distance, known as the path loss (Nyholm, 2020).This trend of RSSI declining with increasing beacon distance from the WISP was observed across all WISP-beacon height groups.However, within each of the measured distances there was a large range in the RSSI values reported, and these values would often overlap between distances.RSSI is known to be a noisy measure of proximity, and this overlap in RSSI values being reported across a range of distances has also been found within a barn system (Nikodem, 2021) and other indoor environments (Vanheel et al., 2011).However, whilst there was a large overall range per distance, there was in-fact very little variation in signal strength of individual WISP-beacon pairings across repetitions, with most pairings differing by 2 dBm or less.This was the case across distances, although at 32 m and 64 m, there were fewer overall instances of beacons being reported, and more occasions where beacons were reported by WISPs during only some repetitions.The ranges in RSSI per distance, even within WISP-beacon height groups, therefore indicate that a proportion of the variation observed is a result of the specific devices used, and differences arising between individual WISP and beacon pairings.This was particularly evident at a WISP and beacon height of 0.3 m, where only one of the five WISPs reported beacons at distances of 32 and 64 m.As a result, this could make standardising a distance prediction equation for a large number of devices more challenging.
As indicated by the Weibull accelerated failure time model (Fig. 6), depending on the threshold set as an acceptable proportion of beacons being reported, the functional range of the BLE devices will be reduced at lower WISP and beacon heights.
Triguero-Ocaña et al. ( 2019) similarly found a decreased probability of devices being received with increasing distance (up to 20 m) in proximity loggers, and a decreased signal strength when devices were located at a height of 0 m compared to 1 m.The presence of vegetation was also found to decrease the signal strength, with a greater impact at further distances.Whilst conducted across much shorter distances of 2 m, Kirkpatrick et al. (2021) also report an increased device range in proximity loggers when the receiving devices were located at a higher height, and that mean RSSI values were lower in long grass compared to cut grass, indicating that vegetation was also likely influencing the signal strength.
The operating range of BLE devices and the signal strength reported will be influenced by the transmission power as well as the transmitting and receiving antennas design and location (Townsend et al., 2014), all of which will differ to some degree between individual beacons and WISPs.The operating environment of the devices will also impact on the signal strength (Townsend et al., 2014), and obstacles located between the transmitter and receiver, may result in absorption, reflection or scattering of the signal (Goldsmith, 2005).This could act to alter the reported RSSI from that if there had been a clear line of sight between devices, or in some cases prevent the beacon from being reported.These factors make the translation of RSSI values into a corresponding distance challenging in an outdoor environment, where obstacles within the field (i.e., fences, water troughs, and vegetation), as well as the field topography, weather conditions, and the animals themselves all have the potential to interfere with the signal.When using the BLE beacons on sheep, the placement of the beacons, as well as their behaviour, posture, and orientation to the reporting WISP at a given time could therefore influence both the likelihood of the beacon being received by the reader, and on the RSSI value which is reported.Instances where the lamb is lying down, or grazing (and the beacon is in a lowered position) are therefore likely to have a reduce probability of being reported, in comparison with a lamb standing or actively walking with head and neck erect at the same distance, particularly as that distance increases.

Distance prediction equations
As both WISP and beacon height was found to influence the potential range of the BLE signal, multiple distance prediction equations were developed from the calibration data to correspond to the WISP and beacon heights used within each of the studies, rather than applying one single equation.Prediction equation 1, used within the static study, had an overall tendency to underestimate the WISP-beacon distance, with a mean underestimation of 12.13 m.However, the prediction equation was able to estimate 76% of the beacons to within 20 m of the WISP-GNSS estimated beacon distance, and 39% to within 10 m.Beacons located at distances over 60 m resulted in the largest underestimations compared with WISP-GNSS distances, and tended to have multiple beacons located between them and the reporting WISP.At these greater distances, variations in RSSI had potential to have a greater impact on the predicted distance.Small changes in RSSI resulting in large changes in distance estimation have been found within other radio frequency transceivers (Mukhopadhyay et al., 2015).However, some of the differences observed between the predicted and WISP-GNSS estimated distances will also include error associated with both the WISPs GNSS receiver and the GPS logger app used to obtain the beacon coordinates.Typically, GNSS systems are considered accurate in a range of 5 -30 m (Maroto-Molina et al., 2019).Within this study, the WISPs had a grand mean error of 1.69 m between individual and mean GNSS coordinates, whilst the GPS logger app had a mean difference of 0.93 m, both of which will contribute to some of the variation between estimations.
The on-sheep validation presented different challenges in terms of estimating the beacon's and therefore the lamb's distance from any given WISP, given the potential distance which a lamb could move over the recording period.Johnson et al. (2021) reports an average of 3.4 km (± 0.89) travelled by sheep over the course of the day, resulting in a mean of 11.81 m within a 5-minute period.Within the study the lamb under observation was found to travel a maximum estimated distance of 81.24 m and mean of 9.50 m during a 5-minute interval.When compared with the mean GNSS location for the corresponding interval, prediction equation 2 resulted in a close mean underestimation of 1.59 m, however, there were also some extreme values produced where the estimated distance differed from the WISP-GNSS distance by as much as 104 m.Despite some of these larger errors, a large proportion of the lamb's beacon readings were estimated to within 20 m of the WISP-GNSS estimated distance (254 of 332 -77%), and 156 (47%) to within 10 m.Whilst the prediction equation resulted in a slightly closer mean distance estimation for stationary compared with moving points, instances where the lamb had travelled furthest over the interval did not produce the largest errors.Instead, instances where the lamb was classed as having a "very low" level of movement resulted in the greatest differences between the predicted and mean WISP-GNSS distance for the interval.
Some of the error observed between these estimates may be due to the configuration of the WISPs and the way in which they operate.The WISPs report a single figure, the mean RSSI, for a 5-minute interval, however, during this time the lamb could move beyond the range of the reporting WISP, even if only moving a short distance.In addition, the lamb's behaviour and posture may also change over the interval and could be within the WISPs range when standing, but not if lying down.These estimations also do not consider the presence of other sheep or obstacles which may impact on the signal strength over the course of the reporting interval, which may act to prevent the focal lamb's beacon being received by the WISP, or to reduce the signal strength reported.As the readers scan on a 30 s on / 30 s off, the mean RSSI value reported could also be based on readings from as little as a 30 s period when the lamb was within range, resulting in a higher than expected RSSI and therefore a closer distance estimation by the prediction equation.This is a potential limitation of the system, where in the current configuration a lamb's beacon reported only once, but with a high RSSI could be reported over a lamb with multiple readings but lower average RSSI.Whilst we found very few instances in this study where all 16 beacon positions for a WISP were filled (16 of 2585 -0.62%), and so few opportunities for this to have occurred, this could be a larger issue where a greater number of sheep are present.In such instances, sheep consistently located towards the edge of a WISPs range, and therefore with a lower average RSSI may be missed by WISPs.As the lamb's behaviour and posture for a given interval was unknown, prediction equation 2 was developed based on combined calibration data from a WISP height of 2 m and beacon heights of both 0.3 and 0.7 m.However, individual prediction equations (Fig. 7) developed for each beacon height indicate that as the RSSI value decreases there is a greater difference in distance estimates, with a beacon height of 0.3 m producing a shorter distance than those located at 0.7 m.Lamb behaviour and posture are therefore likely to have a greater impact on the prediction equation when located further from the reporting WISP.The GNSS locations used to estimate the beacon distances are themselves also subject to error.Duncan et al. (2013) reported a mean error of 19.6 m ± 30.9 m and a circular error of 10.8 m using the i-gotU GT-600, which will also contribute to the differences observed between GNSS and BLE estimated beacon distances.
Distance estimation errors based on RSSI will vary depending upon the devices used, the conditions in which they are applied, and the methods used to translate RSSI to distance.Previous studies have reported very low mean distance estimation errors of 0.41 m (Thaljaoui et al., 2015) and 0.98 m (Adewumi et al., 2013) in an indoor environment, and 0.88 m in an outdoor environment (Adewumi et al., 2013).However, these studies tested RSSI at small distances ranges of between 0.25 -3.5 m (Thaljaoui et al., 2015) and 1 -10 m (Adewumi et al., 2013).Whilst variability in RSSI between WISP-beacon pairs, combined with effects of lamb movement on contact success and number of RSSI readings reported during each window resulted in a level of noise within the estimated distance from the prediction equation, an average mean underestimation of 1.59 m within the context of the ~1.4 ha paddock is relatively small.

Localisation
The static beacon localisation study aimed to locate beacons within an ~5 400 m² area based on data obtained over a 2-hour period.Using the multilateration approach, locations were generated for 11 of the 16 beacons, all of which were estimated to within 37.34 m of their estimated GNSS location, resulting in a mean difference of 22.02 m.The beacon with the largest localisation error, Beacon H, was the beacon which had both the greatest over and underestimation by the prediction equation.This resulted in circles intersecting at different areas within the paddock, hence the mean estimated location was much further from that of the GNSS.In comparison, Beacon B was reported by the same number of WISPs (five), however, four of these WISPs all intersected at very similar points, with a larger underestimation from just one WISP, therefore resulting in a closer mean estimate, with a localisation error of 5.34 m.Highlighted during the static beacon study was that the multilateration method was reliant on RSSI values generating predicted distances which produced intersecting circles, where under ideal circumstances the method would generate a cluster of points which intersected at the same (or close to the same) position.However, whilst occurring for some beacons, this was not in the case in all instances, and hence the mean of estimated points was instead applied to generate the final estimated location.Nonetheless, in some instances beacons were not able to be located despite having been reported by multiple WISPs.
The on-sheep validation therefore investigated both the multilateration and a midpoint localisation method, which did not require distance estimations to intersect.However, both methods still required a minimum of two WISPs reporting within an overlapping 5-minute interval to estimate the lamb's location.Given the length of the paddocks (~236 m) it was expected that each individual WISP would not report on every occasion, as there would be times when the lamb was beyond a WISPs range, particularly those located at either end of the paddocks.The lamb's beacon was most frequently reported by only a single WISP during any given 5-minute interval, giving an indication of proximity to the reporting WISP but not a definitive location.However, over time, this could still give an indication of the lamb's activity throughout the paddock.There were also periods during which the lamb was not reported by any WISP, the longest of which was between 1120 h and 1228 h, when the corresponding GNSS suggests that the lamb was stationary.If lying down, this would reduce the chance of the lamb's beacon being reported and more likely that the lamb was beyond the effective range of any WISP, as the beacon would be located closer to the ground.
A total of 105 locations were generated for the lamb over the course of the day using the multilateration method, whilst 150 locations were generated using the midpoint method.Although, similar localisation errors were generated by both methods, there was a slightly lower mean error using the midpoint method, and a greater proportion of locations were estimated to within 10 m of the GNSS.Instances where the lamb was classed as having a "low" level of movement resulted in the highest mean localisation error, however, there was no significant difference in mean localisation error between most of the "distance travelled group" classifications.The distance travelled was calculated based on the lamb's GNSS locations reporting every minute, and so was subject to error from the i-gotU.In addition, the classification was based on the highest level of movement from any WISP, however as WISPs reported on independent intervals the proportion of the 5-minute interval for which each WISP reported could vary from between 1 to 5 minutes.Some of the errors arising in the localisation are therefore likely a result of the configuration of the WISP reporting intervals, where the movement classification and distance travelled may have differed between each of the reporting WISPs.Particularly using the multilateration method, the length of the overlapping period and difference in the distance travelled between recording periods of WISPs could impact on whether distance prediction estimates generated overlapping circles.
The study investigated the range of BLE devices in an outdoor system, and the feasibility of applying BLE technology as a means of animal proximity and location monitoring within outdoor livestock systems and highlights some potential challenges for on-animal application.The calibration of the WISPs and beacons suggests that the species, their height and behaviour, as well as the beacon placement, and the environment of intended application will need to be taken into account when considering the effective BLE range within that particular scenario.In addition, variation in animal posture and the potential distance and speed at which they might travel over a recording interval will affect the likelihood of being reported, and the possible interpretation of BLE signal strength into distance.Whilst static BLE readers could offer a means of monitoring livestock proximity within range of known points within extensive systems, animal localisation, given the BLE ranges observed, would require many BLE readers.Hence a combination of BLE beacons and on-sheep roving readers, equipped with GNSS, may be more plausible.However, improvements in BLE range and accuracy would be required for practical application.In terms of real-time monitoring, whilst almost all data was transmitted during the static localisation study, data acquisition within extensive systems can be variable, with previous studies utilising LoRaWAN reporting data acquisition in the ranges of 46% (McIntosh et al., 2023) to 82% (Ojo et al., 2022), hence data loss and its potential effect on the interpretation of results will also need to be considered.However, depending upon the intended purpose of monitoring, the time frame for a recording period will alter, and it may also not be necessary for animals to be recorded on every occasion.This poses several questions, namely: what proportion of beacon loss is acceptable in terms of livestock monitoring, and does this alter depending on purpose?And how close do proximity and localisation estimates need to be? -particularly in more extensive sheep systems where a lower degree of resolution may be acceptable given the potential scale of farms.

Conclusion
The study reports on the calibration of BLE devices within outdoor systems, where BLE signal strength was found to decline with increasing beacon distance from a reader.As the height at which both the reader and beacon were located had an impact on the survival of BLE signals, when applied on-sheep, the functional BLE range will therefore be influenced by animal behaviour and posture.As proof of concept, the study then utilised developed distance prediction equations from RSSI values for the localisation of grazing sheep.
Whilst not yet too practical given the range and number of readers (WISPs) which may be required in more extensive settings, this study demonstrates that the application of BLE as fixed readers for animal monitoring and localisation is possible.Continued advances in the range of BLE devices, along with opportunity for data to be received in real-time through developments in IoT technologies makes BLE a potential tool for future development in this sector.

Fig. 3 .
Fig. 3. Off-sheep static beacon localisation study layout, indicating the 16 beacon global navigation satellite systems (GNSS) locations (A-P) within two adjacent paddocks, and the mean GNSS locations of wearable integrated sensor platforms (WISPs), labelled W1-6, along the paddock fence lines.

Fig. 4 .
Fig. 4. Example of the multilateration localisation method used within the static beacon localisation study and on-sheep validation, where: a) displays the predicted distances of beacon E, plotted as the radius of a circle from each wearable integrated sensor platform (WISP), denoted by W1-6, which reported the beacon, b) shows the estimated beacon locations -points where the circles intersected and which fell within the field boundary, c) shows the final Bluetooth Low Energy (BLE) estimated beacon location -the mean of points calculated in b, in comparison with the corresponding global navigation satellite systems (GNSS) estimated location.

Fig. 5 .
Fig. 5. Layout of the on-sheep validation showing the configuration of the two adjacent paddocks, and the mean global navigation satellite systems (GNSS) location of the 9 wearable integrated sensor platforms (WISPs) located along the surrounding fence lines.

Fig. 6 .
Fig. 6.Bluetooth Low Energy (BLE) signal survival curves generated from the offsheep calibration study.Where the y-axis indicates the probability of a beacon signal being reported by a wearable integrated sensor platform (WISP) beyond that distance.W0.3-B0.3indicates a WISP and beacon height of 0.3 m, W0.3-B0.7 a WISP height of 0.3 m and beacon height of 0.7 m, W0.7-B0.3 a WISP height of 0.7 m and beacon height of 0.3 m, W0.7-B0.7 a WISP and beacon height of 0.7 m, W2-B0.3 a WISP height of 2 m and beacon height of 0.3 m, and W2-B0.7 a WISP height of 2 m and beacon height of 0.7 m.

Fig. 7 .Fig. 8 .
Fig. 7.Comparison of the off-sheep calibration study regression lines of the estimated beacon distances calculated from received signal strength indicator (RSSI) for each of the WISP-beacon height group prediction equations.Where wearable integrated sensor platforms (WISPs) were tested at heights of 0.3, 0.7, and 2 m, and beacons were tested at heights of 0.3 and 0.7 m.

Fig. 9 .
Fig. 9. Comparison of estimated distances between wearable integrated sensor platforms (WISPs) and the lamb (beacon) during the on-sheep validation, calculated using Bluetooth Low Energy (BLE) -by applying prediction equation 2, vs distances calculated based on global navigation satellite systems (GNSS).

Fig. 10 .
Fig. 10.Comparison of distance between Bluetooth Low Energy (BLE) estimated lamb locations and corresponding mean global navigation satellite systems (GNSS) lamb locations (the localisation error) for both localisation methods.Star indicates the mean localisation error.

Fig. 11 .
Fig. 11.Comparison of distance between Bluetooth Low Energy (BLE) generated lamb locations and mean global navigation satellite systems (GNSS) lamb locations by the distance travelled group.Star indicates the mean distance (m).

Fig. 12 .
Fig. 12. Lamb trajectories from 0100 h -02:00 h comparing the full global navigation satellite systems (GNSS) data for the hour with Bluetooth Low Energy (BLE) trajectories using the multilateration and midpoint localisation methods.

Table 2
Off-sheep calibration study summary: total beacon readings reported per individual beacon.

Table 3
Summary of the Weibull accelerated failure time model of beacon distance to failure of being reported, based on wearable integrated sensor platform (WISP) and beacon height during the off-sheep calibration study.

Table 4
Total number of received signal strength indicator (RSSI) readings (out of a maximum possible 24) for each wearable integrated sensor platform (WISP)-beacon pairing during the off-sheep static beacon localisation study.

Table 5
Summary of the off-sheep static beacon localisation study, indicating the number of wearable integrated sensor platforms (WISPs) reporting each beacon, and the associated localisation error.

Table 6
Summary of the on-sheep validation, indicating the number of wearable integrated sensor platforms (WISPs) reporting the lamb's beacon within any independent 5minute interval.

Table 7
Summary of the number of lamb locations generated within the on-sheep validation, by localisation method.Abbreviations: WISPs = wearable integrated sensor platforms.