nfcAudio is an MP3 player, with audio files selected thanks to an NFC tag placed on top of it. I build this two years ago for my kid so he can play by himself his preferred nursery rhymes and songs, it is still used at least once a week :-)
It is powered by an ESP8266 to play audio from a remote server, an I2S DAC driving the speaker and an NFC reader. Thanks to WiFi we can use it to play local files or any webradio stream from the Internet.
I just used several evaluation boards, linked by soldered wires:
- ESP8266: Wemos Mini D1
- NFC reader: PN532 board from Aliexpress
- I2S DAC: MAX98357A board from Aliexpress
The MAX98357A I2S DAC can easily be replaced by another I2S, or even a single transistor: please see ESP8266Audio project which is wonderfully documented.
I designed a laser-cut box to hold everything together and allow NFC tag storage. All parts of the case are bolted, electronic boards are fixed thanks to zip ties, then the speaker is hot glued.
All RFID 14443 tags can be used with the PN532 reader. I saw some projects using “credit card” sized tags which can be printed with some inkjet printers, but I used small stickers so I can print an image on any printer, stick the tag on it, then put everything in thermal laminated film.
The most complicated part, MP3 management, is made by the great ESP8266Audio project.
Then I had to modify Adafruit’s PN532 library as it was only polling the NFC chip, so I implemented interrupts to be able to detect new tags while playing audio; my fork can be found here. Adafruit never merged my pull request but two months ago another (cleaner) one based on my work have been merged. As Adafruit changed all the library API since 2018 I am still using my fork.
My code is really simple: wait for a tag to be detected, read its content then play the associated file :-)
I encode the MP3 URL directly in the tag in the standardized NDEF format so I wrote a small parser for it, then it was done. I program the tags directly from my phone with the application NFC Reader & Writer.
Everything, including case files and the wiring is available on Github.