-
1Download python and libraries
Install python3 on the Raspberry
sudo apt-get install python3
Install python3 RPi GPIO library
sudo apt-get install python3-rpi.gpio
Download https://github.com/mxgxw/MFRC522-python
then replace print "" by print("") to make it suitable for python3
sudo python3 setup.py install
-
2Install & configure MPD
sudo apt-get install mpd
configure
/etc/mpd.conf
group "audio" auto_update "yes" audio_output { type "alsa" name "USB" device "hw:0,0" # optional
-
3Enable SPI
sudo raspi-config
Interfacing options -> SPI enabled
-
4Configure Alsa
Alsa is the sound infrastructure. We need to tell it to use the USB Sound card:
/etc/modprobe.d/alsa-base.conf
# This sets the index value of the cards but doesn't reorder. options snd_usb_audio index=0 options snd_bcm2835 index=1 # Does the reordering. options snd slots=snd_usb_audio,snd_bcm2835
-
5Configure Network Share
Install Samba to make the Raspi available as a windows share
sudo apt-get update sudo apt-get install samba samba-common-bin
create the share directories (you can also use an USB Stick as storage)
mkdir /media/music mkdir /media/playlists
add them to the samba config to be available on the network
sudo nano /etc/samba/smb.conf
add
[playlists] Comment = Playlist files Path = /media/playlists Browseable = yes Writeable = Yes only guest = no create mask = 0777 directory mask = 0777 Public = yes Guest ok = yes [music] Comment = music files Path = /media/music Browseable = yes Writeable = Yes only guest = no create mask = 0777 directory mask = 0777 Public = yes Guest ok = yes
set a samba password
ududo smbpasswd -a pi
restart samba
sudo /etc/init.d/samba restart
Now you can add playlists and music files via network
-
6Add cronjob
We want our player to start right after booting, so
crontab -e
add
@reboot python3 /home/pi/pyJukebox/pyJukebox.py &
the path might vary, depending on where you've put the python files.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.