Skip to content

An Open Source Spotify and MP3 Player based on Pi MusicBox controlled through RFID Tags and GPIO Buttons.

Notifications You must be signed in to change notification settings

tschuehly/toddleplayer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

toddleplayer

toddleplayer is the manual and a bunch of scripts to create an MP3 and Spotify Player controlled through RFID Tags and GPIO Buttons.

Hardware

Required:

Wiring

PCMA5102A

To wire up the cheaper PCMA5102A breakout board you have to wire like this:

PCMA Raspberry
VCC 5V PIN 2
GND GND
FLT GND
DMP GND
SCL GND
BCK GPIO18 PIN 12
DIN GPIO21 PIN 40
LCK GPIO19 Pin 35
FMT GND

XMT <–> 10k Resistor <–> 3,3V of the PCM5102A board

PAM8403

Then you wire the L ,G and R Pins of the PCMA to the Input Pins of the PAM. You connect the + and - power pins of the pam8403 directly to the 5V of the Raspberry and GND. Then you connect your speakers to rout/lout + and -.

pHAT DAC

If you use the pHAT DAC you have to solder it. You can solder all of them or solder them the lazy way.

RC-522

RC522 Raspberry
3.3V 3.3V PIN 1
RST GPIO25 PIN 22
GND GND
MISO GPIO9 PIN 21
MOSI GPIO10 PIN19
SCK GPIO11 PIN 23
SDA GPIO8 PIN 24

Software

Pi MusicBox

To create this Player you first have to install Pi Musicbox on your local Raspberry. You can download the latest image frome here: RC6

Burn the image to an SD Card with Etcher

  1. Put the SD-card into your computer. Ignore the format warning when you're on windows. Open the contents of the 'config' folder of SD-Card in your Finder/Explorer.

  2. Open settings.ini and add your Wifi network and password to the file

  3. Set enable_ssh = true

  4. Set output = hifiberry_dac

  5. Set resize_once = true

You can also set your Spotify and Spotify-Web credentials already.

Then you have to put the SD card in the Raspberry and power it up. You can lookup the IP adress on your router. To test your wiring connect to the toddleplayer in the webbrowser and run a radiostream unter the tab Streams.

To connect to the Raspberry use your favorite ssh client like PuTTY.

The standard user is root and the password is musicbox.

First Setup

You have to download the required scripts and unpack them from the latest release.

cd ../
wget https://github.com/tschuehly/toddleplayer/releases/download/test/toddleplayer.zip
unzip toddleplayer.zip
rm toddleplayer.zip
cd toddleplayer/

music-cards

If you use a USB RFID Reader continue here. If you use the MFRC-522 continue down below with the RC522_music-cards extension.

Next you have to install python evdev.

wget http://dl.piwall.co.uk/python-evdev_0.4.1-1_armhf.deb
dpkg -i python-evdev_0.4.1-1_armhf.deb

Then you have to configure it.

cd music-cards/
python config.py

Select the RFID reader from the inputs. Usually by pressing 0.

RC522_music-cards

sudo nano /boot/config.txt

Find this line and remove the '#':

#dtparam=spi=on

Next, install Python 2.7 dev and gcc using:

sudo apt-get update
sudo apt-get install python2.7-dev
sudo apt-get install gcc

Then download and install the special SPI tool for python with wget.

wget https://github.com/lthiery/SPI-Py/archive/master.zip
unzip master.zip
rm master.zip
cd ./SPI-Py-master

then install it by

sudo python setup.py install
cd ../

Next you have to install python-mpd2 from source here

wget https://github.com/Mic92/python-mpd2/archive/master.zip

unzip master.zip
rm master.zip
cd ./python-mpd2-master
python setup.py install

musicbox_gpio script

The easiest way to start the script on startup is to append the following lines to the /opt/musicbox/startup.sh. You have to replace /xxxx/ with either /RC522_music-cards/ or /music-cards/

nohup python -u /toddleplayer/gpio_control.py &> /toddleplayer/gpio.log &
echo "started gpio_control.py"
sleep 15
python -u /toddleplayer/xxxx/box.py &> /toddleplayer/box.log &
echo "started box.py"

Configuration

Now you can create as many folders as you want in the /music/ folder and add the RFID tags accordingly

python add_card.py

Now you can choose either if you want to add a local folder by pressing [L] or a spotify playlist by pressing [S]

then you have to type in the folder you want to associate with the RFID Card

file:/music/foldername/

To quit you just have to press CTRL + C

Credit

The toddleplayer is based on the Pi Musicbox Image: https://github.com/pimusicbox/pimusicbox ,

the music-cards mopidy extension which I altered heavily: https://github.com/fsahli/music-cards ,

the RC522_music-cards project: https://github.com/tschuehly/RC522_music-cards , which uses the MFRC522-python library: https://github.com/mxgxw/MFRC522-python ,

the python-mpd2 library: https://github.com/Mic92/python-mpd2 .

© Thomas Schühly

About

An Open Source Spotify and MP3 Player based on Pi MusicBox controlled through RFID Tags and GPIO Buttons.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages