📜 ⬆️ ⬇️

Create an electronic timekeeping races

185282-11516937085b2ed4ea7e36b


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 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 write down 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.


_racelog01


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 20 km / h, and in motocross it is customary to give a finish on the largest springboard, which is entered at a speed of 70-80 km / h. But the price of RFID tags about 11 rubles per piece allowed to distribute them 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 mark.




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 RF 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 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.



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, it 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 long-range characteristics according to the manufacturer’s description, the specific range and reading speed are usually not written anywhere. highly dependent on conditions. I spent quite a few experiments reading different tags, in different numbers and antenna configurations. Here are the concise conclusions:



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 explained by 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:


_alien-rfid-tag-stat



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 case 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 track. Ideally, antennas generally stand only on one side 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, it can turn out to be 12-13 meters. Reading at such a distance can easily happen.


The second option, motosponder and xsr-moto tested over many years, 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 torso. 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.


_rfid_frame


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 the 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. It should also be noted that in rare cases the tags are still not readable, therefore 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 ended up 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 time stamps. 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:

_session_rating


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 :-) If you are interested in helping the development of the project, learn something new, for example, learn how to drive motorcycles on .Net Core and Angular, 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 to work 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 only for working 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


')

Source: https://habr.com/ru/post/435338/


All Articles