RFID music player for kids #389
-
Hey all, I'm currently working on an RFID music player for my daughter (she just turned 4). For those who don't understand the concept: Instead of using a screen to select the song you want (which is kinda hard if you can't read yet + the less she looks at a screen, the better), you just use an RFID card. So the user story for this is: pick a card, hold it to the reader and that song begins to play. Hold another one to it and another song plays. No queues and other bullshit ;) I first tried to do it with a bluetooth speaker. It worked but I couldn't make it reliable (as in it works after a power cycle - the bluetooth speaker had to be paired using the CLI). The other option was to use some kind of audio hat (e.g. HiFiBerry). However, as I have an amplipi, that's probably the easiest route. It requires only a Raspberry (I use a zero) and an RFID card reader (RC522). The script is pretty simple, it uses pyamplipi and the announce API. With the newest version (with LMS client) I will see whether I can port it to use LMS instead of the announce API (seems better suited). I do not have an LMS server, but maybe I can run it simply on the pi for now? Both LMS and announce have the advantage of easily using local files (or network files) instead of streams. Spotify seems to be too much overhead coding wise (as in select playlist, select song - not sure if this is even possible in the API). I don't have much time for tinkering :) @linknum23 Do you think using either announce or LMS is the way to go? To dos:
This might take a while. The MVP works. The funny thing is, I can even use a credit card for launching songs :) Code below:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 9 replies
-
Awesome! I was planning on doing something like this for my 2 year old starting from this post: https://www.home-assistant.io/blog/2020/09/15/home-assistant-tags/ That said announce might be too simple for this use case. It was intended for short clips and doesn't really support an announcement interrupting a previous announcement, something that will happen when you daughter decides to play a different song halfway through. For this I would use the stream type that announce uses under the hood: fileplayer. If I did this I would create a single file player stream dedicated to this task. Every time a song was requested I would set the streams url to the song url, then play that stream on an open source with the zone requested. For simplicity of determining and open source I would dedicate source 4 to this application. As for LMS I do not have any idea of how that API works. I hope that helps. |
Beta Was this translation helpful? Give feedback.
It should start playing immediately after set_source is called. The file player stream does not support any play or pause commands at the moment since it is almost entirely used for announcements.
I hope this helps. We really should investigate adding a full fledged local file player.