I'm really happy that some people actually used this, but I have no plans on updating this project, sorry. Checkout this fork, there are some more added features.
Raspberry Pi CD/MP3 player usable with PiFace CAD 2 and with web/mobile interface. It autoplays audio and MP3 CDs and MP3s from USB disks and is controllable from web interface, Android app or PiFace CAD 2 module (including IR remote controll). Written in Python/React/React Native. Made as a bachelor's thesis at University of South Bohemia.
- Raspberry Pi 3 (tested)
- USB CD/DVD drive
- PiFace CAD 2 (optional)
- external sound card (optional)
- At least 2 A power supply (only if your CD/DVD drive is powered from USB)
- Raspbian Stretch (tested)
-
Download the newest release of raspberry-pi-cdplayer from here or build your own.
-
Increase USB current limit (only if your CD/DVD drive is powered from USB)
echo 'max_usb_current=1 >> '/boot/config.txt'- Set your default sound card (skip if you don't use external sound card)
Create file ~/.asoundrc with this content. The card number is 1 in case of external USB sound card
pcm.!default {
type hw
card <sound card number>
}
ctl.!default {
type hw
card <sound card number>
}
- Set the volume of your sound card to 100%.
amixer -c <sound card number> set Speaker playback 100% unmute- Install required packages
sudo apt install mpv eject cd-discid socat lirc
sudo pip3 install mutagen flask flask-socketio pyudevYou can skip next steps if you don't use PiFace CAD 2
- Enable SPI interface in raspi-config (skip if you don't use PiFace CAD 2)
sudo raspi-config- Build and install packages which aren't in the repository
sudo apt install liblircclient-dev cython gcc
git clone https://github.com/tompreston/python-lirc.git
cd python-lirc
make py3 && sudo python3 setup.py install
cd ..
git clone https://github.com/piface/pifacecommon.git
cd pifacecommon
sudo python3 setup.py build && sudo python3 setup.py install
cd ..
git clone https://github.com/piface/pifacecad.git
cd pifacecad
sudo python3 setup.py build && sudo python3 setup.py install
cd ..- Set up lirc
wget https://raw.github.com/piface/pifacecad/master/bin/setup_pifacecad_lirc.sh
chmod +x setup_pifacecad_lirc.sh
sudo ./setup_pifacecad_lirc.sh
wget -O lirc-old2new https://sourceforge.net/p/lirc/git/ci/debian/tree/debian/lirc-old2new?format=raw
chmod +x lirc-old2new
sudo ./lirc-old2new
sudo reboot- Set up your IR remote control
irrecord remote.lircd.conf
sudo mv remote.lircd.conf /etc/lirc/lircd.conf.d/remote.lircd.conf
sudo rm /etc/lirc/lircd.conf.d/devinput.lircd.conf
sudo systemctl restart lircd.socket lircdThe configuration of the application is in the media_player.conf file. You can change the name of the device (this name is then used by lirc), IP and PORT of the web interface, mpv unix socket path, CD/DVD drive device name, USB flash disk device name and default playback volume.
You don't have to configure anything, the application should work without changing the file.
If you want to use remote control with lirc, you have to create ~/.lircrc file. Check the .lircrc.example file how to configure it.
Run main.py with python3.
python3 main.pyThe program now autoplays any audio CD or CD/DVD/USB disk with MP3s on them. You can control the playback by buttons on PiFace CAD 2, IR remote control, from web interface or Android application - just install the .apk file in mobile_client folder.
- Previous folder/artist/album
- Next folder/artist/album
- Volume down
- Volume up
- Eject disc/unmount usb drive and stop playback
- Next song in playlist
- Previous song in playlist
- Play/pause
Just put your Raspberry Pi's http://ip:port/ to your browser. Default port is 51234. The insterface is fully reponsive, so it works on any mobile device.
- Play/pause button
- Previous/next song in playlist
- Previous/next folder/artist/album in library
- Eject button - stopsthe playback and eject the CD/DVD from the drive
- Volume controls
- Playback informations - you can click the seeker to seek time
- MP3 media library - by folders or artists/albums (from ID3 tags)
- Current playlist
The application consists of 3 screens. List of your Raspberry Pi CD players, edit screen of the list record and control screen, which is the same as web interface. You can also control the playback from notification.
Home screen
- List of added Rasberry Pi CD players - touching it opens edit screen
- Button to connect to the last connected Raspberry Pi
- Add Raspberry Pi to the list button - opens edit screen
Edit screen
- IP address input
- Port input
- Save record button
- Delete record button
- Connect to the inserted IP address and port
Control screen
- Opens and closes MP3 media library
- Opens and closes current playlist
- The rest is the same as in the web interface
If you want to build the application on your own, just run build.bat (Windows) or build.sh (Bash) script. You will need to have node.js with npm installed.
If you need a case for Raspberry Pi 3 with PiFace CAD 2 and you have an access to 3D printer, there are .stl files in the case_stl folder. Thanks to my thesis supervisor for creating them.



