Educational project: recording animation on metro cards

by

We did this project together with my son Nikolai. I helped with the initial stage of assembling the device, Nikolai did the Python programming.

Hardware

The project is made on Raspberry Pi B+, NFC sensor from ELECHOUSE based on PN532 chip, LED matrix 8*8 based on MAX7219.

The matrix is ​​connected via SPI interface, libraries from this project were used for work. NFC sensor was also connected via SPI, only already emulated on digital pins. Libraries from a similar module from Adafruit were used for work with it.

MiFare Ultralight

As you know, the Moscow Metro uses contactless Mifare cards to enter stations. Of course, the topic of reading/writing such tickets is widely known in narrow circles. We also started with reading and displaying the number of remaining trips in the console. But since we do not use the metro often, duplicating a metro device to display similar information was somehow not interesting. Having studied the theory in a popular form, we became interested in the possibility of writing to cards and using them simply as information carriers. In general, Ultralight cards have 12 blocks of 4 bytes each, available for writing. On our tickets, we managed to rewrite the lower 8 blocks of 4 bytes, i.e. a total of 32 bytes.

Software

As a useful exercise, I came up with the idea of ​​recording a simple cartoon for the LED matrix on cards. Thus, by bringing different cards to the reader, you can play different animations. The original idea was to record 4 full frames. Nikolay improved the system by replacing the last frame with a control sequence describing how to show the remaining three frames (repetitions, pauses, etc.).

The Python program was developed under Windows, using the JetBrains PyCharm IDE. The standard Raspbian (Jessy) was installed on the Raspberry, and SPI was enabled from the special settings. Access to the Raspberry was only via SSH (SuperPutty), SFTP (Filezilla). So at the same time, the skill of working in the shell was honed 🙂

Conclusion

Used subway cards are an interesting resource, especially for low-cost projects in clubs, camps, etc.

Over time, we’ve come up with other ideas for using the cards in games, such as:

  • In games like Monopoly, you can make “real” credit cards.
  • In card games where heroes have different abilities, you can automatically calculate the outcome of a battle.
  • Chips from cards can be attached to seemingly identical objects for identification.
  • Unique, non-rewritable card identifiers can be used to access rooms, open boxes with items, etc.

Maybe we’ll do some of this ourselves, that’s what holidays are for 🙂

Comments

Leave a Reply