MusiCookie - A portable music player operated by NFC tags
This is the device. The Rasberry PI has been mounted in such a way that it protrudes out of the balsa wood top for better NFC reception.
It is operated by these balsa wood figures that have an NFC sticker on the backside.
To play a song, you simply need to place one of the figures on the Raspberry PI.
This is what the MusiCookie-box looks like on the inside. There is the Raspi with the SD card holding the Raspian OS (Jessie) and music-files. The Raspberry PI gets its power through a smartphone charger battery-pack, that is connected via micro USB cable. Sound is played through a little active bathroom speaker.
Note that there is no need to use the exact same components that I used. To successfully build the MusiCookie as described in this tutorial however, at least the NFC module has to be the one that is used here.
You need to have an SD card with an installation of Raspian Jessie Lite.
All files and instructions can be found here: https://www.raspberrypi.org/downloads/raspbian/
Install Explore NFC drivers
Download the driver files here and install as described in this document: http://www.nxp.com/documents/application_note/AN11480.pdf
Download and install libraries
sudo apt-get update sudo apt-get upgrade sudo apt-get install vlc libvlc-dev
sudo apt-get install libglib2.0-dev
Clone the musicookie repo
First, you need to install git:
sudo apt-get install git
Then go to the home directory of the pi user and clone the repository like so:
cd /home/pi git clone https://github.com/coded-aesthetics/musicookie.git
Change to the newly created folder and install the missing packages:
cd musicookie sudo dpkg -i libneardal0_0.14.3-1_armhf.deb libwiringpi2-2.25-1_armhf.deb libneardal-dev_0.14.3-1_armhf.deb neard-explorenfc_1.2-1_armhf.deb
Create songs folder
To run the software and see if everything works, type in the following:
cd /home/pi/musicookie/neard-explorenfc-1.2 ./go.sh
Now you should see the output
Waiting for tag or device...
Ctrl+C your way out of there. We first need a way to get our music files onto the Raspi.
In order to get songs onto the PI, we need to install an FTP server.
The folder that holds the files is hardcoded as /home/pi/songs.
Make sure to exchange any usage of /home/pi/FTP by /home/pi/songs in the following step-by-step guide:
Now you can use your favorite FTP-client program to upload files to the PI.
Coding the NFC tags
With the help of the smartphone app TagWriter by NXP you can store the name of the mp3-files on the NFC tags.
The type of the entry needs to be ‘text’ and simply contain the name of the mp3 (complete with .mp3 suffix), as stored in the /home/pi/songs folder.
So, in the main menu of the TagWriter app, choose:
Write -> New dataset -> Text
Configure the musicookie software to automatically start after bootup
and also add a little energy saving trick which turns off the HDMI port. To do so, go to the /home/pi directory and append the following lines to .bash_profile
/opt/vc/bin/tvservice -o cd musicookie/neard-explorenfc-1.2/ ./go.sh
Configure the PI to login on boot
By typing this, you get into the raspberry configuration tools.
"3 Boot Options" then
"B1 Desktop / CLI" followed by
"B2 Console / Autologin", save and reboot the raspi by typing:
shutdown -r now
You should be good to go
If you are having trouble with any of the above steps, or noticed errors feel free to write me an email to firstname.lastname@example.org.