Rotating a Raspberry Pi Touch Screen
The Raspberry Pi touch screens works great, but they can have a small issue when used with a several screen enclosures.
The cases often require the screen to be mounted in a specific orientation such as for wall mounting, but this can easily be remedied as follows.
First, make sure you have a working Pi install, the solution below should be agnostic of linux distribution used.
Next, open a terminal and edit the file
/boot/config.txt, this is owned by root so you'll need to use the command:
sudo nano /boot/config.txt
You can use an editor other than
nano if you want, but this is installed by default on the Raspberry Pi OS.
The screen can be rotated in increments of 90 degrees using a number as follows:
- 0 = No rotation
- 1 = Screen rotated 90 degrees
- 2 = Screen rotated 180 degrees
- 3 = Screen rotated 270 degrees
If you have an official Raspberry Pi touch screen you will need to use the
As otherwise, the display will rotate but not the touch screen which will cause taps to be detected on the
wrong part of the screen!
For other touch screen brands, the command
display_rotate should be used.
Here are some examples:
Rotate the official touch screen 180 degrees:
Rotate other touch screens 180 degrees:
Once you have specified the correct rotation command then save the file by pressing ctrl X, Y then enter.
Finally reboot the Pi, from the command this can be done by the following command:
sudo shutdown -r now
The screen will now rotate during boot up.
Last updated: 06/03/2021