Card Music
The music-by-card project has gone from an arduino-based ip-card reader to a complete solution that allows you to store and play music by controlling this process using RFID cards of the metro standard mifare ultralight.
The device was intended as a gift to a friendly child and his parents, so the article is built in the genre of instructions for three categories of users: children, adults and programmers. Those who are interested only in the internal structure of the box, it is better to go directly to the third part of the article.
Attach the card to the flower on the box. Music will start to play. People older than 3 years of age at this moment usually experience violent joy.

1. Open the network folder \\ rfidmusic \ music
2. Bring a new card to the reader.
3. A file with the name card_id.xxxxxxxx will appear in the folder with the music, where xxxxxxxx is the unique card number.
4. Create a folder with the name xxxxxxxx, record music there.
1. Copy new music to an existing directory corresponding to the card number or to a new directory created as described in the section “How to attach a new card”.
2. Create the update directory in the \\ rfidmusic \ music folder. Within 5 minutes, the new music will be indexed and will be available for playback. The update directory will then be automatically deleted.
The box is a Raspberry Pi microcomputer with connected RFID card reader and WiFi dongle. There were no problems connecting peripherals to the RPi, everything worked right away and without problems, it was enough to register the SSID and password from the WiFi network. The RFID reader connection scheme is described in the article [3].
consists of three modules:
1. Samba server. The music catalog is available on the home network at \\ rfidmusic \ music. Music is stored on the same SD card with which the system is loaded.
2. The music server. This is MPD (http://en.wikipedia.org/wiki/Music_Player_Daemon) as standard. There are clients to this music server for everything that moves, in particular, there are programs for android (mpdroid) and iphone (MPaD). Those. You can control music not only with cards, but also in the usual way, from a phone, computer, etc.
3. Card Reader. Each card has a unique number. If there is a directory in the folder with music with a name that matches the card number, then music from this directory is launched. In any case, a file with the name card_id.xxxxxxxx is created in the music folder, where xxxxx is the unique number of the last card brought to the reader. The reader is started from / etc / inittab by instruction 4. New music indexer. Every 5 minutes, the presence of a directory with the name update in the music folder is checked. If it is there, then MPD re-reads all the music (with a command ) and deletes the update directory. The indexer is launched from the crown of the user pi.
(the first version of “card music” was controlled by the Squeezebox player)
1. The code for the first and second versions of the project on the github
2. Card reader compatible with RPi
3. Connection diagram and installation of the necessary python modules (in Spanish)
The device was intended as a gift to a friendly child and his parents, so the article is built in the genre of instructions for three categories of users: children, adults and programmers. Those who are interested only in the internal structure of the box, it is better to go directly to the third part of the article.
Children's version
Attach the card to the flower on the box. Music will start to play. People older than 3 years of age at this moment usually experience violent joy.
Adult version

How to attach a new card.
1. Open the network folder \\ rfidmusic \ music
2. Bring a new card to the reader.
3. A file with the name card_id.xxxxxxxx will appear in the folder with the music, where xxxxxxxx is the unique card number.
4. Create a folder with the name xxxxxxxx, record music there.
How to record new music or delete old.
1. Copy new music to an existing directory corresponding to the card number or to a new directory created as described in the section “How to attach a new card”.
2. Create the update directory in the \\ rfidmusic \ music folder. Within 5 minutes, the new music will be indexed and will be available for playback. The update directory will then be automatically deleted.
Version for programmers
Iron
The box is a Raspberry Pi microcomputer with connected RFID card reader and WiFi dongle. There were no problems connecting peripherals to the RPi, everything worked right away and without problems, it was enough to register the SSID and password from the WiFi network. The RFID reader connection scheme is described in the article [3].
Software
consists of three modules:
1. Samba server. The music catalog is available on the home network at \\ rfidmusic \ music. Music is stored on the same SD card with which the system is loaded.
2. The music server. This is MPD (http://en.wikipedia.org/wiki/Music_Player_Daemon) as standard. There are clients to this music server for everything that moves, in particular, there are programs for android (mpdroid) and iphone (MPaD). Those. You can control music not only with cards, but also in the usual way, from a phone, computer, etc.
3. Card Reader. Each card has a unique number. If there is a directory in the folder with music with a name that matches the card number, then music from this directory is launched. In any case, a file with the name card_id.xxxxxxxx is created in the music folder, where xxxxx is the unique number of the last card brought to the reader. The reader is started from / etc / inittab by instruction 4. New music indexer. Every 5 minutes, the presence of a directory with the name update in the music folder is checked. If it is there, then MPD re-reads all the music (with a command ) and deletes the update directory. The indexer is launched from the crown of the user pi.
RF:23:respawn:/home/pi/rfid/run.sh
mpc updateReferences
(the first version of “card music” was controlled by the Squeezebox player)
1. The code for the first and second versions of the project on the github
2. Card reader compatible with RPi
3. Connection diagram and installation of the necessary python modules (in Spanish)