2018/03/11

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
  • 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" "56 4019 3893 120"
          Option "SwapAxes" "1"
          Driver "evdev"
        EndSection
      • 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
#!/bin/bash
#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
done


References: