SportIduino - the system of electronic mark on the Arduino for orienteering



Getting out into nature is always great, but with a map in hand and with a conscious goal it is always more interesting. There are such types of outdoor activities as orienteering, rogaining, multi-races, participating in which you can have a good time. The task of the orienteer is to visit the control points marked on the map for the minimum time. In order to prove the fact of their visit, they are used as so-called. “Traditional” marking systems: colored pencils, code symbols, composters, etc., as well as electronic systems. Despite the convenience of the latter, traditional methods are still widely used in amateur competitions. This is due to the cost of equipment (from 3500 rubles per station mark and from 450 rubles per chip), with the possibility of theft of stations installed in public places, the need to take a deposit for the chip. Therefore, I set myself the goal to create a more affordable alternative. The following describes its implementation in the Arduino environment.

The electronic tagging system usually consists of RFID chips and stations - special devices for their writing and reading. The system works as follows. At the start, the athlete gets a chip, takes a card and starts. Running up to the gearbox, he puts his chip to the station mark, it records the current time on the chip and gives a signal, after which the athlete can continue on his way. At the finish, the athlete passes the chip to the judge, who reads the information using the gateway and reads out the result to the athlete - his time at a distance, the number of visited kn, the observance of a given direction. He can also print splits - time intervals spent on the path between the controls, which allows the athlete to analyze his way and compare himself with others on one or another segment of the distance.

To work with RFID chips, there is a widely available module RFID-RC522, for which there is an excellent library for Arduino, in many respects this fact determined its use. The module operates at a frequency of 13.56 MHz and supports the ISO 14443 standard, works with various chips, reading and writing occurs from a distance of several centimeters, which is well suited for our purposes.



Chips

To create a marking system, I used the Mifare Classic 1K (S50) chip because of its wide availability in various versions and low cost (11 rubles per chip in the form of a keychain). The chip allows you to read and write information quickly and reliably. Chip memory is structurally divided into 16 sectors, each of which contains 4 blocks of 16 bytes. The 4th block of each sector contains the keys with the help of which it is possible to write / read blocks in the sector. In addition, in the zero sector, the zero block contains the UID and information about the manufacturer. Thus, there are 3 blocks of 16 bytes in sectors from the 1st to the 15th and two blocks in the 0th sector. The structure of the record is presented below in the table, all data is recorded in triplicate for reliability.



This recording system allows you to record 45 marks in memory, including start and finish, for most competitions this is quite enough. But if you optimize the use of memory and lay a little more time on the mark, the capacity can be significantly increased.



Stations of the Stage

Scheme and Installation

The main components of the stations of the mark: the microcontroller - Atmega328p-au, RFID-module RC522, clock DS3231. Powered by 3 AA batteries through the MCP1700T-33 linear stabilizer.



I assembled the components on the printed circuit board, all the components of the SMD, with the RFID circuit board, made a soldering connection through the male connector. The boards were made using photoresist, 0.5 mm tracks. While honing the method has done quite a lot of defects, it is probably more expedient to make gerber files and order their production on the side, since this is not very expensive.



As a case I use the available g1020BF. In the box for the LED, drilled a hole and cut off excess plastic to fit the battery compartment. The hole for the LED processed epoxy, then inserted the welded board. After the epoxy had hardened, it poured 30 milliliters of the PC-68 compound, which was just enough to cover the board. In the battery compartment inserted batteries and all greased with grease for waterproofing. After tightening the cover station is ready for use.



The cost of station components and materials for its manufacture is about 500 rubles. It takes me about 1.5 hours of pure time to make and set up one station.

Station firmware

During the operation of the station, various kinds of failures are possible; A good version of the bootloader for the Atmega328p and instructions for installing it are here . You should also change the standard library wire to non-blocking, so that the station continues to work if the i2c line breaks, and does not go into an infinite loop. I downloaded the bootloader using another Arduino via the Arduino as isp firmware, connected the SPI contacts via pins leading to the RFID module, which I took off after a successful download. Then install the main firmware.

With the main firmware, the station with a chip tray reads a block of information from which it learns the numbers of the last recorded block and the station at which the mark occurred. If the station number is different, then the information block is updated and the station number and the current time are recorded in the next free block. Time and station number can be adjusted using special chips and gateways.

Power

One of the most important issues that had to be solved was how to maximize the service life of stations from a set of batteries. This is especially critical for tourist orientation, when it happens that the stations are installed long before the competition and it is necessary that they function guaranteed for more than a month.

To reduce consumption, sleep modes are used for the controller, as well as for the RC522. In sleep mode, the station consumes only 0.02 mA vs. 20 mA during operation. In order to use energy more economically, the station has three modes of operation with different sleep time intervals.

By default, the station starts in standby mode. At the same time, the search for the chip occurs once a second, the battery capacity lasts for 160 days. When a chip tray (this is done by the production director or the first athlete who has come to the point), the station goes into operation. In the operating mode, a chip search is implemented every 250 ms. New batteries will be enough for 45 days of continuous work. After 6 hours of inactivity, the station returns to idle mode.

When a sleep master chip is brought in (a special judge chip with station settings), the station goes into storage mode (chip search every 25 seconds), picks up 3 times and reboots. New batteries in this mode will last for 5 years. With a tray of any chip station goes into standby mode, while there is a measurement of the remaining battery charge. If the voltage drops below 3.1V, which indicates that about 15% of the charge remains, the station signals this.

Gateway and Data Processing

A pairing station is provided for working with chips and mark stations. Using the gateway station, you can set and adjust the time and station numbers using special master chips. Also, the gateway station performs pre-launch cleaning and checking the chips, inserts the initial information and the individual number in them. And, of course, reads the chips and gets the results.

I also added an SD module for recording splits and a Bluetooth module to the circuit so that the station could be connected to a telephone or computer for receiving or transmitting data.



While the scheme and firmware is not yet sufficiently optimized and implemented while from the modules on the knee. In the future we plan to finalize for more convenient use.



At the moment, data processing is carried out in a semi-manual way by sorting the resulting CSV files. The system is very flexible and can be easily configured for any competition, to implement data preprocessing in the gateway in a convenient way in different cases. For the future, there are plans to write software to automate data processing.

Conclusion

I am new to programming and developing electronic devices and have been doing this for less than a year. Therefore, the code and circuit solutions are quite possibly far from optimal or completely incorrect. I would be very happy to criticism, the whole project is freely available on the githaba .

I also want to thank those who have already helped with advice and became interested in development.

Also popular now: