Installing LMS and Squeezelite on DietPi (Raspberry Pi Streamer / Player Tutorial)

When playing with Raspberry Pi streamer with a wide screen, usually Volumio is the only option as Picoreplayer does not support it while Moode Audio UI does not fit it well. However although Volumio works fine with wide screen but some people still prefer LMS or MPD. In this article I will walk through the steps to install a LMS + Squeezelite with DietPi

DietPi is a lightweight OS based on Debian, while providing lots of nice features. For more details, please visit https://dietpi.com/.

1. Install DietPi
Download the image and flash it on the micro SD card, balenaEtcher is recommended.

2. Modify config.txt
Depending on the widescreen touchscreen you use, append the following to config.txt under root of the SD card:
hdmi_group=2
hdmi_mode=87
hdmi_timings=400 0 100 10 140 1280 10 20 20 2 0 0 0 60 0 43000000 3
hdmi_blanking=1
max_usb_current=1
display_rotate=3 #1:90;2: 180; 3: 270

3. Set up the home page of Chromium
Again depending on the widescreen touchscreen you use, change the Chromium resolution in diet.txt under root
SOFTWARE_CHROMIUM_RES_X=1280
SOFTWARE_CHROMIUM_RES_Y=400
SOFTWARE_CHROMIUM_AUTOSTART_URL=192.168.86.179:9000


Note: The URL is the internal IP of your Raspberry Pi, or if you have another device running LMS, replace this IP with that device's IP.

4. Insert the micro SD card into Rasbperry Pi and boot

5. SSH to DietPi
User: root
Password: dietpi

6. Install necessary software
type dietpi-software in the command console


Install LMS, Squeezelite and Chromium-browser. It may take >10mins depending on network speed. Take a coffee break and then return.

7. Configure touch (not required by DietPi)
If your touchscreen is portrait by default, you may need to rotate touch
First of all, input libinput (DietPi may have it installed by default)
sudo apt-get install xserver-xorg-input-libinput

create xorg.conf.d under /etc/X11 (folder may already exist)
sudo mkdir /etc/X11/xorg.conf.d

copy and edit 40-libinput-conf
sudo cp /usr/share/X11/xorg.conf.d/40-libinput.conf /etc/X11/xorg.conf.d/
sudo nano /etc/X11/xorg.conf.d/40-libinput.conf

Look for the touchscreen section, add the following script (this script can be found from Waveshare's wiki):
270 rotate: Option "CalibrationMatrix" "0 -1 1 1 0 0 0 0 1"

8. Install Asian fonts (optional)
sudo apt-get install fonts-wqy-zenhei

9. Set Chromium-browser as auto boot in dietpi-launcher
type dietpi-config in the command console


go to "AutoStart Options", select 11. Chromium as the auto start option

Chromium will start automatically upon next reboot

10. Comment out dtoverlay=vc4-kms-v3d (important)
After installing Chromium and reboot, the system will add dtoverlay=vc4-kms-v3d in config.txt, comment it out, otherwise the touchscreen will display in portrait mode.

11. Optimize Chromium
DietPi treats Raspberry Pi as a low performing device by default, comment out the original Chromium flags and add the following one:
sudo nano /etc/chromium.d/dietpi
comment out the original one and add
export CHROMIUM_FLAGS="$CHROMIUM_FLAGS --no-sandbox --use-gl=egl --enable-gpu-rasterization"

12. Config Squeezelite
After selecting the audio output in Audio settings, Squeezelite settings will be updated by DietPi automatically. If you want to change the name of Squeezelite or other settings, configurations are saved in the following location in the latest build:
Squeezelite default setting saved to /etc/default/squeezelite

13. Hide mouse cursor (optional)
Use the following command to hide mouse cursor. A reboot is required to take effect.
apt-get install unclutter-xfixes
echo '/usr/bin/unclutter-xfixes -display :0 -idle 1 &' > /etc/chromium.d/dietpi-unclutter-xfixes

14. Map network drive
Dietpi provides a convenient way to map network drive in Debian environment. Type dietpi-launcher in the command console, and select Drive Manager.


Follow the instructions and add your network drive

15. Restart your device to take effect
After the steps above, your raspberry should have everything ready. If required, restart your device to take effect. Your touch screen should be showing the user interface of LMS. Set up LMS according to your preference. Setting up LMS is not explained here as it's out of scope.

Comments

  1. you used a 1280x400 display could you share the link where to find it or the technical characteristics that will surely allow it to work?
    anyway go: great job!
    Thanks bye
    paolo.p

    ReplyDelete
    Replies
    1. Thanks.
      Technically, the resolutions should be 400 x 1280. More details of this touchscreen can be found here:

      https://www.waveshare.com/wiki/7.9inch_DSI_LCD

      Delete
    2. Found one on Amazon:

      https://www.amazon.com/-/zh_TW/dp/B09JMXXQ8V/ref=sr_1_1?crid=32ABOSN70HOWN&keywords=waveshare+7.9&qid=1675823693&sprefix=waveshare+7.9,aps,274&sr=8-1&language=en_US&currency=HKD

      Delete
  2. SMP Gadgets, have a problem with screen rotation. I got RPI4b+Waveshare 7.9 HDMI screen and DietPi OS. There is no posibility to rotate with display_rotate=3. Do you have solution for this problem?

    ReplyDelete
    Replies
    1. correction: display_hdmi_rotate=3 not working.

      Delete
    2. Hi, did you comment out dtoverlay=vc4-kms-v3d in config.txt?

      Delete
    3. Hi, I have no graphics on screen if I comment out dtoverlay=vc4-kms-v3d. Can't find why...

      Delete
  3. Hi smp gadgets can i use my tv screen to see and to set up this dietpi? I don't have waveshare yet. And i wanna buy 5-7inches touch screen.

    ReplyDelete
    Replies
    1. You don't even need a screen to setup DietPi. Just use your PC and configure it via SSH.

      Delete
    2. Sorry i don't have extra lan cable here and also my pc don't have wifi.

      I just want to experience this kind of player/streaming using my tv screen, i install dietpi Armv8 and flash it on my 2gb sd card using balena etcher. And plug in to my rpi4 b 2gb ram. And i also plug in my tv using hdmi.

      Delete
  4. Hi smp gadgets, how about i don't have touchscreen yet. Planning to buy 5inches soon. Should i still modify it in config.tx and even the chromium?

    ReplyDelete
    Replies
    1. Probably not. The parameters are device specific.

      Delete
  5. Hi smp i couldn't find in dietpi-software lms, squeezelite with chromiumbrowser.

    ReplyDelete
    Replies
    1. Try to type "dietpi-software" and search from there.

      Delete
  6. Hi smp!
    I'm having a hard time to setup this.
    First, i plug the sdcard on a sdcard reader then i format using sdcard formatter. Then, i flashed latest dietpi os on sandisk 32gb sd card using rufus.
    2nd,unplug then plug sdcard to rpi4b 2gb ram and boot.
    Open ssh to remote rpi
    User:root
    Pass:dietpi
    Modify parameters to ( /boot/dietpi.txt) since i couldn't access ( /boot/config.txt).
    I put parameters that i got on this (https://www.waveshare.com/wiki/7inch_HDMI_LCD_(B)),at the end of script.

    3rd, set up home page chronium
    SOFTWARE_CHROMIUM_RES_X=800
    SOFTWARE_CHROMIUM_RES_Y=480
    SOFTWARE_CHROMIUM_AUTOSTART_URL=(ip address of my rpi) :9000

    Then, at dietpi-software command console
    I install squeezelite, lms and chronium-browser.
    I take a long break.

    4rd, i skipped the touch configure.

    5th, install asian fonts. Done

    6th, Set Chromium-browser as auto boot in dietpi-launcher
    Select auto start option then select 11. Chronium-dedicated use without desktop
    Press ok
    No showing any result. So I'd unplug the adapter.
    Connect hdmi and usb display to rpi port.
    Open backlight switch.
    Then turn on the rpi.

    7th,after reboot. On a /boot/config.txt the dtoverlay=vc4-kms-v3d didn't showed up so i manually put and comment out.

    8th, Optimize Chromium (Done)

    9th, Config Squeezelite(done)

    10th, Hide mouse cursor (optional)(done).

    11th, Map network drive ( i skipped this coz i don't know how to set up this, even on a dietpi, forum it's says i need to plug the formatted flashdrive (ntfs or fat32)
    But no showing new mounted, drives
    . Network drive i really don't know how to set up that.

    Lastly, restart rpi. After boot there's only white screen and a cursor in a middle.
    That's all.


    Hope you understand me. Having a hard time to me to translate in English.

    Thanks.

    ReplyDelete
  7. If you have already gone through step 10, then there should not be a cursor in the middle of the screen. Probably something was wrong during the set up, the touchscreen configurations should be done in /boot/config.txt. In fact, you can edit config.txt directly using a SD card reader.

    ReplyDelete

Post a Comment

Popular posts from this blog

Installing Roon extension on DietPi

DIY Raspberry Pi 4 piCorePlayer Part I - Mechanical Design & Assembly