hglkrijger / jukebox

Tutorial for creating an NFC based jukebox with an Arduino.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Arduino NFC Jukebox

Recently, my wife and I had the idea of printing a song card for our 16 month old daughter. What this means is there are pictures printed on some cardstock which she can point to, and one of us sings the songs represented by that picture.

After a few days of continuous singing, I decided to build a jukebox for her instead. I wanted to enable simple song selection using NFC cards with feedback from an LED. I also wanted to introduce her to the concept of sequences, while allowing her some simple level of control using a button. Finally, I would also need a way to change volume and other control functions.

This is a quick walkthrough for anyone who might like to do the same.

Components

Part Link Cost
NTAG 215 NFC cards Amazon ~60c ea
NTAG 213 NFC tags Amazon ~40c ea
DFPlayer mini Amazon ~$4
Power supply Amazon ~$9
Illuminated latching switch Adafruit ~$2
3W speakers Amazon ~$8
PN532 NFC shield Adafruit ~$40
Arduino Uno R3 Amazon ~$12
Sandisk microSDHC card Amazon ~8

You will also need:

  • Assorted brass standoffs
  • Solid core wire
  • Electrical insulation tape
  • 8x M2 3mm screws (for speaker mounts)
  • 4x M2 3mm screws (for Arduino mounts)
  • 3x M2.5 3mm screws (for enclosure)
  • 3x 2.5mm hex nuts (for enclosure)
  • Soldering iron and solder
  • MP3 songs

Total cost: ~$100

Case

I designed the outer case and trim using Tinkercad, and printed in two colors. You can find all those parts here:

Control tags

I found these handy key fobs on Thingiverse, which I used to represent control tags:

Scaling to 50% was a good size for these prints. The NFC stickers were attached to these, for use as controls.

Music

I purchased songs through iTunes, then converted the m4a files to mp3 directly using the iTunes app. These were copied over to the SD card according to this structure:

\01
    \0001.mp3
    \0002.mp3
    ...
    \0010.mp3
    \0011.mp3
    ...

Note the root folder is a 2-digit number, and the files are all 4-digit zero-prefixed. This is a requirement for the DFPlayer Mini. The numbering also makes it simpler to map the individual cards to songs.

Writing tags and cards

Once the headers are soldered to the NFC shield, you can use the nfcWriter to write an integer to each card. This integer must map to the file number of the song you want to select with that card. In other words, write 4 to the card to play 01\0004.mp3.

I used control tags for volume up, volume down, and stop. For these I selected 97, 98, and 99 as control codes, which were written to NFC tag stickers, and I attached those to little key fobs which I printed.

Circuit

Note the illuminated pushbutton is described by the LED and pusbutton parts. Also only one speaker is shown, but simply connect two speakers in the same way.

Circuit

Pin Component
2 pn532 irq
3 pn532 reset
5 button
7 led
10 dfplayer rx
11 dfplayer tx
3V button
5V dfplayer
GND dfplayer, button, led

Assembly

  1. Print all the case parts; glue trim to the front case
  2. Print the key fobs, if you plan on using them
  3. Solder the NFC shield headers
  4. Solder solid core wires to the button; wrap with electrical insulation tape
  5. Mount the button in the front case
  6. Solder solid core wires to the DFPlayer; wrap with insulation tape
  7. Solder the DFPlayer wires and resistors to the NFC shield as per the circuit diagram above
  8. Mount the Arduino and speakers to the back case using standoffs
  9. Mount the NFC shield on the Arduino board
  10. Solder the button wires to the NFC shield as per the circuit diagram above
  11. Place two small hex nuts in the case, which will catch the screws
  12. Insert the SD card, connect power supply through the case, and screw the case closed
  13. Decorate with stickers and mount :P

Final result

Inside

Outside

Action

Notes

There are a few things I would change if I was doing this again:

  1. Given the way the button is mounted to the front case, the soldering was a bit fiddly. I would either modify the case so that the button was mounted to the back case, or use alligator clips to attach the wires to the button connectors.

  2. The DFPlayer in my build was not mounted anywhere, and I did not make an opening to get access to the SD card. This means when I want to add more songs I need to open the case. Since I only have one NFC shield which doubles as a card writer and the jukebox reader, I had to open the case anyway. However, this could be improved.

About

Tutorial for creating an NFC based jukebox with an Arduino.

License:MIT License


Languages

Language:C++ 100.0%