Skip to main content

Working with Raspberry Pi

Hardware Connection​

  1. Connect the 12V 2A power adapter to the DC power interface of the screen

  2. Connect the Touch interface to the USB port on the Raspberry Pi

  3. Connect the HDMI interface to the HDMI port on the Raspberry Pi

    18

Software Setup​

For Raspberry Pi OS / Ubuntu / Kali and Retropie systems on the Raspberry Pi.

  1. Connect the TF card to the PC, download and use Raspberry Pi Imager to flash the corresponding system image.

    800x480-DSI-LCD-0

  2. After the image flashing is completed, open the config.txt file in the root directory of the TF card, add the following code to the end of the config.txt file, save and safely eject the TF card.

    hdmi_group=2
    hdmi_mode=82
    hdmi_cvt 1920 1080 60 6 0 0 0
  3. Insert the TF card into the Raspberry Pi and power it on. After waiting a few seconds, the display will appear, and touch will work normally after the system boots.

Display Rotation​

Bookworm System​

GUI Interface Rotation​

  1. Open the "Screen Configuration" application

    DSI-LCD-Bookworm-Rotate-01

  2. Click through the menus "Screen"->"HDMI-A-1"->"Touchscreen" in order, and check "Waveshare Waveshare"

    7

  3. Go to "Screen"->"HDMI-A-1"->"Orientation" in order, select the desired rotation direction, and click Apply to apply the settings. This completes synchronized rotation of both display and touch directions.

    7

tip

Only the Bookworm system supports this method for synchronized "display + touch" rotation. Bullseye and earlier versions require setting display and touch rotation separately.

Lite Version Display Rotation (No Desktop Environment)​

Edit the startup command line file:

sudo nano /boot/firmware/cmdline.txt

Add the following parameters at the beginning of the cmdline.txt file (change to the actual screen resolution):

video=HDMI-A-1:400x1280M@60,rotate=90

Replaced with:

  • rotate=90: Rotate 90° clockwise
  • rotate=180: Rotate 180°
  • rotate=270: Rotate 90° counterclockwise
tip

HDMI shares rotation settings with other interfaces (such as DPI and DSI) and cannot be set separately.

Bullseye/Buster System​

GUI Interface Rotation​

  1. Open the "Screen Configuration" application

    DSI-LCD-Bullseye-Rotate-02

  2. Click through the menus "Screen"->"HDMI-A-1"->"Orientation" in order, select the desired rotation angle, and click Apply to apply the settings.

    DSI-LCD-Bullseye-Rotate-03

Lite Version Display Rotation​

  1. You need to modify the /boot/cmdline.txt file:

    sudo nano /boot/cmdline.txt
  2. Add the following parameters at the beginning of the cmdline.txt file (change to the actual screen resolution):

    video=HDMI-A-1:400x1280M@60,rotate=90

    Replaced with:

    • rotate=90: Rotate 90° clockwise
    • rotate=180: Rotate 180°
    • rotate=270: Rotate 90° counterclockwise
    note

    HDMI shares rotation settings with other interfaces (such as DPI and DSI) and cannot be set separately.

  3. Save and restart

    sudo reboot

Stretch/Jessie System​

For older systems (not using the vc4-kms-v3d or vc4-fkms-v3d driver), set as follows:

  1. Edit the config.txt file:

    sudo nano /boot/config.txt
  2. Add the statement at the end of the file:

    display_rotate=1 #1: 90; 2: 180; 3: 270
  3. Save and reboot the Raspberry Pi

    sudo reboot

Touchscreen Rotation Settings​

Some screens can be rotated by holding down the Rotate Touch button on the back to switch the touch direction. Each hold switches the direction once.

7

Bookworm System (Command Line Method)​

If you use the graphical interface for rotation, you can check "Touchscreen" in the screen layout editor window to synchronize touch rotation. For screen rotation methods, please refer to the previous introduction. For command line rotation methods, please refer to the following text:

  1. Create a udev rules file:

    sudo nano /etc/udev/rules.d/99-waveshare-touch.rules
  2. Add the content corresponding to the desired rotation angle (uncomment as needed):

    #90°:
    ENV{ID_INPUT_TOUCHSCREEN}=="1", ENV{LIBINPUT_CALIBRATION_MATRIX}="0 -1 1 1 0 0"

    #180°:
    #ENV{ID_INPUT_TOUCHSCREEN}=="1", ENV{LIBINPUT_CALIBRATION_MATRIX}="-1 0 1 0 -1 1"

    #270°:
    #ENV{ID_INPUT_TOUCHSCREEN}=="1", ENV{LIBINPUT_CALIBRATION_MATRIX}="0 1 0 -1 0 1"
  3. Save and reboot

    sudo reboot

Bullseye/Buster System​

  1. Install libinput

    sudo apt-get install xserver-xorg-input-libinput
    • If you are using Ubuntu or Jetson Nano, the installation command is:

      sudo apt install xserver-xorg-input-synaptics
  2. Create the xorg.conf.d directory under /etc/X11/ (if the directory already exists, proceed directly to step 3)

    sudo mkdir /etc/X11/xorg.conf.d
  3. Copy the 40-libinput-conf file to the directory just created

    sudo cp /usr/share/X11/xorg.conf.d/40-libinput.conf /etc/X11/xorg.conf.d/
  4. Edit this file

    sudo nano /etc/X11/xorg.conf.d/40-libinput.conf
    #Find the touchscreen section, add the corresponding rotation angle command inside it, and save
    #90° Right touch rotation:
    Option "CalibrationMatrix" "0 1 0 -1 0 1 0 0 1"
    #180° Inverted touch rotation:
    #Option "CalibrationMatrix" "-1 0 1 0 -1 1 0 0 1"
    #270° Left touch rotation:
    #Option "CalibrationMatrix" "0 -1 1 1 0 0 0 0 1"

    Similar to the location shown below:

    Touch rotate

  5. Reboot the Raspberry Pi

    sudo reboot

After completing the above steps, the touch input will be rotated.

Using the Touchscreen Virtual Keyboard​

Starting from Raspberry Pi OS Bookworm, the system integrates the Squeekboard on-screen keyboard by default. When a touch display is connected, the on-screen keyboard will automatically appear when text input is possible; it will automatically hide when text input is not possible. For applications that do not support automatic text input detection, you can use the keyboard icon on the far right of the taskbar to manually show or hide the on-screen keyboard.

DSI-Touch-Bookworm-Keyboard-01

You can also set the on-screen keyboard to show or hide through the "Display" option tab in "Raspberry Pi Configuration", or through the "Display" section in raspi-config.

DSI-Touch-Bookworm-Keyboard-02

tip

In versions of Raspberry Pi OS prior to Bookworm, use matchbox-keyboard. If using the wayfire compositor, use wvkbd.

Touch Mode Selection​

The Bookworm system supports two touch modes, which can be switched in the Screen Configuration -> Touchscreen menu:

DSI-Touch-Bookworm-Keyboard-03

  1. Mouse Emulation (default)

    • Click = Left mouse button function
    • Long press = Right mouse button function
    • Supports double-click
    • Does not support page sliding and multi-touch functions
    note

    This mode is suitable for scenarios requiring mouse operations, such as double-clicking to open the file manager or long-pressing for the right-click function.

  2. Multitouch

    • Supports multi-touch
    • Supports page swiping
    • Does not support double-click and long-press right-click functions
    note

    This mode is suitable for touch-optimized scenarios, such as web browsing and scrolling through lists.