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 apply for Taiwan's Employment Gold Card

In February 2018, Taiwan launched an "Employment Gold Card",a combination of residence visa and work permit. Aimed to attract more high level professionals, the card has strict application requirements. Here's some information on those and a step-by-step guide on how to apply (see also: official guide ). Do I qualify? You must have worked in one of the below eight fields, and met requirements within the field. This is a very brief unofficial summary not to be relied on - please refer to the supporting document for your field for the official information. Other than law and architecture you only need to meet one of the criteria, and most have a catch-all entry for "other" qualifications as approved by the relevant ministry. Salary references are monthly. This post was updated in October 2019 with to reflect relaxed qualifications in Sport and Culture.   Field Requirements Supporting Documents Science and Technolog

How to work with Packages at Taiwan's convenience stores

A service provided by the major convenience store chains in Taiwan is to use their network to send a package from one store to another.  This post is an aggregation of information about working with packages across the various chains.  Family Mart To know when to receive your package, visit the Famiport tracking site , enter the 11-digit tracking number and pay attention to the status, which is listed with the most recent status at the top of the page. You will see the following in order:   訂單成立未寄件  - paperwork completed 已完成寄件 - sent from the origin 貨件前往物流中心 - on the way to the distribution center 貨件抵達物流中心 - at the distribution center 貨件已完成理貨 - sorted 貨件等待配送中 - awaiting delivery 貨件進行配送中 - out for delivery 貨件配達取件店舖  - delivered   If you see 查無訂單資料 your tracking number was not found in the system. Check you are copying and pasting the correct number (11 digits).    7-Eleven To know when to receive your package, visit the tracking site , enter the tracking number and pay attention to the