Running Volumio 2 on a Raspberry Pi 2 model B with a 3.5" Touchscreen

I was pleasantly surprised with how well Volumio 2 runs out of the box on my old Raspberry Pi 2 model B using an external USB DAC (in my case, Behringer UCA222). As a next step, I wanted to add a small 3.5 inch display that connects to the 26 GPIO pins of my Pi 2 B.

The setup of the 3.5" LCD screen is a bit tougher than expected, but after a lot of googling and trial&error I got the LCD touchscreen fully working with Volumio 2. It seems like the same display is sold under different brands.

These are the steps to get the display working:
  • get Volumio running on your Raspberry Pi:
  • install and activate the Touch Plugin
    • 2019-02: the plugin install was stuck with an interactive keyboard choice. I ran the follwing commands on the raspberry pi (ssh volumio)
      sudo dpkg --configure -a
      sudo apt-get install -y xinit xorg openbox libexif12
    • try to remove / reinstall the plugin
  • connect to your Raspberry Pi CLI through ssh (username: volumio; password: volumio) and execute the following commands
    • download the display driver:
      git clone https://github.com/goodtft/LCD-show
    • run these few commands (handpicked from the LCD35-show script -- do NOT run the script!):
      cd LCD-show/
      sudo mkdir /etc/X11/xorg.conf.d
      sudo cp ./usr/tft35a-overlay.dtb /boot/overlays/
      sudo cp ./usr/tft35a-overlay.dtb /boot/overlays/tft35a.dtbo
      sudo cp -rf ./usr/99-calibration.conf-35  /etc/X11/xorg.conf.d/99-calibration.conf
      sudo mkdir -p /usr/share/X11/xorg.conf.d/
      sudo cp -rf ./usr/99-fbturbo.conf  /usr/share/X11/xorg.conf.d/
    • modify the 99-calibration.conf file and add the Driver "evdev" option
      • sudo nano /etc/X11/xorg.conf.d/99-calibration.conf
      • the file should be:
        Section "InputClass"
          Identifier "calibration"
          MatchProduct "ADS7846 Touchscreen"
          Option "Calibration" "3936 227 268 3880"
          Option "SwapAxes" "1"
          Driver "evdev"
      • save the file (Control-X)
    • modify the /boot/config.txt
      • sudo nano /boot/config.txt
      • add the last line:
        initramfs volumio.initrd
      • save the file (Control-X)
    • install missing packages:
      • sudo apt update
      • sudo apt install lightdm
      • sudo apt install xserver-xorg-input-evdev
After a reboot, everything works fine :). 

The final product is functional, but not perfect: the boot time takes a few minutes and chromium in kiosk mode is not very snappy. This might be a limitation of the older Raspberry Pi hardware. But as a simple display and for basic pause/play interaction, it works.

You can add some finetuning by preventing the "crashed tabs" dialog from chromium and by disable the sleep mode.

sudo nano /opt/volumiokiosk.sh
#prevent sleep (remove any other xset commands)
xset -dpms
xset s off

#prevent the 'crashed' dialog box: (keep each sed on 1 line)
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' /data/volumiokiosk/Default/Preferences
sed -i 's/"exit_type":"Crashed"/"exit_type":"None"/' /data/volumiokiosk/Default/Preferences

openbox-session &
while true; do
  /usr/bin/chromium-browser \
    --no-touch-pinch \
    --kiosk \
    --no-first-run \
    --disable-3d-apis \
    --disable-breakpad \
    --disable-crash-reporter \
    --disable-infobars \
    --disable-session-crashed-bubble \
    --disable-translate \
    --user-data-dir='/data/volumiokiosk'        --no-sandbox     http://localhost:3000

2019-03:  some additional tweaks.
  • Latest volumio versions have a bug which causes them to stop playing the songs on the queue. This is a fix:
    cd /volumio/app
    mv statemachine.js statemachine.orig
    wget https://github.com/michaelpeeters/Volumio2/raw/bugfix-playlist-stops/app/statemachine.js
    chmod +x statemachine.js
    sudo reboot

  • If you want to hide the mouse cursor:
sudo nano /lib/systemd/system/volumio-kiosk.service
ExecStart=/usr/bin/startx /etc/X11/Xsession /opt/volumiokiosk.sh -- -nocursor
  • hacking the css for a more compact layout for the 3,5" display (warning: layout on phones is a bit off)
cp /volumio/http/www/styles/app-*.css /volumio/http/www/styles/app-css.orig
sed -i "s/\(\#trackManager{.*\)top:50/\1top:85/g" /volumio/http/www/styles/app-*.css
sed -i "s/\.knobWrapper{position/@media \(max-width:767px\){.knobWrapper{zoom:.40;position:relative;width:210px;height:210px;margin:0 auto 15px}}.knobWrapper{position/g" /volumio/http/www/styles/app-*.css