Skip to main content

The Story of LLRP2HRP - Part 2

So, this brash American dude who ran a relay race event decided to go fancy. None of this using phones to manually scan NFC chips for race timing. He was going to have chips in bibs. He convinced another organisation that also ran races to chip in some funding ... and then went online.

He found an RFID reader system. The kind of ground mats that you run over, that connects to a box that goes beep. It was from China. It was insanely cheap. Like fall-off-the-back-of-a-truck cheap. It was delivered, hardware checks out.

It came with no software.

Last time, we'd figured out that it also provided RFID tag information using a proprietary binary protocol and were trying to lock down exactly what that was.

It was one of the most arduous Google sessions I've had for a while. Trawling the entire web for some document or code that probably only existed inside an office in Shenzhen. But I found something! It was amazing, because of the source, and how perfectly it fit my needs.

Under the Office of the President of Bolivia is a small agency, La Agencia de Gobierno Electrónico y Tecnologías de Información y Comunicación (AGETIC). One of the projects the Bolivian government had worked on was tracking fuel truck movements and car insurance with RFID labels. AGETIC was given the task, and as they are open source supporters, provided their code on a hosted version of Gitlab.

In their repositories was one called 'hrp', and I finally learned the name of the protocol: Hopeland Reader Protocol. HRP was written in python, had almost no dependencies and within a few minutes of discovering it I was able to connect to the RFID reader for the first time. I immediately sent a thank you email to the code's author, Arturo Hernandez. This project just became achievable.

I was amazed by the power of the reader. RFID tags hidden deep in my room that I've yet to find lit up.

Of course, getting tags off the reader was just part of the problem. To support race timing, that data needed to be fed into a race timing system. Webscorer is the tool of choice for trail races in Taiwan, and they have long supported automated timing with RFID. Only, they used the standard protocol, LLRP.

Expecting nothing, I fired off an email ("Working with non-LLRP RFID readers") to the support alias at Webscorer, just to see if they had any advice or unreleased plans. In less than an hour, the CEO of Webscorer (no less!) responded and provided sage advice. Less than two hours after my original email, I had a copy of the internal code Webscorer uses for processing LLRP.

A plan formed. I could make a server that faked enough LLRP to make Webscorer happy and tie in the tag data using the HRP library. With the code Webscorer provided I could see which portions of the protocol they needed and debug the app. Crucially, at this point I also found that wireshark had a plugin for LLRP, which is where I would spend a lot of my time later.

So, next question - was there open source LLRP server software out there I could hack to make this work? After a thorough Google, the answer was sadly not. I really didn't feel like working with the Java in LLRP toolkit, and basically everything else out there were clients.

However, Ben Ransford, an engineer at Stripe had made a very well designed open source python client for LLRP called sllurp. It separated the protocol definition and encoding/decoding from the rest of the 'client' bits. I figured I'd have to extend the protocol definition and add a few new methods, but the core functionality of an LLRPMessage should be reusable... and it was.


Comments

  1. Hi Tom, did you get this working? I'll explain, I'm building a distributed NFC scanning system for timing (it's open source, details here www.dartdata.uk), however being able to use webscorer with it is the holy grail. Many thanks, Tim

    ReplyDelete
    Replies
    1. Hi Tim,
      Yes, it works! I have timed a couple races with it. Let's collaborate.

      I've sent you my details via the form on dartdata.

      Delete
  2. Hi Tom,
    What a great article. I am knee deep into building a simple android app that connects to a reader and then send the reads to a cloud database. I's just proving extremely difficult to find a working library for android. Do you have any thoughts? Love to get into contact with you! Hope this blog is still active.

    ReplyDelete
    Replies
    1. Thanks for your kind words Maikel. Perhaps send me a request on LinkedIn or Twitter and we can chat there: https://tw.linkedin.com/in/tomfifield https://twitter.com/TomFifield

      Delete

Post a Comment

Popular posts from this blog

How to transfer money from Taiwan without going to the bank

We live in a digital age. The Taiwanese banking system ... a little less so. Transferring money overseas typically involves a visit to the bank between 9am and 3pm. You'll queue, fill out an outbound remittance form in duplicate, stamp and sign some things and just generally wait while staff do their best with the unfamiliar procedure. There is another way.* * for transfers < 500,000 TWD, to accounts you've previously set up in a special way :(  Background: Remittance Classifications One of the reasons for the myriad of complicated forms when dealing with foreign exchange in Taiwan is the precise codification of transfer types required by the Central Bank. Your knowledge of the existence of these two documents will boost your standing above that of the average banker: 匯出匯款之分類及說明  Code and Description of Outward Remittance Classification 匯入匯款之分類及說明 Code and Description of Inward Remittance Classification These are updated every few years, with new versions fou

How to flash Seeed Wio-WM1110 Dev Kit with Meshtastic

The Seeed Wio-WM1110 Dev Kit is an nRF52840-based LoRa® transceiver with built-in GPS, Temperature/Humidity sensor and supports solar and battery power. Unfortunately, unlike many Meshtastic devices, this board cannot be flashed using USB. Instead, you require an external device that can connect via SWDIO. Luckily, if you have a Raspberry Pi around this is surprisingly straightforward. 1. Set up Wiring Connect GPIO pin 11 on your Raspbery Pi to the CLK pin on the Wio-WM1110. Connect GPIO pin 8 on your Raspbery Pi to the DIO pin on the Wio-WM1110. Ensure you get the GPIO numbers correct. Plug in your Raspberry Pi to USB power. Plug in the Wio-WM1110 to USB for power. 2. Install OpenOCD OpenOCD is the program we'll use for communicating with the Wio-WM1110. Install it on your Raspberry Pi. $ sudo apt update $ sudo apt install libtool autoconf automake texinfo telnet gdb-multiarch git $ git clone git://repo.or.cz/openocd.git $ cd openocd/ $ ./bootstrap $ ./configure --enable-bcm2835

How to play Monster Hunter: World on Linux

The release of Monster Hunter: World on PC has broken records. Powered by the unfamiliar MT Engine, Linux users were worried that they might miss out on the experience. Luckily, some got it working on day 1 (hat tip Vahron and all the users on the reddit thread). Here's a way to get it working :) Upgrade to Ubuntu 18.04 Bionic Beaver. The previous release, 17.10 Artful Aardvark didn't work for me. Install lutris . Lutris is a launcher for games on Linux. There are so many different wine versions and configuration options. Lutris manages them all for you and has installers with 'known good' configurations. Open lutris and install the 'Wine Steam' runner. (Lutris -> Manage Runners -> Wine Steam -> Install). This will let Lutris run games via a wine-installed version of steam Manage the wine version of lutris to install esync-3.13 . (Lutris-> Manage Runners -> Wine -> Manager versions -> Tick esync 3.13). This will make the latest high