Santa-pi, a music player for a charity fundraising float

This is a Raspberry Pi. A small, powerful, low cost computer.

Raspberry Pi Model 3B+

I’m writing this blog post from the pi you see in the photo. It is very slow compared to my laptop but it works and is in front of me now, whereas my laptop is a whole 2 meters away on another desk.

This is the Raspberry Pi Model 3 B+ that used to run the background music for my small business, a shop that sells furniture and appliances for kitchens, bedrooms and bathrooms. I retired this pi from service a few years ago when we moved to a different background music service. Before the new company I used Jamendo which allowed me to licence and download a few hundred tracks every few months. I would copy them to the pi over the wifi network and the pi would play the music. I wrote a small script that meant as the pi powered on it would start playing music tracks randomly from the selection I had uploaded to it. No human interaction, once setup it ran and ran and ran. Perfect.

This year, as many years before, I have volunteered to help Santa travel around Canterbury with the Rotary Club I’m a member of. We had problems this year with the float background music in that the old donated Ipod ran out of power. When connected to a battery the plug frequently dislodged the audio connection and affected the sound quality. I realised I could repurpose my old Pi to make a better sound source for the float.

Steps

  1. A fresh installation of Raspbian
  2. Find some example code on the internet for auto-starting applications when the pi is powered.
  3. Find some suitable music tracks (search, find, repeat)
  4. Put them in a directory on the desktop called ‘music’
  5. Write a script to autostart the playing of music.
  6. Remember to select the correct audio output (3.5mm AV Jack, not the HDMIdisplay)
  7. Buy a suitable enclosure to secure the pi against weather. The only connections it needs when setup to run is power (through micro-usb) and the 3.5mm aduio jack out to the float speakers. I found a nice circular panel mount connector for those, easy to drill and fit.
Set the audio output by right clicking the speaker icon in the top right.

The Script

Modifying a code idea from StackOverflow;

create a file: nano ~/.config/autostart/mygui.desktop

Add the following and save.

[Desktop Entry]
Name=AutoPlayMusic
Exec=/usr/bin/vlc -LZ "/home/pi/Desktop/music"
Type=Application
Hidden=False

Exec starts VLC, the music player application.
-LZ flags set “Loop” and “Random”, it plays forever in random order.
“/home/pi/Desktop/music” is where I put the Directory full of music files.

Restart the pi to check it works.

In the future anyone can connect a keyboard, mouse end monitor and change the music, although they will have to remove it from the case to access the USB ports.

The finished raspberry pi auto playing juke box in it’s weatherproof case.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Search this site


Free apps

  • birthday.sroot.eu – Your birthday or other celebration date based on [years on other planets] / [how many seconds/days] / [how far you’ve travelled around the sun]
  • stampulator.sroot.eu – Calculates the combination and how many 1st, 2nd, large 1st and large 2nd class Royal Mail stamps you need on large envelopes and packets

Recent posts


Archives


Categories