Skip to content

Troubleshooting FAQ

s-martin edited this page May 13, 2024 · 42 revisions

Troubleshooting / FAQ

Spotify won’t play, but after scan of library it works

You may experience that after booting Spotify doesn’t work, but if you scan the library it suddenly works.

Probably the internet connection wasn’t available when Spotify login was done, so the login failed.

When you scanned the library Mopidy was restarted and therefore a login was done. Please see also issue https://github.com/MiczFlor/RPi-Jukebox-RFID/issues/893

If it’s OK for you that Phoniebox only works with an internet connection, you could configure RPi to wait until internet connection is available, see https://raspberrypi.stackexchange.com/questions/45769/how-to-wait-for-networking-on-login-after-reboot

More details also here: https://github.com/MiczFlor/RPi-Jukebox-RFID/issues/893#issuecomment-613952753

Mopidy 3.1 also waits for an internet connection, which should reduce this problem, see https://github.com/mopidy/mopidy/pull/1946

If you still experience this, you might want to additionally install this plugin Mopidy-WaitForInternet.

Spotify does not connect or is really slow to connect

Spotify can create problems when the Phoniebox tries to connect because of the time and date set on the Pi. It has been shown in two cases that installing a (low price) hardware RTC solves this issue. You can read more in this thread, starting here.

This is the hardware used:

RTC DS3231 AT24C32 Memory Real Time Clock I2C Modul für Arduino AVR UNO ARM PIC

Das DS3231 Modul ist eine genaue I2C Echtzeituhr (RTC), mit integriertem Temperatur - Quarzoszillator ( TCXO) und Kristall. Das Modul verfügt über eine Wiederaufladbare Knopfbatterie LIR2032.

Spotify causes slow startup time

If you would like to cut down some of your Phoniebox startup time, there is the option to disable an initial refresh within mopidy-spotify, which goes through all of your account's custom and favourited Spotify playlists.

sudo nano /etc/mopidy/mopidy.conf

Navigate down to the [spotify] configuration group

Uncomment and set allow_playlists = false

Ctrl + O, Enter, Ctrl + X

sudo reboot; exit to test the faster startup

The web app isn't showing up

If you have the webserver apache running on your Pi when installing Phoniebox, the web app is not showing. Uninstall apache to fix this. Phoniebox is using the webserver lighttpd.

The album covers are not displayed in the web app

If your audio folder contains a file called cover.jpg (lowercase!) it will be displayed in the web app above the player controls.

  • Possibly your file is named differently? Like Cover.JPG or cover.jpeg?
  • Make sure the group www-data has the rights to see the file (i.e. the webserver can read it).

I moved my audiofiles now the playout does not work

If you are moving your audio files to a different location, you need to edit two files to make sure Phoniebox (in alliance with mpd) can still play the content.

nano /home/pi/RPi-Jukebox-RFID/settings/Audio_Folders_Path

... needs to contain the absolute path to your folder containing other audio folders. And so does the variable music_directory in the config file of mpd:

sudo nano /etc/mpd.conf

Once you have these changed, update mpd:

sudo service mpd restart
mpc update

I added new folders with audiofiles but the playout does not work

  • Check if permissions are set correctly (777 for folders - 766for audio files)
  • Update mpc
mpc update

I want to improve the onboard audio quality

The Pi onboard audio quality is not the best. If you don't intend to go with an external USB card, these hints might help to improve the quality. Please share your experience in the "issues" section on github. These suggestions might depend on your operating system, so don't just throw them all in the mix :) Here you can find a good list of audio improvements to try. What seems to work for many:

  • Setting 'audio dither': The onboard audio output uses config options to change the way the analogue audio is driven, and whether some firmware features are enabled or not. See the official Raspberry page for more information on disable_audio_dither and enable_audio_dither.
  • Settings for PMW driver: Available in newer Raspbian as of Feb 2016 is a PWM audio driver that significantly increases the audio quality available from the 3.5mm TRRS jack. In /boot/config.txt add the following line: audio_pwm_mode=2
  • Firmware update: If you want to update the RPI firmware, this is the right point to do so. This manual was written for the default firmware. Read more about how to update and why you might want to give it a try in a separate Firmware Update document.

I am traveling, how can i still configure my phoniebox without a network?

You can make use of the "autohotspot" feature, which can be configured during installation (since version 2.5). This will automatically set up a WiFi hotspot if no known network is found. The default values during installation will be:

  • SSID: "phoniebox"
  • Password: "PlayItLoud"
  • WiFi Country Code: "DE"
  • IP adress: "10.0.0.5"

It can also later be configured manually with the setup script.

If the hotspot is active you can connect to the WiFi with any device and access your Phoniebox. The detection if a known network is around is timed to every 2 minutes.

I want to add another Wi-ssid e.g. at a friend, after moving?

The easiest way is to add the new network via the wifi settings menu beforehand or setup the autohotspot feature to always be able to connect to your Phoniebox.

If you have already lost access to your Phoniebox due to missing network, you need to connect a monitor and keyboard. Then run the following command and supply your configuration. This will work for dhcpcd (<=bullseye) and NetworkManager (>=bookworm)

$ source scripts/helperscripts/inc.networkHelper.sh && add_wireless_network 'YOUR_WIFI_INTERFACE' 'YOUR_WIFI_SSID' 'YOUR_WIFI_PASSWORD' YOUR_WIFI_PRIO

For example:

$ source scripts/helperscripts/inc.networkHelper.sh && add_wireless_network 'wlan0' 'homewifi' 'homewifipassword' 0

Some words to security and costs:

Mobile Hotspot use: Be aware your PI is using your perhaps expensive data plan (e.g. in foreign country) so perhaps deactivate mobile data prior to letting PI connect.

Hotel use / Hotspot use: Be aware that everyone on that wifi can connect to your Pi and could at least control mpc and upload files.

To always be able to connect to your phoniebox no matter what IP config the network has, be sure to know the hostname (default:raspberry) or change it to a more unique one.

$ sudo nano /etc/hostname

just put the name in there

phoniebox

Save the changes with Ctrl & O then Enter then Ctrl & X.

$ sudo reboot

Then always connect to your box, like this:

  • via browser http://phoniebox (be sure to use the http:// - if it didn't work, it could be you land on phoniebox.de ;) )
  • via ssh using phoniebox:22

Audio is not working

Before you file a ticket on github, please read this section and when you file it, please answer these questions:

  • what version are you on? Type in terminal cat /home/pi/RPi-Jukebox-RFID/settings/version
  • what soundcard are you using?
  • does your Raspberry Pi play any sound?
  • did the audio work and then you connected a sound card and now it doesn't?

This might occur if you are using external sound cards like pHat BEAT or the like. I split this into two parts: a) sound did never work and b) sound worked once, now, with a new soundcard, it doesn't.

a) Audio never worked

This could happen if you are using an external soundcard. Generally, if you have audio troubles, try searching the web, because it might get complicated. But try this first:

Learn here why to specify the audio iFace in the file settings/Audio_iFace_Name.

If that doesn't work, check if the device is recognised by your Pi:

$ cat /proc/asound/modules
0 snd_bcm2835
1 snd_usb_audio

This shows that device 1 is the usb audio card. Open the sound configuration file.

$ sudo nano /usr/share/alsa/alsa.conf

Now replace the lines near the end of the file:

defaults.ctl.card 0
defaults.pcm.card 0

with:

defaults.ctl.card 1
defaults.pcm.card 1

According to this post the better way is to add or modify file /etc/asound.conf.

$ sudo nano /etc/asound.conf

And add the following content. You can change this, of course to match your settings:

pcm.!default {
    type hw
    card 1
}
ctl.!default {
    type hw
    card 1
}

Now the audio card for the system is set to 1. Reboot the RPi:

$ sudo reboot

Audio worked, then you changed the sound card and it stopped working

If you change your sound card, you need to alter the configuration in two parts by adding the iFace name:

  • Inside settings/Audio_iFace_Name of your Phoniebox installation
  • Inside /etc/mpd.conf

During the install procedure, both files are set using PCM. After you added your sound card, you need to alter these two files. In mpd.conf you can find a section which looks like this:

audio_output {
	type		"alsa"
	name		"My ALSA Device"
#	device		"hw:0,0"	# optional
#	mixer_type      "hardware"      # optional
#	mixer_device	"default"	# optional
	mixer_control	"%AUDIOiFace%"		# optional
#	mixer_index	"0"		# optional
}

Replace %AUDIOiFace% with the iFace name of your device. Other values might also need to be changed. Consult the mpd manual for details.

How do I get the right iFace name?, you might wonder. Rightly so. In short: type sudo amixer scontrols. This will return something like this:

Simple mixer control 'Speaker',0
Simple mixer control 'Mic',0
Simple mixer control 'Auto Gain Control',0

In this case, instead of PCM you need to use Speaker.

hifiberry DAC+ soundcard details

Guide moved to HiFiBerry Soundcard Details.

Raspberry Pi Update May 2020 broke my audio

In May 2020 the audio behavior of Raspberry Pi was changed, HDMI and headphone output became two different configurations in the Raspberry OS.

Please see https://retropie.org.uk/forum/topic/26434/usb-audio-broke-after-latest-updates/2 https://www.raspberrypi.org/blog/latest-raspberry-pi-os-update-may-2020/

If you experience issues please check with

sudo alsamixer

sudo amixer scontrols

aplay -l

how your audio devices are now called and which number they may have.

Changed names (e.g. "Headphone" instead of "PCM") need to be updated in /etc/mpd.conf, settings/global.conf and settings/Audio_iFace_Name.

If you made changes in /etc/asound.conf (see https://github.com/MiczFlor/RPi-Jukebox-RFID/wiki/Troubleshooting-FAQ#audio-is-not-working) you maybe need to update the numbers for the device as seen in aplay -l.

See also issue https://github.com/MiczFlor/RPi-Jukebox-RFID/issues/973

Changing the volume does not work, but the playout works

If you change your sound card, you need to alter the configuration in two parts by adding the iFace name:

  • Inside settings/Audio_iFace_Name of your Phoniebox installation
  • Inside /etc/mpd.conf

Jump to the section which covers changes after changing the audio card to see more.

Volume is generally too loud

Issue found with Raspberry Pi 4 and HiFiBerry MiniAmp: Audio output is very loud despite low volumes (1..5%) set in Phoniebox can be solved on command line:

  1. Run $ sudo alsamixer a. If "device does not have any controls" appears while the soundcard is correct, exit alsamixer and run $ sudo raspi-config and via "System Options" -> "S2 Audio" select the soundcard. Then re-run alsamixer.
  2. Set volume to maybe 40% using arrow keys (up and down)
  3. Close using CTRL+C
  4. Store setting permanently using $ sudo alsactl store

Fix broken youtube-dl while staying on same RPi-Jukebox-RFID releaseversion

Youtube download could fail after some time (due to site/protocol... changes). There could be no error displayed in webfrontend and the log also does not show an error. To check if the service has a problem just manually run:

youtube-dl -f bestaudio --extract-audio --audio-format mp3 https://www.youtube.com/watch?v=7GI0VdPehQI

If it says update youtube-dl and if you don't want a full phoniebox reinstall or a regular RPi-Jukebox-RFID update to the newest releaseversion here is the way to update youtube-dl only:

sudo pip install --upgrade youtube_dl

This will only upgrade this service and will leave the rest of your install untouched. More details: https://github.com/MiczFlor/RPi-Jukebox-RFID/issues/442

daemon_rfid_reader.py only works via SSH not by RFID cards

daemon_rfid_reader.py works perfectly when running through SSH manually. However, when running at reboot, it does not play the audio files when triggered by RFID tag. This can happen when cron runs them too early in the boot process.

Solution: Delay running the script by 60 secs.

@reboot sleep 60 && mpg123 /home/pi/RPi-Jukebox-RFID/misc/startupsound.mp3
@reboot sleep 60 && python2 /home/pi/RPi-Jukebox-RFID/scripts/daemon_rfid_reader.py &

Script is closed unexpectedly

In some cases it might occur that the daemon_rfid_reader.py script is colsed by the system unexpectedly. In this case you can add another script to check regularly if the script is still running and if not, restart it. Created the following shell script named chk_daemon_rfid_reader.sh in the folder /home/pi/RPi-Jukebox-RFID/scripts/

# check rfid_reader_daemon
ps -ef | grep -v grep | grep python2
# if not found - equals to 1, start it
if [ $? -eq 1 ]
then
python2 /home/pi/RPi-Jukebox-RFID/scripts/daemon_rfid_reader.py &
else
echo "eq 0 - rfid_reader_daemon found - do nothing"

Make the file executable:

chmod +x /home/pi/RPi-Jukebox-RFID/scripts/chk_daemon_rfid_reader.sh

Run this script every minute by adding the following line via crontab:

* * * * * /home/pi/RPi-Jukebox-RFID/scripts/chk_daemon_rfid_reader.sh &

The RFID Reader doesn't seem to work

There could be many reasons why the RFID Reader is not working reliably or behaves strangely. This could be due to a weak power supply or an insuficient power bank. Or not connecting all pins if you use a non-USB reader. Worth trying out before you try anything else.

If you used the install script, you might have forgotten to register your RFID card reader. See Identify and configure your RFID reader.

How can I disable the beeping noixe of the RFID Reader?

You might want to have a look at this discussion thread. The most promising solutions that came up were all opening up the RFID Reader and then:

  • cut out the beeper
  • stick some tape over the beeper to muffle it or
  • drop some candle wax on the beeper to muffle it

Note: in another thread, users of a different RFID reader without a beep were discussing how to make a beep. So before you kill it alltogether, you might try muffling it.

I want to translate the Web UI to another

The language settings can be changed in the Web UI under Settings. In the folder htdocs/lang you will find files such as:

  • lang-de-DE.php
  • lang-en-UK.php

If you don't find your language there, you can create a translation:

  • Open the file lang-en-UK (this is the default file and will always be up to date)
  • Save the file as a new file with the name lang-xx-XX.php (where xx-XX follows this convention)
  • Do NOT edit the file you opened, before you saved it under a new name. This would the overwrite the original file!!!
  • After you have completed the translation, please share your work with the community as a pull request or post it in the issue thred on github

Everything seems to work, but I hear nothing when swiping a card

If the RFID reader works, and also the ID cards are listed in the latestID.txt and the WebApp plays audio correctly, but the cards don't start the audio playout, this is what could be the issue:

  • Make sure your editor does not add a line break at the end of the shortcuts files you are editing. It must only contain the folder name you want to trigger.

I would like to use two cards / IDs to do the same thing

In this example, you will create two cards to do the same thing: set the volume level to 95%. After you installed the box and it works, to be safe, make a backup of the daemon script:

cp /home/pi/RPi-Jukebox-RFID/scripts/rfid_trigger_play.sh /home/pi/RPi-Jukebox-RFID/scripts/rfid_trigger_play.sh.backup

If you make a mistake, you can revert your changes with this command:

cp /home/pi/RPi-Jukebox-RFID/scripts/rfid_trigger_play.sh.backup /home/pi/RPi-Jukebox-RFID/scripts/rfid_trigger_play.sh

Then open the script in a text editor. At the top of the script you need to add new variables for the master keychain. As an example, let's say the volume setting for 95% is on both chains. Currently there is only one:

CMDVOL95="%CMDVOL95%"

You will add another:

CMDVOL95="%CMDVOL95%"
CMDMASTERVOL95="%CMDMASTERVOL95%"

Once you filled in your IDs, it will look something like this:

CMDVOL95="123456789"
CMDMASTERVOL95="987654321"

Now you also duplicate the section in the script below and do the same thing for both cards. Now it says:

elif [ "$CARDID" == "$CMDVOL95" ]
then
    # amixer sset 'PCM' 95%
    $PATHDATA/playout_controls.sh -c=setvolume -v=95

Once you made the changes, it will say this:

elif [ "$CARDID" == "$CMDVOL95" ]
then
    # amixer sset 'PCM' 95%
    $PATHDATA/playout_controls.sh -c=setvolume -v=95

elif [ "$CARDID" == "$CMDMASTERVOL95" ]
then
    # amixer sset 'PCM' 95%
    $PATHDATA/playout_controls.sh -c=setvolume -v=95

Using Logitech V20 Speaker

They Logitech V20 Speaker has some keys and will be recognized as normal usb keyboard input. The following script can be added to make these recognised by Phoniebox (kudos to contributor ekorn):

#File with Phoniebox keybindings for the Logitech V20 Speaker
#loadkeys /home/pi/RPi-Jukebox-RFID/misc/mykeys

#play/pause
string F100 = "/home/pi/RPi-Jukebox-RFID/scripts/playout_controls.sh -c=playerpause\n"
string F101 = "/home/pi/RPi-Jukebox-RFID/scripts/playout_controls.sh -c=playerstop\n"
string F102 = "/home/pi/RPi-Jukebox-RFID/scripts/playout_controls.sh -c=playerprev\n"
string F103 = "/home/pi/RPi-Jukebox-RFID/scripts/playout_controls.sh -c=playernext\n"
#mute/unmute
string F104 = "amixer -c 1 set PCM 1+ toggle\n"
string F105 = "/home/pi/RPi-Jukebox-RFID/scripts/playout_controls.sh -c=volumeup\n"
string F106 = "/home/pi/RPi-Jukebox-RFID/scripts/playout_controls.sh -c=volumedown\n"

keycode 164 = F100
keycode 166 = F101
keycode 165 = F102
keycode 163 = F103
keycode 113 = F104
keycode 115 = F105
keycode 114 = F106

and add it to the end of the /etc/rc.local to autostart it and make sure that the pi user is loged in so that the key inputs work with raspi-config->Boot Options->Autologin Text Console

Recorder functionality

If you are using a external sound card with micro line in, phoniebox is able to record the audio. The recordings can be controlled with the commands STARTRECORD600 (starts recording for max 10 minutes) and STOPRECORD. A RFID card can be assigned in rfid_trigger_play.conf

STARTRECORD600 ="%STARTRECORD600%"
STOPRECORD = "%STOPRECORD%"

If a recording is already is runnig, no other recording will be started. The recordings will be stored in the $audiofiles/Recordings, the filename contains date and time of the record start.

Using pHAT BEAT DAC from Pimoroni

By default the installer script activates GPIO buttons. This breaks the pHAT BEAT DAC because the DAC uses some GPIO pins which are also used by the default GPIO config. To use Pimoroni's pHAT BEAT DAC one has to disable the GPIO service:

sudo systemctl disable phoniebox-gpio-buttons

The GPIO service can also be disable via the settings tab on the Phoniebox web interface.

Use the Phoniebox in Mono not in Stereo

If you want to use your phonebox just with one loudspeaker you just need to edit the mpd.conf file. It is usually stored in /etc/. Edit the file via

sudo nano mpd.conf

Scroll down until you find the audio_output section

# An example of an ALSA output:
#
audio_output {
        type            "alsa"
        name            "My ALSA Device"
#       device          "hw:0,0"        # optional
#       mixer_type      "hardware"      # optional
#       mixer_device    "default"       # optional
        mixer_control   "Headphone"             # optional
#       mixer_index     "0"             # optional
}

add another line (within the curly brackets)

format		"*:*:1"

This sets the audio output format to just one channel (i.e. mono).

Shutdown button GPIO doesn't work

Taken from https://github.com/MiczFlor/RPi-Jukebox-RFID/issues/1015

Problem: Everything works fine for me except the shutdown button. If i press the button for 2 or more secondes nothing happens. If the system is turned off and i press the button, it starts fine. A linked RFID Tag with the shutdown command works fine. Only the Button for shutdown doesnt work.

Answer: I had the same problem with my box (RPi Zero, software version 2.0). All buttons worked fine, but the shutdown button didn't work. The buttons have a 1k resistor in series to GND. Measuring the voltage while pressing a button showed nearly 0V at the GPIO-pins except for the shutdown. The voltage remained above 1V when pressing the button. So i removed the resistor and connected direct to GND. Now the shutdown-button works fine.

Home

🔥 Version 3

Version 3 Pages

Nothing yet

🎶 Version 2

Version 2 Pages

Installation

Specials

RFID Reader

Sound card configurations

Hardware Buttons

Displays (LED, LCD, Matrix, etc.)

Hacks

Bluetooth

AirPlay

MPD tricks

For Developers

Clone this wiki locally