lamatas
Posts: 2
Joined: Sat May 09, 2020 9:58 am

My experience building and using a RPi4-based mini-desktop and standing tablet

Sat May 09, 2020 2:28 pm

Hi there,

The goal of this topic is to summarize the steps I followed to build a mini-desktop and standing tablet using a Raspberry pi 4. I intend to use it to watch movies, listen to music and perform usual desktop work. So far the device is usable, but requires a few configuration steps. Yet some minor issues are still present, these will be explained in each subsection.
I hope this serves as a useful guide for anyone pursuing the same goal. I am an absolute beginner in the world of Raspberry Pi and Linux, so any advice and criticism is welcome.


Materials:
  • Mini SD card containing NOOBS (included in the kit).
  • Official Raspberry Pi USB-C power supply (also included in the kit).
  • Official Raspberry Pi 7" Touchscreen (v1.1)
  • OS: Raspbian 10 (Buster) installed via NOOBS.
  • Rii K12+ SLIM mini-wireless keyboard with touchpad from Rii . Note that any standard USB keyboard and mouse should work out of the box.
Assembly:
  1. The assembly of the Raspi, the touchscreen and the case was done following the Smartipi case instructions. Then connected the keyboard's receptor and the power supply.
    The fan was wired to run at low speed, this produces some minimal audible noise, but I do not feel it is a major issue. Did not wire it to full speed to compare the noise.
Hardware and OS setup:
  1. After plugging the power supply, the Touchscreen worked out of the box, NOOBS booted, configured the WiFi network access and Raspbian was installed without issue.
  2. After installing Raspbian, I updated, upgraded and restarted Raspbian as indicated in the SmartiPi setup instructions:

    Code: Select all

    sudo apt update
    
    sudo apt full-upgrade
    
    sudo shutdown -r now
  3. USB speakers: Despite other circulating claims, they did not work out of the box in my case. I had to install the ALSA software loaders for specific hardware (package name: alsa-firmware-loaders). This package is available in the official Raspbian repositories.
    speakers-reduced.jpg
    speakers-reduced.jpg (38.5 KiB) Viewed 907 times
    After connecting the Speakers, the device was detected and selected as default sound output (see above)
    Sound was tested successfully:
    To test sound, run:

    Code: Select all

    $ speaker-test
    Playing music files with VLC also worked straightaway.
  4. USB microphone: The microphone was detected right after plugging it, no configuration was needed. It appeared under the volume control and was selected as default sound input device (insert image).
    microphone-reduced.jpg
    microphone-reduced.jpg (39.37 KiB) Viewed 907 times
    It is recommended to increase the recording volume to the max, as the microphone's holes are facing the rear of the tablet. To test it, the step 6 from this tutorial was followed:
    To test sound recording, run:

    Code: Select all

    $ arecord --format=S16_LE --duration=5 --rate=16000 --file-type=raw out.raw
    Then play the recorded file with:

    Code: Select all

    $ aplay --format=S16_LE --rate=16000 out.raw
  5. Touchscreen: The touch screen works, but no right click function is provided out of the box. In order to enable right click (long touch with one finger) I followed this MeneerJansen user tutorial. The .cpp file and instructions to compile are available in his Github page.
    In order to compile the file, first make sura that the package "libxext-dev" is installed, otherwise the compilation can not work. To install it run:

    Code: Select all

    $ sudo apt-get install libxext-dev
    Then compile the .cpp file from the GitHub tutorial
    Depending on the size of your fingers, some users may require to modify the timing settings in the .cpp file. I have small hands, so the default values worked for me.

    Touchscreen Connectivity: The touchscreen can be successfully connected to a LCD TV via a mini-HDMI to HDMI cable. The LCD TV was recognised by Raspbian, and appeared in Menu > Preferences > Screen Configuration. In order to keep the mouse pointer back within the touchscreen limits once the external TV/monitor is not used, it is advised to overlap both screens in the Screen Configuration program.
    screesnconfig-overlap-reduced.jpg
    screesnconfig-overlap-reduced.jpg (35.36 KiB) Viewed 907 times
    The HDMI display resolution and refresh can be modified under Menu > Preferences > Display Settings ; just try the different values and choose the one that suits best with your TV.

    Touchscreen brightness: By default, the brightness is set to the max, which can be annoying when using the device for long periods. In order to control the screen's brightness, I used rpi-backlight by user linusg. Also included a button in the taskbar to control the brightness using the GUI, using the panel settings.
    Note that, when the GUI provided by rpi-backlight is set to 0, the screen becomes completely dark. If the focus on the GUI window is lost it is then impossible to increase back the brightness. TO prevent this, I simply set the minimum brightness value to 10 instead of 0 in the GUI file:
    In the file /.local/lib/python3.7/site-packages/rpi_backlight/gui.py , search the line that says:

    Code: Select all

    adjustment=Gtk.Adjustment(
                value=backlight.brightness, lower=0, upper=100, step_increment=1
    
    And change the values to:

    Code: Select all

    adjustment=Gtk.Adjustment(
                value=backlight.brightness, lower=10, upper=100, step_increment=10
    
    Now the screen brightness can be modified by tapping, and without risk of turning it black irreversibly.



    At this point a mouse is no longer necessary to operate the device. Still, the keyboard is still required to introduce text. To solve this, I installed Florence on board keyboard , which is available in the Raspian repositories. I followed the instructions from this post .
    First, installed the package required to fix the crash issue:

    Code: Select all

    $ sudo apt-get install at-spi2-core
    then installed Florence:

    Code: Select all

    $ sudo apt-get install florence
    Run Florence and open "Preferences". Apply the following changes:
    • Select "Mouse" as input mode in the "behaviour" tab. Check the three boxes in the "Auto hide" section.
    • Uncheck the box "Decorated" in the "window" tab. It is recommended to enable the "floating button" option as well, this prevents the keyboard from becoming non accessible when fullscreen mode is used in some apps.
    The keyboard can be positioned at the base of the screen, it can also resized to the full display width for convenience. It is also recommended to add a button in the panel and enable the system tray icon.
Note that some of the aforementioned menus under "Preferences" may be missing by default. To enable them, go to Menu > Preferences > Main menu editor.

Will keep posting any progress based on your suggestions and experimentation. Hope this post is useful for anyone aiming to build the same, or a similar setting.

Cheers
Last edited by lamatas on Tue May 12, 2020 3:20 pm, edited 1 time in total.

lamatas
Posts: 2
Joined: Sat May 09, 2020 9:58 am

Re: My experience building and using a RPi4-based mini-desktop and standing tablet

Mon May 11, 2020 5:45 pm

Hi everyone,

After testing the system for a couple of days I made some changes.
  1. Dropped Florence virtual keyboard and favoured xvkbd:
    raspi-xvkbd.png
    raspi-xvkbd.png (176.41 KiB) Viewed 883 times
    As explained in this post, the Alt key gets stuck after tapping it and can't be released. This is a major issue that renders the device dependant form a keyboard.
    xvkbd serves the purpose, as it is clear, simple and does the job much better. I followed this post from Bunsenlabs to create a script in order to toggle the keyboard by tapping an icon in the panel.

    Here is the program code:
    First create the file:

    Code: Select all

     $ nano keyboard-toggle
    Copy these lines in the file, save and make executable.

    Code: Select all

    #!/bin/sh
    pidof xvkbd && killall xvkbd || xvkbd -no-keypad -geometry 600x250-100-30 &
    exit] 
    move to yourhomefolder/.local/bin

    Go to Menu>Preferences>Menu Editor.
    Create a new launcher inside the "Accessories" category. In my case I assigned an random keyboard icon from /usr/share/icons.
    raspi-xvkbd-launcher.png
    raspi-xvkbd-launcher.png (143.83 KiB) Viewed 883 times
    Note that I included the options -no-keypad -geometry 600x250-100-30 in the script. After trying different options I finally used these (see xvkbd help). IMHO, they suit best with the desktop size. Using a keypad reduces the size of the available space for the keyboard, and the window position and size are, in my opinion, ideal for the 7" Touchscreen.
  2. Added Netflix compatibility: A version of Chromium pre-compiled with WideVine is required to play Netflix and other online video services. I followed this tutorial from Vpektov.net.
    It essentially install a separate Chromium called "Chromium Media Edition", which plays Netflix flawlessly.
    raspi-netflix.jpg
    raspi-netflix.jpg (125.87 KiB) Viewed 883 times
    I also created an icon for it in the panel using the Panel Settings. The icon used can be found [ulr=https://de.wikipedia.org/wiki/Datei:Netflix_icon.svg] here [/url]
So far, this is my progress building this device, will keep you updated of any change I do in the system.

Cheers

Return to “Beginners”