If you have got a kid you’ve probably stumbled across the RFID based music player TonieBox Music Box. There’s a teardown here thanks to ifixit.
Content is paired with purchasable figurines and you can upload your own mp3’s but that requires a cloud account and a permanent WIFI connection. So, continuing my plan make a Christmas present for my son every year, I’m going to make one (video at end of post)
The’ Tinytony’ or whatever.
- Can be controlled via RFID cards/chips/stickers etc. No External controls/buttons.
- Can recognise two RFID cards at same time (to allow for in-music control)
- Can play single tracks or playlists.
- Mains and rechargeable.
- Small, solid, and professional looking.
It has been done before.
This is nothing new, there’s a whole community of builders doing the same, with loads of guides. I only discovered this AFTER I finished the build, which I’m still a bit miffed about as it would have made things a whole lot easier. But, this box is all mine so I can be smug about that.
Original plan was to use an esp8266 microcontroller, vs1053 Audio breakout, generic SD card breakout, pam8403 Audio amplifier, PN532 Reader and some random LIPO charging circuit.
Due to the size constraints of my chosen enclosure, I managed (had to) get this all down to a few smaller parts.
- Adafurit 8266 feather (Microcontroller, USB charging, WiFi, CP2104 USB-Serial converter)
- PN532 Reader (RFID Reader with 2 card support)
- DFPLayer (MP3 decoder and SD card reader in one) Good luck finding one that’s not fake.
- LIPO battery, 850mah
Cheap ebay eps8266/esp32’s with on-board lipo charging circuits usually don’t work, they don’t switch off on full charge or low volts so will kill your batteries. Go with a branded board.
This was the most difficult part of the build, I wanted it to look good. In the end I went with modifying a commercial small Bluetooth speaker.
Not sure if these are still being made but there’s plenty of stock on ebay/amazon and they’re cheap. I bought two as I assume i’d screw up at some point.
6cm x 6cm x 6cm, big enough to allow an rfid card to rest on top but still small and looks great. All the components fit inside with slight modification.
Modifying the enclosure.
You’ll need to gut the box, leaving the existing speaker and bass diaphragm and then carve out some of the internal plastic braces and structures to make room.
Unscrew the bottom of the case (the screws hide under the rubber base), de-solder two speaker wires and snip the wires connecting to the LIPO battery (one at a time!). There is also a small LED in the side which i decided not to use, so just cut the wires.
Carefully remove the LIPO battery from the side of the box, break the hot glue seal and it should pop out.
Unscrew the circuit board from the base and keep all the bits, it’s a nice Bluetooth speaker set-up.
Cut away the plastic battery brace away so that it’s flush with the inside of the box.
At the bottom of the box there are more plastic braces, assumed to strengthen the box around the carry handle. Carefully cut these these back so the inside is flush. You will find a hole under the bottom brace, don’t worry about this. I used an old chisel, the box is too small to get a Dremel inside.
The bottom of the box and the old circuit board holder needs a bit of work. I’m going to replace the USB charging port with one on my 3D printed part, so you’ll need to cut all that away, as pictured.
This is the circuit holder I designed, it glues onto the inside bottom of the box and fits perfectly. There is also a small hole for the on-off switch that’s wired between the LIPO and JST connector on the ESP8266 board (+). With more time it would be easy to design a custom single pcb for all of this.
The PN532 reader fits perfectly inside the bottom (top) of the box, just needs a little help squeezing in around the speaker, hot glued in place.
Not much wiring needed. I used I2C for the RFID board (you will need to change a jumper). Although there’s no hardware I2C on the Esp8266 and it’s bit banged it’s good enough. DFPlayer is controlled via serial, I’m using softwareserial as hardware serial is also used by USB on the 8266 and I’ll be wanting to debug via usb. Note the 1k Resistor between RX pin on the DFPlayer and the microcontroller to reduce speaker noise.
Fit the ESP8266 into the 3D Printed holder, hot glue to hold it in place. The DFplayer fits vertically into its holder. I snipped the unused legs and removed the LEDs to reduce battery drain. A bit of hot glue to hold that in as well.
Fitting a small switch is a bit tricky, the whole battery part can be left out if you don’t like the idea of LiPo and small dribbly children mixing. The LiPo is fitted against the side of the box, I 3D printed a small bracket to hold it and hot glued it in. FYI – I use Gorilla Hot glue, strong stuff.
Wire up the existing speaker to the DFPlayer and stuff it all in the box. You’ll need to access the SD card to add tunes so don’t over tighten the tiny screws else you’ll strip the thread.
I opted to leave out the playlist code for the time being so it’s just single tracks at the moment. If two cards are presented at once an error sample plays.
I have a few folders on the SD card. 1 contains the operating samples (card presented, card removed, card not recognised, multiple card error, volume up and down) . 2 Contains all the music and audiobooks. 3 Will be for reserved for ad-hoc sound effects. Folders 10-255 reserved for playlists,
Card identification is based on only the RFID unique card ID (UID). I don’t read anything other than the UID, it’s faster. I have an array of UID’s where the index in the array is equal to the file number in the folder. Simple.
Control cards (volume up and down, next song etc), are held in another array.
Playlists cards, where the index in the array is equal to the folder number +10.
UID are held as strings which I know is bad but I have no reason to change, it works.
Excluding libraries the current code is 220 lines. Its so simple you’ll be able to see whats going on.
He loves it.