We create a system of electronic timekeeping races
On weekdays, I have been developing corporate software for 17 years, I had many different hobbies, but in the end I found something that has been holding for 5 years and is not going to let go. Since 2013, I devote most of my free time to motocross and enduro on off-road motorcycles, including regularly participating in amateur competitions. After an unsuccessful drop in June 2017, I ended up in the hospital with a complete fracture of the right humerus. I left the hospital, came to my senses and it became clear that the ride would not work for another two or three months, but the habit of active activity remained. Then I decided that I should try to organize the race for my friends myself. From a technical point of view, I was interested in timing, about how I make my own system and spend the race read under the cut.
During the month in the evenings he wrote the first version of the judicial program. I used C # and WPF for implementation, simply because I know them better and I don’t have to waste time studying the documentation. The program could record participants with start numbers, divided into classes and races. During the race, it was necessary to keep up with our hands to drive in the number of the participant who was driving through the finish line. Everything worked well, and given the small number of participants in the first race (about 40 people), it was easy to count all hands.
However, as a programmer, I wanted more automation, I don’t like manual chore, and it’s already quite difficult to record a race with a hundred participants. As a result, in 2017 he spent another stage, where there were already 3 separate classes and more than a hundred participants, the event was quite successful and it was decided to use an electronic serif for the next season.
The picture shows a modern version of the program with support for RFID and remote control from a smartphone. In the first version there were much less elements.
Equipment selection
Of course, this topic is not new, there are many ready-made options, but most of them are not very suitable for the price. For example, the professional racing timekeeping system from the Italian company AMB costs approximately € 13,000 and has 20 rolling transponders in the set. Each additional chip costs 100 € and they are disposable, that is, after 3-5 years, when the battery dies in them, it cannot be replaced by a regular method. The rest of the system is excellent, is used in all world races, has an accuracy of up to thousandths of a second, and so on. For a hobbyist who organizes races for friends in his free time, this system is not suitable. I also found a lot of ready-made timekeeping systems for marathons, triathlon and other similar competitions. Systems used RFID tags. But they were confused by the specifics - people finish the marathon at best at a speed of 20km / h, and in motocross it is customary to give the finish on the largest springboard, which is reached at a speed of 70-80 km / h. But the price of RFID tags at about 11 rubles per piece allowed them to be distributed in any quantity.
We use RFID
In general, the RFID technology was not originally designed for notching races, if you read the specifications of the chips and readers, you can find restrictions on the speed of the chip relative to the antenna in a few meters per second. But I knew that such a system had been successfully used for many years in the famous racing series xsr-moto.ru, in which I myself participated many times and had their RFID tags on the helmet. Sergey Mindin, the organizer of the series, kindly shared the information and pointed me to the website motosponder.com, where he acquired his notch.

This helped determine the choice of the first reader - Alien Technology F800, because I knew that it would work in the conditions I needed. In addition to Alien, I considered Imping Speedway Revolution R420 and looking at the quality of the SDK and the documentation was going to buy it. But in the end I stopped at the F800 as a deliberately proven solution.
The reader cost me about $ 1600, I bought in Moscow, I immediately bought two antennas and 5 meter high frequency cables to them. An unpleasant surprise was the price of RF cables. A 10 meter cable will cost more than the antenna itself, and it is also easy to break it, for example, bend or crush it with your foot.
Solution: buying a complete set of equipment and software from motosponder for $ 3500 is expensive and not sports. It is necessary to buy only the equipment, which cost about $ 2,200, and write the software yourself. What can there be difficult? :)
Looking at the prices above, a logical question arises: was it possible to save? Buy a Chinese reader, the prices of which start from $ 200. Such thoughts were, but there was also a thought that I had a very limited time, and the stability of the final design and ease of development was important. Before that, I had no practical experience with RFID and had no idea what physical limitations I might face. Therefore, the idea of Chinese readers was postponed, but not forgotten.
RFID Options Overview
RFID is the generic name for a whole family of technologies that differ in frequency and data exchange protocol.
- LF RFID - kilohertz range, low range and reading speed.
- HF 14 MHz - usually these are “magnetic” passes to the building, intercom keys, contactless payment cards, NFC phones. In general, a very common frequency, but the connection radius is up to one meter. Again, not suitable for my case. However, I know one perfectly working timekeeping system built on smartphones and metro cards. Only to mark the rider, he must stop and the judge must attach the phone to the label.
- UHF ~ 840 - 930 MHz is the range on which all the timekeeping systems of mass events are built. In optimal conditions, the tags are read at a distance of more than 10 meters, the data transfer speed is enough to read tags 50 or more times per second, the waves of these frequencies are not so much absorbed by water as the next band.
- UHF 2.4 GHz - maybe I was looking badly, but I concluded that this frequency is an invention of the Chinese, because I did not find such readers from brand manufacturers. In any case, I decided not to use this frequency, because it is too well silenced by water, mud, fog and other interferences.
A little more detailed description of frequencies and standards can be found at the following link rfidcenter.ru/page/frequencies-ranges
UHF RFID
And so, I concluded that the best option for my application is the UHF band, depending on regional restrictions, these will be frequencies from about 840 to 930 MHz and the number of channels from 2 to 30.
My F800 is designed for the European region and is configured to operate in the range of 865-867 MHz. Together with the reader, I bought several different tags, they all had the characteristics of long-range manufacturer's description, the specific range and speed of reading are usually not written anywhere. highly dependent on conditions. I spent quite a few experiments reading different tags, in different numbers and configurations of antennas. Here are the concise conclusions:
- In the open area, if you precisely orient the tag to the antenna, it is quite possible to get a stable reading at a distance of 10 meters.
- The shape of the field at the antenna looks like a drop, so the most confident reading is obtained at a distance of 3-5 meters from the antenna - in the widest part of the drop. Of course, the shape of the radiation pattern depends on the antenna model, I used flat panel antennas with a declared gain of 10dbi, 60/65 ° antenna31.ru/?product=rfid-panelnaya-antenna-pa868-10-rhcp
- Antennas are circular and linear polarized. With linear polarization, the reading range is much longer, but the orientation of the label must coincide with the orientation of the antenna.
- All “long-range” tags work approximately equally. Here you need to clarify that I used the labels of one brand - Alien, maybe they are all on the same chip.
- Include the maximum transmit power is not always the best solution. At home in a small room, due to the reflections, the reading speed dropped very much. The same can happen in open space, if two antennas look at each other, they will work as mirrors.
- In general, with RFID, more problems happen from too much power and reading range than vice versa. If you “shine” in the field at maximum power, you can get a lot of random readings from a large area (tens of square meters). Therefore, it is important to adjust the power and location of the antennas so that the reading is carried out on the smallest area.
- The speed of reading tags depends on their number in the field of view of the reader. Captain statement, but I changed specific numbers for optimal conditions:
- One mark - 50-70 / s
- 5 or more tags - 250-280 / s
- Approximately 280 reads per second - this is the limit for any number of tags in the field, and of course, if there are several dozen tags, the speed will drop dramatically due to collisions
- The label on a real motorcycle moving at a speed of more than 80 km / h is readable, but not in any position, it is desirable that the label and antenna be oriented in such a way as to look a little at each other. For example, the antenna is slightly directed towards the rider, and the label is pasted somewhere on the front of the motorcycle. At lower speeds, the mark and antenna can be strictly perpendicular to the track.
At this stage, everything looked good, 50 readings per second meant that the average time between reads was 20 milliseconds, but this also had to be checked. The program for collecting statistics was supplemented by calculating the time difference between readings; it derived the worst, best time, and eight fractions measured in milliseconds. It turned out that the reader is reading far from evenly. This is due to the protocol, according to which the reader must stop broadcasting for at least 10 milliseconds every few seconds. This is how the test looked for two labels in the field:
- 44 ms - the worst
- 20 ms - tenth decile
- 1 ms is the best
- 3.2 ms - average time
- 104 reads per second
That is, in 5 test seconds most of the readings went with a gap of one millisecond, and then silence of 44 milliseconds. This is an unpleasant feature for racing, for 44 milliseconds at a speed of 20 meters per second, the driver passes 80 centimeters and, in the event of interference, can simply drive past the antenna. Approximately this situation was reproduced in the real test described above. And there is also a solution - to direct the antennas in the direction of the racers, then the space, and hence the time for reading, greatly increases. And of course you need to add spare ways to track riders, for example: video recording, a person with a piece of paper and a pencil, a person who enters numbers into the program with his hands.
Finish Line Configuration
It's one thing to read tags with an antenna on the table, and another in a real race from the racers. I considered two main options for the configuration of the finish line.
The first - antennas are located on tripods on the sides of the road. Ideally, antennas generally stand on one side only and “shine” across the track. But at the same time the location of the marks on the racers becomes asymmetrical, it is impossible, for example, to start the race in the opposite direction. In addition, reading from one side only is not so reliable. Then you need to put the antenna on both sides of the track, so that they "light" on each other. This already requires the construction of a frame over the route, along which RF cables will be laid, and even in such a configuration, the problem of the width of the route remains. It so happens that the track is 8-10 meters wide, and taking into account the stock for the installation of tripods can turn out 12-13 meters. Reading at such a distance can easily happen.
The second option, proven over many years by the motosponder and xsr-moto, is to install antennas on the frame above the track and direct them down. Tags need to glue on the helmets of racers or the upper body. The result is that the distance from the antenna to the mark will always be no more than 1.5 meters (the height of the frame is 3 meters, but the driver rarely passes the finish line with the helmet at ground level). A large width of the route can be slightly trimmed by the frame itself.
At the moment I use a frame with a width of 6 meters with three antennas, its width can be increased by an additional section up to 8-9 meters. After that, 4 antennas will already be needed, located slightly wider. According to the experience of two races in 2018, a width of 6 meters is enough if you set the frame on the slow track. It also increases the likelihood of reading tags - we kill two birds with one stone.
Notice time
After everything became more or less clear with iron, the time had come to actually count the circles. At first glance, everything is simple: create a table where each rider is assigned a tag identifier and write down each signal from the reader.
Almost so, but the signals from the reader must be filtered, because when the label is in the reader’s field of view, it is read up to fifty times per second. You also need to take into account that in rare cases, the tags are still not readable, so the serif program should be able to receive real-time data from the reader, from the operator who enters the numbers manually and allow editing marks after the end of the race.
The data that the reader and the operator give pass through the deduplication filter and turns into a track of numbers. This is a one-dimensional array of numbers of riders, in the order in which they crossed the finish line. For example: [1, 2, 3, 2, 3, 1]. From this track you can see that the riders completed two laps, on the first lap the riders' positions were 1, 2, 3. But on the second lap, the number of the first one had a problem and it turned out to be at the end. In the end, he won number two, followed by number three and then number one. To calculate the finishing protocol, it is the order that is used, not the timestamps. This is done for compatibility with the classic manual timekeeping, when judges record a track of numbers in a notebook. Although there is no such function yet, it is easy to implement the loading of a track of numbers from an additional judge. As a result of the calculation, the following table is obtained:
Conclusion
This article describes only a small piece of experience that I have gained over the past 1.5 years. Then I would like to talk about creating a site for registering riders and publishing results in Live mode, developing a second version of the hardware complex serifs based on the Chinese RFID module and Orange Pi, the process of preparing the route, organizing a mass event and many other things. If the topic is interesting, leave comments.
The project is open, a significant part of the code is published on github.com/maxbl4, the rest will also be soon, you just need to clean the passwords and API keys from the code :-) on .Net Core and Angular, please contact. Stack of technologies at the moment .Net 4.7, .Net Core 2.2, Docker, Angular 7.1, MySql 10.3
At the moment, in open access all the code for working with two types of RFID readers that I use: github.com/maxbl4/RfidDotNet.Net
Standard 2.0 library, full implementation of protocols, external dependency on SerialPorlStream to work with a serial port on Linux.
You can view the system in action, socialize and have a great time at the sports motor festival on February 16 near Sergiev Posad vk.com/event74123582 at this event I provide timekeeping