Mopidy Pummeluff – A music box for kids

Mopidy is an extensible music server written in Python. It provides a lot of different music sources, such as Spotify, SoundCloud, Google Play Music, and more. It’s a perfect open-source solution and alternative for SONOS, running on a Raspberry Pi.

It’s nearly perfect for kids, and the only thing missing is a kids-compatible interface. That’s where my new plugin Pummeluff comes in place.

The interface

If you remember your childhood, you might remember this gem:

Sony Walkman via Wikimedia Commons

Then you might also remember the good old times, when you were looking for a freakin’ pen, to rewind and screw the tape back into your cassette tapes. Apart from that, the walkman was pretty awesome! One reason why it was so awesome was its simplicity. The interface was well designed, straight-forward and just simple. There was no swipe-to-unlock, passcode prompt, bluetooth connectivity issues or alike. It was dead simple: Put a cassette tape into the magic box, press play and you’re good to go.

I’m sure, this was one of the keys for the success of the Walkman. And this is exactly what I’m trying to achieve with the on-going project. I’m trying to use cutting-edge technology, such as a Raspberry Pi, Debian Linux and the Mopidy server and connecting it with simplicity.

Instead of controlling Mopidy via web interface and all that fuzz, I was looking for a simpler solution. Something that even the little ones can control without being a master mind in technology (yet). That’s where I came up with RFID. An RFID interface can be something so simple, straight-forward and beautiful. It even supports the human nature of grabbing something and putting it on a specific spot.

Concept

Having thought about the so important interface, I already had a big part of my concept. And here’s the rest of it, or at least what I was trying to achieve:

  • A small-ish all-in-one music box
  • It must be portable and power-efficient
  • It must play local songs from the SD card
  • It must also support NAS systems and integrate Spotify
  • It must support RFID tags and buttons as interface
  • It should be developed in Python
  • Last but not least, it must be KISS

Because my sister and some friends of mine recently got offspring, I thought this whole music-box-thingy would be a great gift. So the price tag of the whole package was crucial, thus I was looking for an affordable solution.

Hardware

It was time to get some hardware. Here’s what I’ve got:

  • A Raspberry Pi 3 Model B (~ CHF/USD 40)
  • A USB power bank with passthrough charging (~ CHF/USD 15)
  • A pair of USB powered speakers (on AliExpress for ~ CHF/USD 3)
  • An RC522 RFID module (on AliExpress for ~ CHF/USD 1)
  • ISO 14443A tags (on AliExpress for ~ CHF/USD 0.4 per tag)
  • Two push buttons (on AliExpress for ~ CHF/USD 1)
  • Female jumper wires (on AliExpress for ~ CHF/USD 1)

As you can see, the most expensive parts are the Raspberry Pi and the power bank. So you end up with a package price of approximately CHF/USD 60, without the RFID tags. I’d call that affordable, and you can even get it cheaper if you’re looking for a used RPi and power bank.

The RC522 RFID reader is quite small and should work with Mifare & 14443A tags. There are also starter packages with included tags available:

Mopidy / Pummeluff supports a status LED, which lights up when its ready. That becomes handy, especially when we shutdown or restart the RPi. I didn’t want to have a separate status LED, thus I decided to use buttons with integrated LED’s. There are plenty of them available and I used these 5V momentary push buttons:

I was going with the RPi 3B because there was one lying around at the office. However, a 3B+ should also work fine, as the GPIO pins are the same. Unfortunately, I don’t know about the RPi 1, 2 and Zero models, but you can give it a try.

Connecting the hardware

Now it’s time to connect the hardware. I’m a bit lazy, so I won’t describe here how you’ve to conenct the pieces. Just head over to the GitHub repo or PyPi repo and connect the components like described in the Connecting… chapters.

When everything is connected, continue to the next chapter.

Raspbian

First of all, we need to setup Raspbian on the microSD card of the RPi. I’m not going to explain how you can install Raspbian on your RPi, as there are already plenty of excellent tutorials out there. There’s also an official Raspberry Pi Installation Guide.

Boot your Raspbian and configure it by running the configuration utility:

sudo raspi-config

Configure the following options:

  • 2 Networking Options
    • N1 Hostname: Enter your desired hostname
    • N2 Wi-fi: Enter your WLAN settings
  • 4 Localisation Options
    • Change the desired settings
  • 5 Interfacing Options
    • P4 SPI: Enable the SPI interface (important for the RFID module)
  • 7 Advanced Options
    • A3 Memory Split: Set the CPU memory to 8 MB

Now, your RPi should be connected to the WLAN. Get the IP address by running:

ip a s wlan0

Let’s change the password of the pi user, enable SSH, upgrade the system and then reboot it:

# Change the password.
passwd

# Enable SSH after boot and start it.
sudo systemctl enable ssh
sudo systemctl start ssh

# Update system.
sudo apt update
sudo apt dist-upgrade

# Finally, reboot it.
reboot

Your RPi is now updated and should come back up. This means, we’re ready to go to install Mopidy.

Mopidy

The installation of Mopidy is quite simple. Just execute the following commands:

# Install Mopidy apt GPG key & repository.
wget -qO - https://apt.mopidy.com/mopidy.gpg | apt-key add -
wget -qO /etc/apt/sources.list.d/mopidy.list https://apt.mopidy.com/stretch.list

# Update sources.
apt update

# Install mopidy and pip.
apt install mopidy python-pip

This should be enough to install Mopidy. However, there are also some extensions you might be interested in.

HTTP server

Mopidy comes with an integrated web server called Mopidy-HTTP. By default, the web server is only listening on the local interfaces, so you want to add the following config to the Mopidy configuration:

# /etc/mopidy/mopidy.conf

[http]
hostname = 0.0.0.0

You should now be able to connect to Mopidy via http://{MOPIDY IP}:6680/.

MPD server

Now, the web server itself has no web interfaces to control Mopidy. It’s just a simple web server. However, there are several web UI’s which can do exactly that. The most of them are based on MPD (Music Player Daemon). Fortunately, Mopidy also comes with an MPD server called, guess what, Mopidy-MPD. Unfortunately, it’s also listening only on localhost, so add the following bits to the Mopidy configuration as well:

# /etc/mopidy/mopidy.conf

[mpd]
hostname = 0.0.0.0

So, as we now have a HTTP & MPD server listening on all RPi interfaces, we can add an MPD web client to control Mopidy.

Iris

Iris (formerly known as Spotmop) is a really nice MPD web client, which is running directly on the integrated Mopidy HTTP server. You can install Iris via pip:

pip install mopidy-iris

That’s it! Iris, the awesome MPD web client is installed and is available via the Mopidy HTTP server.

Spotify

If you want to listen to Spotify songs, you also need to install the Spotify extension. To install it, we can use pip again, but we need to install some apt dependencies first:

apt install libspotify12 libspotify-dev libffi-dev 
pip install mopidy-spotify

If you can’t find / install libspotify, make sure you’ve configured Mopidy’s own apt repo.

After you’ve installed the Spotify extension, you need to configure it according to the official github repo and/or the Mopidy website. The final configuration looks like this:

[spotify]
username = … your username …
password = … your secret …
client_id = … client_id value you got from mopidy.com …
client_secret = … client_secret value you got from mopidy.com …

Pummeluff

Developing Pummeluff

I was quite amazed by Mopidy and the existing extensions. Most of the features I was looking for were already available in beautifully crafted PyPi packages.

So the last missing bit was the communication with my hardware interface, known as RFID reader & push buttons. This is where I started developing Mopidy Pummeluff, as I couldn’t find anything usable on the internet.

Here’s what Pummeluff does:

  • Adding a web UI which allows you to assign actions to RFID tags
  • Reading RFID tags and executing the assigned actions
  • Reacting to button pushes and executing the assigned actions

The following actions can be assigned to RFID tags:

  • Replacing the tracklist with a new URI (e.g. Spotify track or playlist)
  • Setting the volume to a new level
  • Pause, resuming or stopping the playback
  • Shutting down the system

Because I wanted the power bank to last for a very long time, I did two things:

  • I’m using interrupts, which means we won’t have endless CPU cycles wasted just to read RFID tags or waiting for button pushes. Less CPU cycles equals less power equals more battery life.
  • I’ve added a power button to shutdown the RPi into halt state and wake it up again.

Installing Pummeluff

First of all, we need to give our Mopidy user a little bit more permissions, so it can access the SPi interface and GPIO pins:

sudo usermod -a -G spi,gpio mopidy

Because I also want to shutdown the whole RPi with a push on a button, I had to create a sudo rule for that:

sudo echo "mopidy ALL = NOPASSWD: /sbin/shutdown" > /etc/sudoers.d/mopidy

Now it’s time to install the Pummeluff extension:

sudo pip install spidev
sudo pip install mopidy-pummeluff

Last but not least, restart Mopidy:

sudo systemctl restart mopidy

And we’re ready to go. Point a browser to the Mopidy Web UI, which by default is reachable like so:

http://{MOPIDY_IP}:6680/

In the browser you should now be able to control Mopidy via the execellt Iris Web UI, and register new card via Pummeluff’s simple (and not very shiny) frontend.

Proof of Concept

To test when everything is connected together, I used an old wine box. And here’s how my PoC box looks like:

It doesn’t win a design award, and I could’ve given it a nice finish. But hey, it’s only a proof of concept and I’m minimalistic, so no bending over backwards here.

In the meantime, I’m already checking out (used) toys, which are large enough to fit everything into it. The RPi and power banks are probably the largest parts, but the RFID reader and buttons are quite small (and there are smaller counterparts available). The speakers aren’t very high-quality, but they deliver a decent sound for that price (it was approx. 3 USD). Thanks to their cheap casing, I can also take them apart and save a lot of space there as well.

Of course I’ll upload new photos as soon as I found a proper home for those electronics.

Verdict

I didn’t thought the project is going to be so straight-forward when I started it. However, by using a Raspberry Pi and the awesome Mopidy music server, I already had a solid base. With some additional hardware and a bit of programming, I achieved a really nice result. The Spotify integration is also a big plus, as Spotify has not only music, but also a lot of fairytales for the little ones. Of course you can also upload music directly to the SD card of the RPi or connect your NAS share to it.

As I love open source and the community behind it, I thought I’ll cover the whole idea in this blog post and publish my source on GitHub.

I hope somebody else can use this project for their kids, and I’m always happy to help. Feel free to contact me any time.

100 Comments

  • Vedanthi Giri

    Super I am working with children in schools
    India…
    Sure I need your help

    • Tonos de llamada Mp3

      These songs are good for children. Not only that, they are also installed into very attractive ringtones and meet a lot of needs for users. Please contact me if you need assistance.

  • driving directions

    I am also exploring the differences on the two issues, but the information is missing, thank you for sharing

  • Pummeluff fan

    Thank you for making this available. I am well on my way to building a player for my daughters, but am experiencing a problem trying to start a playlist (created in Iris in standard m3u8 format) using an RFID tag. The tags work fine for starting Spotify playlists and also for individual locally stored mp3 files, just not m3u8 files. Is there anything I could be doing wrong?

  • maplestory m download

    This is great, I installed it with my Linux Ubuntu, the music is great.

  • Crediblebh

    Here you learn lots of things About it check here once

  • cupcakes 2048

    You guys this is cool. I bet the kids here will love it.

  • waytosmurf

    Buy Music Box From here

  • disability learnership

    Wow this is an awesome concept. I wonder if I can buy the hardware not from aliexpress.

  • bubble shooter

    Thanks for this post!if you like game bubble shooter

  • 24 hour plumber

    Awesome. Thanks for this detailed write up.

  • Plumber in Aylesbury

    Im glad I have seen your article. Thanks for this detailed information. Im planning to have this build.

  • Plumbers Eastbourne

    I will keep this in mind. I might be needing this for a school project.

  • Plumber in Putney

    Dedication and perseverance I might be able to make this. Great thoughts. Waiting for you to post more like this.

  • Plumbers Rochdale

    Im not that tech but I think I will be able to build this. Thanks for the step by step instructions. You have given a bright idea to do this time.

  • plumbers near me

    I feel it has a great vision and quality inspiration.

  • plumbers Brackenfell

    Thanks for your appreciable efforts and I wish you’ll share more updates in future also.

  • Plumbers near me

    I was wondering about this for a long time and I like to get that much info from this website.

  • plumber parow

    Awesome post! Glad to see your site for this information.

  • pretoria carports

    Wow! Thanks for sharing this very detailed article.

  • Leptitox Supplement

    Wow! This could be one of the most useful blogs we have ever come across on thesubject. Actually excellent info! I’m also an expert in this topic so I can understand your effort.

  • https://www.tulsaareafencing.com/

    I ‘d mention that most of us visitors are endowed to exist in a fabulous place with very many wonderful individuals with very helpful things.I feel really happy to have seen your webpage and look forward to so many more entertaining times reading here. Thanks once more for all the details.

  • Plumbers in Rochdale

    Nice starter for kids. Jamie will be excited to see this.

  • Plumbers in Aylesbury

    I tried building this one, but had some difficulties at first.

  • schwarzer Mischbatterie

    hallo, ich bin sehr dankbar, nachdem ich gegoogelt habe und einige interessante Artikel auf dieser Website gefunden habe, schreibe weiter und später werde ich wieder kommen, um deine neuesten Beiträge zu sehen. Ich liebe deinen Stil wirklich. Du hast es gut gemacht!

  • Resurge Review

    Succeed! It could be one of the most useful blogs we have ever come across on the subject. Excellent info! I’m also an expert in this topic so I can understand your effort very well. Thanks for the huge help.

  • JoeMoe

    First of all – thanks a lot for this very cool project. It inspired me to do something similar and I am halfway there.
    Unfortunately I have a problem with accessing the pummeluff web client. I can access via http to mopdiy and I find in the list other available clients e.g. Iris.
    Any ideas where I could look for the problem? Thanks a lot in advance!

  • Anthony

    Hello, thanks for sharing your project with us.
    Unfortunately, same problem as JoeMoe… can’t see pummeluff web client anywhere (I’ve got a list of web client available but no pummeluff 🙁 )
    Any idea?
    Have a nice day!

    • Anthony

      Finally it works after some issues with Python 2 & 3…
      The push buttons don’t work at every try, can you help me? Something to set up?

      • JoeMoe

        Hey Anthony, any pointers as to what had to be sorted out with Python?

      • Anthony

        Hi JoeMoe,

        I just attempted a new try on a fresh install of raspbian lite.
        Directly installed python3 and pip3 (not pip!). Then install the plugins with pip3 (sudo python3 -m pip install mopidy-iris, spidev and mopidy-pummeluff).

        It works for me 🙂

  • mr seo

    Thanks

  • www.cleartoclosemasters.com

    This post is very simple to read and appreciate without leaving any details out. Great work!

  • www.clermont-international.org

    With so many books and articles coming up to give gateway to make-money-online field and confusing reader even more on the actual way of earning money,

  • www.coloradospringscoroofer.com

    Truly, this article is really one of the very best in the history of articles. I am a antique ’Article’ collector and I sometimes read some new articles if I find them interesting. And I found this one pretty fascinating and it should go into my collection. Very good work!

  • www.concretesawingservices.com

    I like viewing web sites which comprehend the price of delivering the excellent useful resource free of charge. I truly adored reading your posting. Thank you!

  • www.cottonwoodplacedental.com

    It’s late finding this act. At least, it’s a thing to be familiar with that there are such events exist. I agree with your Blog and I will be back to inspect it more in the future so please keep up your act.

  • spider solitaire

    Wow post! This post is incredibly good and informative. Thank you for such an insight. If you are curious to know more about your Free Fonts then you may visit here.

  • click here

    Great work. Excellent site.

  • Beau

    Hello! I’m having a heck of a time getting my RC522 GPIO reader to work with Pummeluff. I’ve tried just about everything and was wondering if you (or anyone else) might have some pointers on how to get it to read?

    Thanks!

  • I’m not that techy but my brother does. I’ll try to see if he can make a music box based on the suggestions found in the post. I’ll let you know the outcomes if we’ll pursue it. Thank you for sharing and please refer all your epoxy flooring needs in Colorado Springs to Colorado Springs Epoxy Flooring.

  • cherry u

    Thanks for this! I now have the idea how to troubleshoot my laptop!

  • cherry u

    where do you think I can buy this?

  • wedding DJ lafayette

    Wow! Great music box for kids? I might try to build on to play at my next DJ gig. lol

  • Landscaping In Madison, WIsconsin

    This blog is very nice. I really like such a fantastic written blog. I will keep coming here again and again.

  • Janice Verallo

    I love this music box

  • bvdsepticjax.com

    woow! this makes me happy even if I’m already old

  • Commercial Vehicle Wraps Dallas

    This is a great retro throwback design and something that is great to see. We like to take our design cues from all over the spectrum.

  • Concrete Dallas

    Wish I had one of these now at work. I’m pretty sure I had one of these when I was little.

  • landscaping

    So you can make a private music streaming server like Spotify ?

  • Low Branches

    Just like the old times. I used to have this to listen to some country music.

  • Team Flex

    This is so true!! Check out our supplement store too!!

  • Franchise Law

    Love this! Thanks for sharing

  • Superior Squash String in Orlando

    This music box reminded me so much of my childhood in the 90’s. I was able to use it and listen to songs because of our rich neighbors on the block. I am just glad that my playmate was kind enough to let me borrow it.

  • Avejis gadazidva

    This is a great retro throwback design and something that is great to see. We like to take our design cues from all over the spectrum.

  • DRYWALL DENVER

    Whether you are looking for interior drywall repairs or you are adding a new addition to your home, Drywall Denver is the best team in the Denver Colorado area to handle this service.

  • sonnerie jerusalema

    I like the sound of music box for kids. It’s so interesting

  • Home Improvement

    It’s always very kind plus full of fun for me personally and my office fellow workers to visit your website at the least 3 times every week to learn the fresh tips you have.

  • Dance Amor

    Fabulous post, you have denoted out some fantastic points, I likewise think this s a very wonderful website. I will visit again for more quality contents and also, recommend this site to all. Thanks

  • EgLogen

    Fabulous post, you have denoted out some fantastic points, I likewise think this s a very wonderful website. I will visit again for more quality contents and also, recommend this site to all. Thanks

  • rockvillesecurityguardexperts.com

    These kinds of posts actually make online reading worthwhile (and less of a burden) for everyone. Thanks for putting so much effort on this blog and I hope you’ll keep ’em coming!

  • bat

    thanks for sharing this with us! love it! <3

  • Don Allen

    I think this is an informative post and it is very beneficial and knowledgeable.

  • DevonBri

    It’s great to see posts like this as music and the platform and tool we use just keep on changing every day.

  • sonnerie telephone

    SonneriePro.com – Il s’agit d’un site Web en ligne proposant des sonneries gratuites pour Android, iPhone. Ceci est un fournisseur de sonneries sms, sonneries Samsung, sonneries iPhone, nouvelles sonneries de téléphone de 2020. Téléchargez des sonneries SMS, des sonneries de téléphone Samsung, les dernières sonneries iPhone.

  • guitar lessons

    I am amazed at how you explained things in this article. This article is very interesting, and I look forward to reading more of your posts. Thank you for sharing this article with us.

  • life insurance

    I really enjoyed reading your article. I found it in an informative and interesting work, so I think it is very helpful and knowledgeable.

  • kalyan satta

    I just found this blog and have high hopes for it to continue. Keep up the great work, its hard to find good ones. I have added to my favorites. Thank You.

  • ToqueParaCelular

    This is what I am trying to say about mobile ringtones. Thank you very much for this.

  • Sajol

    Watch and download Korean drama, movies, Kshow and other Asian dramas with english subtitles online free. Dramacool for everyone

  • Apartment Painters NYC

    Well worth a read. Got great insights and information from your blog. Thanks.

  • towing

    Great stuff keep it up.