eIDShepherd: Sheep Tagger

By Russell Barnes. Posted

The Raspberry Pi might have been to space, but it’s also proving its worth back on Earth, where in a muddy field an RFID hacked Pi is being used to tag sheep

We see all kinds of cool gizmos built with the Raspberry Pi, but what really thrills us is to see our favourite computer being used to create practical projects that are useful in the real world. You don’t get more real than sheep herding in North Yorkshire.

A few years ago, Dr Paul Buckley swapped intensive care for small‑scale farming in Scarborough. He now has a flock of around 150 sheep.

Like all farmers, he keeps an eye on his sheep, but from last year it has been compulsory for farmers to tag sheep with eID (electronic identification) chips. “All sheep in the UK have to have ear tags,” Paul tells us, “one of which is yellow and contains a transducer holding the details of the animal.

“It’s similar to the microchip identification that’s common in dogs and cats,” he explains.

 A compact RFID circuit that uses a USB board to scan for RFID tags

The specification for the sheep tags are tightly controlled, and the reader has to operate at 134kHz. “Sadly, this doesn’t allow the extremely cheap and easily available dog and cat chip readers to work, because they operate at a different frequency,” says Paul. “The commercially available readers aren’t cheap [£700 - £5,500], and this is prohibitively expensive.”

The breakthrough arrived when Paul investigated commercial RFID readers. “I came across a supplier in Australia who makes an RFID reader card for the princely sum of about £25,” says Paul. “Primarily designed to be used with a laptop PC, the card has a serial data output through a USB connector and in that mode works exceptionally well. I decided that a fully portable reader that could be easily carried and available for tag reading in the field would be very useful. The project was born.”

 The finished product looks like a paddle but is perfect for waving over sheep

The Sheep Tagger is officially called the eIDShepherd – an eID ear tag reader for sheep. “My wife calls it the ‘cricket bat’,” laughs Paul. The heart of the Raspberry Pi is a RFIDRW-E-USB module, Adafruit 16×2 LCD display, a DS1307 clock module, and a piezo buzzer.

“I found, to my surprise and delight, that numbers appeared on the screen when I wafted an old sheep tag over the aerial of the reader module,” recalls Paul. “My wife failed to see why I was excited. I persevered and learnt how to manipulate the data string to produce CSV-compatible output, and then how to create and append it to a text file on the SD card.”

There were some challenges in turning the equipment into a fully working sheep tagger. “I discovered I needed a clock when, for the first time, I ran the Raspberry Pi off batteries and disconnected from the internet,” says Paul. “The biggest issue was getting the device to emit an audible beep on successful read of the tag.” The workaround was buzzer hardware attached to a GPIO pin of the Pi Zero. This is momentarily set high when a data string detects the serial input.

 The tagger in action. Information is saved to file to be examined later

The total cost for the final project was less than £60, much less than a commercial device. “We collect the sheep in a pen and put the tip of the Sheep Reader close to the yellow tag in the sheep’s ear. A bright blue LED on the front of the device blinks momentarily and an audible beep confirms the data acquisition. When I get home, the data is downloaded from the SD card as a text file.

“We’ve had no problems in the field,” continues Paul. “We’ve been using it alongside a laptop to ensure that there are no bad reads or missing data, but all the reads have been correct and the two systems have correlated perfectly. I am now confident to use the Sheep Reader as a standalone device.”

From The MagPi store


Subscribe to the newsletter

Get every issue delivered directly to your inbox and keep up to date with the latest news, offers, events, and more.