Say Anything with a Tiny Self-Playing (and wearable) Mixtape!

Take a Speaker pHAT, a Pi Zero, and a pre-installed SD card and what do you have? A mixtape made for someone you want to give a Pi Zero to!

This tutorial shows you how to set up the Zero so that it will start playing the mixtape when plugged in, whether that's to a battery or to mains power. Of course, a battery means you can wear it too...


This tutorial requires you to have soldered the Speaker pHAT, so if you haven't done that yet, go and do it. We'll be right here.

The tutorial is broken into steps:

  1. Make speaker pHAT do useful things
  2. Make mixtape
  3. Make mixtape play on boot
  4. Stick badge back on, if needed

1. Make speaker pHAT do useful things

Alternatively, take the operating system of your choice, open a Terminal, and use our handy one line installer to install the speaker pHAT software. You should be connected to the internet for this because the data pixies need to run off and gather information.

You'll need to type:

curl -sS | bash

then press enter and y to both prompts.

It will then ask you if you want to reboot. Type y and press enter.

2. Make mixtape

First, we're going to need a music player. A widely used one is VLC. You can install this on your Pi by opening a Terminal and typing:

sudo apt-get install vlc

then press enter, and y to the prompt.

To check it's all working properly - there is a copy of the Bilge Tank theme in Pimoroni/speakerphat/test - you can try playing it as an mp3, m4a, or wav file and all of them should work with VLC. Type vlc mymusicfile.mp3 to test.

This next bit is entirely down to you, but you can choose mp3s of your favourite tunes, Say Anything by Peter Gabriel is, I believe, the correct one to play whilst holding this gift aloft. Alternatively, you could record greetings from yourself / your family to send to far-flung relatives.

Put all of the files into a playlist on VLC (on the menu at the top, click view and then playlist and you should be able to drag music files into it).

Once you've finished adding files, using the menu at the top, click media and then save playlist to file. Type a name for it (we called ours mixtape out of originality...)

3. Make mixtape play on boot

One of the easiest ways to make something happen when the Pi boots up is to put what you want to happen into crontab. Sandy has written a very good guide here, but, for ease of reference, here are the steps you need to follow.

In the terminal, type crontab -e and press enter. Choose option 2 (nano) by pressing 2 and enter.

crontab looks like this

Use the arrow keys to go to the bottom of the file. On a new line, type @reboot cvlc mixtape.xspf & and then save the file by pressing ctrl and x, agreeing to all the saving stuff (y, enter).

crontab with instructions

We have to use cvlc instead of normal vlc, because otherwise it would want to pop up the graphical (GUI) version of vlc and not get started in time. It's like diet vlc!

4. Stick badge back on, if needed


So now it's up to you how you present this to the recipient of your gift. You could post it with a little note saying "plug me in!". You could attach a pin badge and secretly attach it to their coat. You could stand outside their window holding the Speaker pHAT aloft...

That's all folks!

Search above to find more great tutorials and guides.

Plasma 2040

Swathe everything in rainbows with this all-in-one, USB-C powered controller for WS2812/Neopixel and APA102/Dotstar addressable LED strip.