Virtual Herder

A smart, affordable, open-source livestock monitoring system to help combat health problems and livestock theft.

Similar projects worth following
Two of the biggest problems faced by livestock farmers in Southern Africa is disease and livestock theft. While the small number large scale commercial farmers can afford to invest in expensive security measures and monitoring systems to combat this, thousands of small scale farmers are vulnerable. To them every head of cattle, sheep or goat that dies or gets stolen is a serious setback.

This projects aims to develop a low cost, open source monitoring system that consist of wireless collars/tags which transmit data to wireless field collectors, which then sends the data to a central processing system. The tags/collars monitor the the activity, vital signs and location of livestock which can be analysed to provide accurate early detection of health problems and theft attempts, allowing for quick response.

The Problem

Millions of people in Southern Africa live in rural areas and depend on livestock farming for their livelihood. Livestock diseases and theft does not only affect the farmers, but the entire community as well the local economy and food security. In 2015/2016 their was approximately 25000 reported cases of livestock theft in South Africa. The real number is much worse, since it is estimated that 70% of actual cases are never reported, due to a lack of faith in law enforcement. (Source) This all adds up to a total cost to the economy of R 870,000,000 (US $68,000,000).

How theft takes place depends on the type of livestock. Cattle are often simply slaughtered in the field at night and the carcasses are cut up and loaded onto pickup trucks. Sheep and goats are usually just tied up and loaded onto small trucks or crammed into the back of a pickup.

Serious health problems can often be avoided by detecting the signs, early and treating it quickly. Unfortunately giving every single animal a daily health check is simply not possible.

Project Goals

Develop a system of network connected wireless tags that can be worn by livestock that monitors their health, activity and movement and can detect when theft is taking place.

While there are systems available that aim to address the problems listed above they tend to be expensive to implement and not necessarily effective in actually solving the problem. My aim is to create an open source, affordable, solution that is accessible to just about anyone, even the small scale subsistence farmer with a few animals.

This would allow the farmer to more efficiently protect and take care of his animals, irrespective of the number. Breeding and health of a herd can be improved based on the data collected, helping to even out the playing field between small and large scale farmers. Livestock theft would be discouraged, and assist in apprehending thieves and dismantle syndicates whose actions not only negatively affect the farmer, but also the wider economy. Increased costs to the farmer translates into increased food and other animal product prices, which affects everyone, especially people living in poverty. In short, happy farmers mean happy communities and better economic growth.

For the system to be viable, it would have to meet the following requirements:

  • Low Cost: It must be affordable and worth the investment to the people who really need it
  • Adaptable: The system should be adaptable to whatever livestock type and circumstances it is needed for
  • Low maintenance:The system should not require regular battery changes or repair.
  • Durable: The tags will have to endure being worn by livestock in harsh field conditions
  • Smart: The system must be able to efficiently analyse data and quickly detect any health issues or theft.

Concept Design

Individual animals will be equipped with low power wireless sensor modules, in the form of a collar or ear tag. These modules will consist of a micro controller, sub-Ghz radio, and a host of sensors. The sensors will be able to detect movement (accelerometer), body temperature, heart rate and location (GPS). The module will be optimised for low power usage allowing it to operate on battery power and/or energy harvesting (super caps and solar/piezoelectric/thermoelectric generators) for extended periods of time (months-years).

The data collected from these sensors will be transmitted to solar powered collectors that are deployed in the field. The collectors will relay the data to a base station which will upload the data to the cloud that will handle analysis, to send the farmer or farm workers alerts when needed and allow them to view the data. If reliable GSM coverage is available in the area, the collectors can upload the data directly to the cloud, omitting the need for a central base station.


Read more »


Schematic for ESP32 Dev Board with sensor breakout boards

Adobe Portable Document Format - 46.51 kB - 10/15/2017 at 20:04


Virtual Herder Business Plan.pdf

First draft of my business plan for Best Product

Adobe Portable Document Format - 54.88 kB - 07/24/2017 at 00:51




Adobe Portable Document Format - 134.17 kB - 06/11/2017 at 19:09


View all 7 components

  • MAX3010x heart rate sensing tests

    Danie Conradie10/15/2017 at 20:46 1 comment

    I played with the MAX30105 breakout from Sparkfun to see what it will take to measure heart rate optically. The sensor has a red, green and IR LED and based on the amount of light reflected back to the sensor it should be possible to do, among others, optical heart rate sensing. Although the MAX30105 is technically a particle sensor, as far as I can tell from the data sheets it is identical to the MAX30101. The MAX31010 is specifically a heart rate sensor according to Maximum Integrated, but the only difference in the datasheet is the name and descriptions of some of the registers.


    The Sparkfun Arduino library for the MAX30105 makes it quite easy to start up the sensor and start testing. An example sketch is included to measure heart rate, so that’s what I used. I’m not here to reinvent the wheel, right? The sketch makes use of the amount of reflected IR light to determine when a heartbeat occurred. Below is a graph showing the values for reflected IR measured while holding my finger on the sensor.

    The graph clearly shows a repeating pattern in the measured reflected IR values. A bit of signal processing later and the sketch spits out a heart rate. This all looks great, but this project will not be used under laboratory conditions. These results were measured with me sitting still and keeping constant pressure on the sensor. Even in these ideal conditions, notice on the second half of the graph that the whole signal gets shifted up and down a bit. This is due to slight pressure differences of my finger on the sensor, making slightly more/less IR get reflected. Some signal processing could probably easily take care of slight differences in pressure on the sensor by detrending the signal or using a similar process.

    The sensor would need to be fixed/held to the animal’s skin to enable measurement. If the device is worn as an ear tag, the sensor could be placed on the skin inside the ear. This would probably be the easiest place to access skin with little hair that could make measurement difficult. If the complete device is worn around the neck, wire will have to be run from the collar to wherever the heart rate sensor is placed. This does not seem practical or durable for livestock. The skin on the inside of the ear will also be thin, with the blood vessels close to the skin, which should also improve the result. I'm guessing thin skin will yield more accurate results than thick skin.

    Some last thoughts relating to the use of optical heart rate measurement in practical applications: given conditions where the sensor can measure good quality data, optical heart rate sensing seems quite viable. The difficulty will lie in placing the sensor in such a location and fixing it in place reliably so that good data can be captured. This will have to be solved through trial and error and attaching the tag to an animal.

  • Long Range Connectivity and MCU Update

    Danie Conradie10/15/2017 at 20:27 0 comments

    Long Range Connectivity

    For roaming animals long range communication is a must. Two different radios have been considered:

    • Texas Instrument CC1310/1350 SOC
    • RFM95W LoRa module

    The TI CC1350 which was previously discussed is still a good candidate, but I have found that it does not have quite the community around it to help relative beginners like myself. I shelved it for now.

    I have decided to go with the RFM95W LoRa module for long range communications. This is the module on the Feather Dev boards that I previously mentioned. The main reason for this is the “openness” of some of the LoRa based IoT frameworks, specifically The Things Network. There is are plenty of tutorials online and quite a hacker community around LoRa. I believe that LoRa based networks can be extremely valuable to farmers due to the massive range of possible applications in agriculture. It allows neighboring farmers to share the same network for different applications. I want to avoid going with a connectivity solution that is “unique”, since that would negatively affect adoption and interoperability.


    I have shifted my development work to the Espressif ESP32, mainly because it has BLE capability and is compatible with both the Arduino IDE and Micropython.

    I have found Micropython to be an absolute pleasure to work with. The built in REPL is extremely handy for testing ideas, code and sensors. Unfortunately there are stills some capabilities missing from the current version. So work is happening mostly with the Arduino IDE, which has the obvious convenience of libraries for some of the sensors I am using.

    I wanted to get to know the ESP32 better anyway since it is perfect for some other projects I have planned due to it’s large array of features.

    The project might move to another MCU later on, probably one of the many ARM based MCUs.

  • The Case for Bluetooth (BLE)

    Danie Conradie10/15/2017 at 20:21 0 comments

    I believe that BLE (Bluetooth Low Energy/Bluetooth 4.2) can be very handy for animals that are kept in relatively small areas (E.g. dairy cows) as well as for animals that roam large areas (E.g. field grazing sheep/cattle). 

    For animals in confined areas BLE can be used to transfer all data and since they should always be close to a base station. Since all smartphones and tablets are equipped with BLE it allows interfacing with individual tags directly without special equipment.

    For roaming animals the applications for BLE gets more interesting. Since cattle, sheep, and goats tend to move in herds, BLE advertising and/or Bluetooth Mesh can be used to monitor herd behavior. The different tags in a group equipped with GPS can take turns to fix locations, so that the power consumption for each individual tag is kept to a minimum while still maintaining an accurate fix on the herd as a whole.

    When an individual animal or group breaks off from the herd, it can be quickly determined by checking which animals are still within BLE range of each other and adapt the GPS usage accordingly. GPS usage can be even further reduced by placing BLE beacons in fixed locations to track animal movement.

    For these reasons I plan to use BLE enabled MCU’s as the base for all future versions of this project. I will also be looking at Bluetooth 5 capable modules to allow upgrading as time goes on and it becomes more widely implemented. 

  • Sensor Hardware Update

    Danie Conradie10/15/2017 at 19:59 0 comments

    The hardware for field testing has been narrowed to the parts below:

    • MAX30105 (Sparkfun Breakout) Particle/Heart rate sensor: Technically the MAX30101 is for optical heart rate measurement, but as far as I can tell the sensors are identical. ALL the registers are identical, just the names and descriptions in the datasheets differ in some cases. The idea is to measure the heart rate on the exposed skin inside the ear of an animal
    • MPU9250 9-axis IMU (Sparkfun Breakout): Widely used IMU with integrated 3-axis accelerometer, 3-axis gyroscope and 3-axis magnetometer/compass. Used to detect movement and possibly do some intelligent activity recognition. Other lower costs sensors might be considered later but the Sparkfun unit is convenient for testing.
    • LMT01 Temperature Sensor: Ideal for creating a temperature probe to insert into the ear canal of an animal to measure body temperature. The sensor comes in small TO-92 package with a digital pulse train interface.

    GPS will not be in the basic unit, but rather an optional extra where the application requires it. This is mainly due to the additional cost and current consumption of a GPS module. The two units with the lowest current consumption and a small form factor I have found so far are:

    • OriginGPS ORG1410 Hornet: A tiny 10x10x5.8mm GPS module with an integrated antenna. Low current consumption
    • Quectel L70: Small GPS module. Does not include an antenna

  • Business Plan

    Danie Conradie07/24/2017 at 00:54 1 comment

    The first draft of my business plan has been uploaded under the files section as part of the Best Product entry requirements. 

    It is the 2nd business plan I ever wrote, and the experience was very rewarding. I I used this template to get a rough idea of what questions I should be asking myself. I also found the Virgin Startup Business Plan Template to be a valuable resource

    Now for some sleep.

  • Basic logic overview

    Danie Conradie06/11/2017 at 17:46 0 comments

    A basic idea of how data is collected and used. One of the critical points is that the data is analysed in conjunction with the data from the other tags in the herd. A single animal suddenly moving is not necessarily significant, but if a couple of animals do so at the same time, it can be reasonably assumed that there is some sort of disturbance. When there is a spike in heart rates as well, it would indicate a threat.

    As previously mentioned, body temperature and pulse is are a good indication of the health of a animal. Analysing the data of the IMU can also be used to identify the following:

    • Cows that are in heat, commonly detected by increased activity
    • Sleep
    • Ruminating (chewing the cud). It is also a indication of health and stress levels.
    • Grazing

  • Testing Platform Schematic

    Danie Conradie06/10/2017 at 22:42 0 comments

    I did a basic schematic of the four sensor that I will be testing with the Adafruit Feather 32u4 LoRa. I'm using EasyEDA since it is cloud based and therefor really convenient when working from multiple computers. I have the GPS and IMU already, and I'm currently getting to grips with interfacing them with the Feather. Still waiting for the pulse sensor and RTD probe and amp breakout.

  • TI CC1350 SensorTag

    Danie Conradie06/08/2017 at 21:21 0 comments

    A quick overview of the CC1350 Sensortag development boards that arrived today. I must say they pack a lot of capability into a very small package (42x32x5mm), at a affordable price.

    On board:

    • TMP007 IR thermopile and ambient temperature sensor
    • OPT3001 Ambient light sensor
    • HDC1000 Humidity sensor
    • BMP280 barometric pressure sensor
    • MPU-9250 Accelerometer, gyroscope and compass
    • MK24 reed switch
    • SPH0641LM4H-1 microphone
    • ON board antennas for both the BLE and Sub-Ghz radio, as well as connectors for external antennas
    • 2 buttons
    • Coin cell battery holder

    Connecting the sensors to my smartphone is as simple as downloading the TI app, pulling out the battery tab.

    The boards also come with nice little enclosures. In the photo the module on the right has the Debug-DevPack added on top of it, which breaks out the remaining pins to a 1mm pitch header as well as some pads for grove sensors. It is also required to do firmware programming and debugging. It connects to the sensor tag via a hermaphroditic "SKIN connector". All the design files are available on the TI website, so designing my own DevPack to connect the other sensor I require should be relatively simple. I was able to get some free samples of the SKIN connectors which I will use for this purpose.

    The board is actually the perfect size for testing as a ear tag. So the plan is to make a DevPack with the other sensor I require and make a enclosure that would allow use as a ear tag or collar. The GPS will add a bit to the size, and eat the coin cell for breakfast, but it should be enough for some quick testing. In short I believe this dev kit will be extremely handy for both this project and my FireBreakNet project.

  • Design overview

    Danie Conradie06/07/2017 at 23:22 0 comments


    I will be relying primarily on a accelerometer, heart rate monitor and a GPS for theft detection and response. Since the majority of thefts happen at night when the animals are resting, the accelerometer will allow any major disturbances to be easily detected. Especially when multiple animals in a herd suddenly start moving simultaneously, with increased heart rates, it likely indicates some external disturbance. When major movement is detected for a certain amount of time, the GPS will be activated to pin the location and forward it to the base station. This will allow the power consumption to reduced since GPS will only be activated when the animal is moving.

    For testing I selected a MPU-9250 intertial measurement unit and a Ublox Neo-7M GPS module.

    Temperature and heartbeat sensors can also be added to enhance the tags capabilities. They can be a very good indication of the health of the animal. Heartbeat especially can be a good indication of the animal's stress levels. These two parameters will also clearly show if a tag is removed. Another simple method to detect this is to add a thin wire connection that will be broken when a tag is removed.

    I have ordered a PT100 RTD precision temperature probe with amplifier module for initial testing. It will probably only arrive later this month. I have yet to order a heart beat sensor, but am looking at this one for testing. Of course the challenge will be to see if the see if sensors work as expected on animals.

    Ear tag or collar?

    To enable the implementation of heartbeat and body temperature sensors, a ear tag unit will be the optimal solution. It allows easy access to the animals ear canal for a temperature probe. From a ear tag the arteries just under the skin of the ear is easily accessible. This could allow the use of optical heart beat sensing to be used. Since ear tags are already in use on most farms, fitting animals with tags should be relatively simple.

    The ear tag does have some disadvantages however. Firstly it limits the size and weight of the tag severely. An ear tag should be as small and light as possible. Secondly the constant movement of the animal's ear would cause the accelerometer to readings to be very "noisy" possibly limiting it's usefulness A collar will allow a more stable platform for the accelerometer that would allow much "cleaner readings" but makes implementing the temperature a and heartbeat sensors much more difficult.

    I will test both approaches first, before looking at more complex/expensive solutions like using both a collar and an ear tag.

    Any advice/suggestions are welcome!

  • Microcontroller and Connectivity

    Danie Conradie06/07/2017 at 22:34 0 comments

    To get up and running quickly for this project I decided to use off off the shelf modules wherever possible for initial testing to make plug&play prototyping with a breadboard easy.

    Microcontroller and radio

    I will be using Adafruit Feather 32u4 LoRa dev boards for initial testing. They were available form my local supplier, so I could quickly get my hands on them. The boards have a 868Mhz SX1272 LoRa radio module onboard, as well as Lipo battery charger. I have no experience with ARM boards, so decided to stick with the 8 bit ATMega version of the board for a start, which I have some experience with.

    The other MCU/radio combination I will be testing is the new Texas Instruments CC1350 Dual Band Wireless MCU. It integrates an ARM M3 processor, a Sub-Ghz radio, BLE radio, and an interesting low power 16 bit "Sensor Controller" processor on a single chip. This chip is also available in a version without BLE, as the CC1310. Although the learning curve to get this chip working for my purposes will be much steeper, I believe there is a lot of potential.

    TI claim that the chip is extremely low power, as well as long range with the Sub-Ghz radio. The BLE allows for Over-the-Air updating from a smartphone/tablet, which can be very handy in the field. The on-board "Sensor Controller" is a very low power 16 bit processor that can function to independently check sensor inputs, and only wakes up the powerful ARM processor when absolutely necessary.

    I have ordered the CC1350 Launchpad Dev board, which I intend to use as a gateway for testing, as well as 2 CC1350 SensorTag dev kits, which integrate 10 environmental sensors and a coin cell battery holder in a very small package. The SensorTags also allow add-on boards to be added on top of them. The TI website has some very detailed tutorials and examples which will hopefully speed up development.

    I must give some credit to Shantam Raj with his SUN Project. I was introduced to the CC1350/CC1310 chips while reading his project logs.

    GSM connectivity

    I am considering adding a GSM modem as a modular add-on to the tags, to extend the range. My motivation for not making this standard on every tag is as follows:

    • It would increase the cost and power consumption, even if only slightly. I want the tags to be as cheap as possible, to make equipping every single animal on a farm a viable option.
    • Some of farms are extremely isolated and might not have GSM coverage.
    • Tags can be cut off by thieves, and often cattle are simply slaughtered in the field where they graze. Therefor my focus will be on detecting theft/disturbances as they start, not after it is done

    Where GSM is available, some of the tags in a group/heard can have the GSM module installed, to allow that particular tag to also act as a gateway for the other tags within range of the Sub-Ghz radio, snd so extend the detection range.

View all 10 project logs

Enjoy this project?



Yair wrote 11/12/2018 at 12:56 point

Hi Danie, Did you use oxullo's lmax3010x library to interface the esp32 with the pulse oximeter? If so I might want to consult with you regarding this.

  Are you sure? yes | no

Danie Conradie wrote 10/16/2017 at 18:56 point

Thanks! Just do it

  Are you sure? yes | no

mrC77 wrote 10/16/2017 at 18:17 point

Hi Danie,

I have similar interest in doing a project like the Virtual Herder. My main goal also is to cater to those farmers who want to keep things basic and low cost. keep up the good work..

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates