RFID-Controlled Sonos Playlists for Kids

Hey everyone, I wanted to share a fun project I recently completed using RFID tags to control my kids’ Sonos speakers. It’s been a great way to let them choose their own music without needing smartphones. Here’s how I did it:

Background

I have two kids who love listening to radio dramas and kids’ music. They don’t have phones yet, so I wanted a simple way for them to switch playlists on their own. I decided to use RFID tags since they’re easy to handle and can be attached to anything.

The Setup

I used an MQTT broker integrated with OpenHAB and set up two Raspberry Pis with RFID readers. Each Raspberry Pi is connected to a USB RFID reader and runs a Python script that sends RFID tag IDs to the MQTT broker. The tags are programmed with unique IDs corresponding to different playlists.

The Process

  1. Hardware Setup: I connected the RFID readers to the Raspberry Pis and set up the MQTT broker to receive tag data.
  2. Python Script: I wrote a script to read RFID tags and publish their IDs to the MQTT broker. This was a bit tricky at first, but with some online research, I got it working smoothly.
  3. OpenHAB Integration: I created items in OpenHAB to receive the RFID data and trigger the corresponding playlists on the Sonos speakers.
  4. Automation Rules: I set up rules to handle the RFID inputs and execute the appropriate actions, like switching playlists or adjusting the volume based on the time of day.

Challenges and Solutions

One challenge was ensuring the Raspberry Pis remained stable. I had to make sure no other USB devices were connected to prevent event ID changes. I also had to install MQTT and Paho libraries on each Raspberry Pi, which was straightforward with some terminal commands.

Results

The system has been running perfectly for a few days now! My kids love being able to choose their own music, and it’s been a great way to teach them about technology in a fun way. Plus, I can adjust the playlists and settings from my phone, which is super convenient.

Tips for Others

  • Stability: Keep the Raspberry Pis in a stable environment with minimal USB connections.
  • Testing: Use the MQTT explorer to test if the tags are sending data correctly before integrating with OpenHAB.
  • Documentation: Keep detailed notes of your setup and any troubleshooting steps you take.

I hope this helps someone looking to create a similar system. It’s been a fantastic project, and I’m excited to see how else I can expand it in the future! Any feedback or suggestions are welcome! :blush: