-
Notifications
You must be signed in to change notification settings - Fork 0
CONFIGURE
Written for an tested on Raspbian GNU/Linux 9.4 (stretch) Kernel version: 4.14
This is the second step. Make sure to go through the installation first.
Once you finished with the configuration, read the manual to add audio files and RFID cards.
MUST READ: if you encounter problems, please read this page in the wiki: RFID Reader Special
The RFID reader is connected to your RPi via USB. As you plug it in, it should have made a 'beep'. And each time you swipe a keyring or card across the card reader, it should also make a 'beep'.
Let's see if your reader is probably connected and recognised by your RPi. Check the following:
- The LED on the reader is on.
- When swiping a card or keyring, you hear a 'beep' noise.
If you can answer both with yes, you can be 90% sure all is working well. Just to be 100% sure, here are a few command to type on the command line which should list your reader.
ls -la /dev/input/by-id/
In my case, this will list the Barcode Reader and show that the system can interact with the device under event0
:
lrwxrwxrwx 1 root root 9 Apr 30 09:55 usb-Sycreader_USB_Reader_08FF20150112-event-kbd -> ../event1
Now we know a lot about the RFID reader attached to our RPi. In order to use it as a controller for our Phoniebox, the software needs to know which device to listen to.
To register your device, go to the directory containing all the scripts and run the file RegisterDevice.py
.
cd /home/pi/RPi-Jukebox-RFID/scripts/
python3 RegisterDevice.py
This will bring up a list of one or more devices. Spot the device you are using as a RFID reader, type the number (in this case 2) and hit Enter.
Choose the reader from list
0 Chicony USB Keyboard
1 Chicony USB Keyboard
2 Sycreader USB Reader
3 Logitech USB-PS/2 Optical Mouse
You can check if your device was registered properly by taking a look inside the file that was just generated, called deviceName.txt
.
cat deviceName.txt
Now your Phoniebox knows which device to listen to when you are swiping your cards or keyrings.
Inside the directory /home/pi/RPi-Jukebox-RFID/settings/
you find the file rfid_trigger_play.conf.sample
You need to make a copy of this files, to avoid overwriting changes if the content might change in the git repo.
Inside this conf
file, you can add IDs from RFID cards to control
the functionality of the Phoniebox. See the content of the file for
more explanation.
cd /home/pi/RPi-Jukebox-RFID/settings/
cp rfid_trigger_play.conf.sample rfid_trigger_play.conf
sudo chown pi:pi rfid_trigger_play.conf
sudo chmod 665 rfid_trigger_play.conf
Creating files for the settings
folder which contain the short name
of the amixer iface used and the percentage the volume increase or
decreases when using the volumeup
and volumedown
function.
Troubleshooting:
- Inside
settings/Audio_iFace_Name
is the iFace name of the sound card. By default for the RPi this would bePCM
. But this does not work for every setup. If you are using phatbeat as a DAC for example, you need to change the content ofAudio_iFace_Name
fromPCM
toMaster
orSpeaker
. Other external sound cards might use different interface names. To see ifPCM
could work for you, typeamixer sget PCM
. To list all available iFace names, typeamixer scontrols
. - If one is using an audio amplifier (like the pHAT BEAT) without a physical volume limiter (like a potentiometer) your Phoniebox can get very loud "accidentally". The maximal volume can be set in
settings/Max_Volume_Limit
.
echo "PCM" > /home/pi/RPi-Jukebox-RFID/settings/Audio_iFace_Name
echo "3" > /home/pi/RPi-Jukebox-RFID/settings/Audio_Volume_Change_Step
echo "100" > /home/pi/RPi-Jukebox-RFID/settings/Max_Volume_Limit
echo "0" > /home/pi/RPi-Jukebox-RFID/settings/Idle_Time_Before_Shutdown
This is the final tweak to the configuration: automatically start our Phoniebox software after the RPi has booted and have it listen to RFID cards. The Raspbian OS 9 (stretch) uses systemd to start the components.
Systemd will launch the required services after booting AND take care of restarting the script in case they die.
First copy the service config files to the correct directory:
sudo cp /home/pi/RPi-Jukebox-RFID/misc/sampleconfigs/phoniebox-rfid-reader.service.stretch-default.sample /etc/systemd/system/phoniebox-rfid-reader.service
sudo cp /home/pi/RPi-Jukebox-RFID/misc/sampleconfigs/phoniebox-startup-sound.service.stretch-default.sample /etc/systemd/system/phoniebox-startup-sound.service
sudo cp /home/pi/RPi-Jukebox-RFID/misc/sampleconfigs/phoniebox-gpio-control.service.sample /etc/systemd/system/phoniebox-gpio-control.service
sudo cp /home/pi/RPi-Jukebox-RFID/misc/sampleconfigs/phoniebox-idle-watchdog.service.sample /etc/systemd/system/phoniebox-idle-watchdog.service
Now systemd has to be notified that there are new service files:
sudo systemctl daemon-reload
Now enable the service files, which will start them on reboot:
sudo systemctl enable phoniebox-idle-watchdog
sudo systemctl enable phoniebox-rfid-reader
sudo systemctl enable phoniebox-startup-sound
sudo systemctl enable phoniebox-gpio-control
And now you can reboot to have your daemons running or start them manually:
sudo systemctl start phoniebox-idle-watchdog
sudo systemctl start phoniebox-rfid-reader
sudo systemctl start phoniebox-startup-sound
sudo systemctl start phoniebox-gpio-buttons
The newly installed service can be started either by rebooting the Phoniebox or
with:
sudo systemctl start phoniebox-rfid-reader
To see if the reader process is running use the following command:
sudo systemctl status phoniebox-rfid-reader
This should produce an output like this:
pi@Jukebox:~ $ systemctl status phoniebox-rfid-reader
* phoniebox-rfid-reader.service - RFID-Reader Service
Loaded: loaded (/etc/systemd/system/phoniebox-rfid-reader.service; enabled; vendor pres
Active: active (running) since Fri 2018-04-13 07:34:53 UTC; 5h 47min ago
Main PID: 393 (python2)
CGroup: /system.slice/phoniebox-rfid-reader.service
ββ393 /usr/bin/python2 /home/pi/RPi-Jukebox-RFID/scripts/daemon_rfid_
Apr 13 07:34:53 Jukebox systemd[1]: Started RFID-Reader Service.
The mp3s for startup and shutdown sound have to be copied to the right folder. You may use your own sound files as well.
cp /home/pi/RPi-Jukebox-RFID/misc/sampleconfigs/startupsound.mp3.sample /home/pi/RPi-Jukebox-RFID/shared/startupsound.mp3
cp /home/pi/RPi-Jukebox-RFID/misc/sampleconfigs/shutdownsound.mp3.sample /home/pi/RPi-Jukebox-RFID/shared/shutdownsound.mp3
Once the software is all in place, make sure the hardware is connected correctly.
- Connect a USB hub with the power supply. From this hub, connect the RPi to one plug and the USB powered speakers to another. Do not connect the speakers to the USB of the RPi, because the power coming from the RPi might not be enough to run the speakers.
- You need a number of USB plugs to connect the following and therefore possibly need a second USB hub to connect to the RPi USB:
- RFID card reader
- WiFi dongle (WLAN adapter for RPi < version 3)
- External soundcard (optional)
- Connect the speakers with the 3.5mm jack to the soundcard (either the built in one from the RPi or the external one attached to the RPi over USB).
Adding control buttons for volume, skipping tracks, pause, play, read the GPIO buttons installation guide.
Now the installation and configuration are complete. Time to read the manual of the Phoniebox to add songs, web streams, register new cards and so on. Read the MANUAL.md
.
If you like Phoniebox, consider: buy me a coffee or PayPal
- Code: https://github.com/MiczFlor/RPi-Jukebox-RFID
- Phoniebox home page: English | Deutsch
Phoniebox is a contactless jukebox for the Raspberry Pi, playing audio files, playlists, podcasts, web streams and spotify triggered by RFID cards. All plug and play via USB, no soldering iron needed. Update: if you must, it now also features a howto for adding GPIO buttons controls.
Visit Phoniebox.de
π₯ Version 3
- β Releases
- π΅ Install Jukebox Version 3
- π Report a bug
- π Propose a feature
- βοΈ Feature Status
- π Documentation
- π©βπ» Development
- βοΈ Contributing
- π¦ Code
πΆ Version 2
- β Releases
- π΅ Install Jukebox Version 2
- π Report a bug
- βοΈ Features
- π Documentation
- βοΈ Contributing
- π¦ Code
Version 2 Pages
-
Setup / Upgrades
- Synchronising Phonieboxes in a local network
- Smart Home remote control with MQTT
- Hardware Pinout Overview
- Systemwide Equalizer
- Phoniebox with read-only Filesystem
- HiFiBerry Soundcard Details
- WM8960 Hi-Fi HAT
- PAM8403 Amplifier Power Off
- TPA3118 Amplifier Power Off and EMI improvement
- External Non USB Audio DAC ES9023, PCM5102, etc.
- On-board LEDs with fibre optics
- Setting GPIOs at boot time
- Stop on removal with USB RFID Reader
- Firmware update improves audio out
- Architecture