HMI
Rotating a Raspberry Pi 4 Touch Monitor

Walter Prechtl's picture
by Walter Prechtl last updated 21 November 2020

I recently had to develop an application (kiosk system) for/on a Raspberry Pi 4. The special thing about it was that 2 touch monitors were to be connected via HDMI, which also had to be rotated 90 degrees to the right. So, portrait mode, with 2 monitors on top of each other. Rotating the screen and arranging the monitors on top of one another did not cause any problems, since this is easily to do via the user interface – a "Raspbian Buster with desktop and recommended software" was installed. To do this, go to the menu "Raspberry -> Preferences -> Screen Configuration" and rotate the two HDMI monitors to the right, arrange them one above the other, and then save your settings. The problem with this is that the touch configuration is not automatically rotated and arranged one above the other, together providing a large touch area over 2 monitors. In order for the touch properties to work properly, 2 configuration files – /usr/share/X11/xorg.conf.d/40-libinput.conf and /home/pi/.profile – have to be adapted.

To do this, you first have to read the IDs of the connected monitors. To do this, open a terminal and enter the command

xinput list
. This will cause the connected monitors to be listed along with the associated IDs. In my case, the monitors had IDs 6 and 7.

Then, in the file /usr/share/X11/xorg.conf.d/40-libinput.conf, adapt the section "Section InputClass" with the "Identifier libinput touchpad catchall" as follows:

Section "InputClass" 
        Identifier "libinput touchpad catchall" 
        MatchIsTouchscreen "on" 
        Option "CalibrationMatrix" "0 1 0 -1 0 1 0 0 1" 
        MatchDevicePath "/dev/input/event*" 
        Driver "libinput" 
EndSection
This causes the touch surface to rotate.

Finally, at the end of the /home/pi/.profile file, insert the element that subdivides the touch surface into 2 parts of the same size, so that this is loaded each time the system is started.

xinput set-prop "6" --type=float "Coordinate Transformation Matrix" 1 0 0 0 0.5 0 0 0 1
xinput set-prop "7" --type=float "Coordinate Transformation Matrix" 1 0 0 0 0.5 0.5 0 0 1

You might also be interested in:

  • Qt on the Raspberry Pi 4
  • Configure Qt-Creator on Ubuntu 20 LTS for Cross-Compiling
  • Install Raspberry Pi OS on Raspberry Compute Module 4
  • Products
    • Embedded HMI
    • Industrial Monitors
    • PCAP touch screen
    • Impactinator® glass
  • Design
  • Development
  • Manufacturing
  • Industries
embedded hmi HMI

embedded hmi

Professional solutions
We develop and produce high-quality professional embedded HMI systems for demanding customers and applications.
More information

Start your Project now

Our mission

We are specialists for customised embedded HMI solutions. We see ourselves as a system supplier and offer our customers individual, innovative and cost-optimised control units.

Blog

Click here for the blog

Haven't found the right thing yet?

Use the search function to conveniently search our website for your topic.
More than 5000 pages of specialist knowledge are waiting for you.

Imprint

  • Choose other language:
  • de
  • dk
  • en
  • fr
  • fi
  • nl
  • no
  • it
  • ru
  • pl
  • br
  • es
  • se
  • tr