If you are building a Raspberry Project with screen there may be times you need to rotate the screen. This fairly easy to do in Raspbian.
Step 1 – Edit Config.txt
Start by editing the config.txt file :
sudo nano /boot/config.txt
Add one of the following lines to the bottom of the file :
display_rotate=0 display_rotate=1 display_rotate=2 display_rotate=3
0 is the normal configuration. 1 is 90 degrees. 2 is 180 degress. 3 is 270 degrees.
If you are using the Official Raspberry Pi touch screen you can use “lcd_rotate” rather than “display_rotate”.
Save the file by using CTRL-X, Y then ENTER.
Step 2 – Reboot
Then reboot using :
sudo reboot
When the Pi restarts the display should be rotated.
I used this technique in my Retro Arcade Table project where the monitor was mounted up-side-down in order to improve the viewing angle. The monitor looked much better when viewed from the top and being able to rotate the screen was a massive improvement.
12 Comments
Had the same isue with my arcade table, when you put the monitor up side down. the view angle is the same as you would stand in front of it, better contrast .
Thanks
Yes but if you have touch display, the touch events does not accept it
use lcd_rotate=2 instead
Thanks this solution worked on my official display. display_rotate did not work.
Thank you for your instructions!
The display also rotates correctly with “display_rotate = 3” because my screen hangs on the wall in portrait format
but the desktop is no longer displayed only “Welcom to the Raspberry Pi Dersktop”
What can I do?
Warning. The display_rotate doesn’t work with Raspberry Pi 4B.
Any way to dynamically rotate the display without a reboot?
I have rotated the screen using ‘display_rotate ‘ as my 7″ screen is unofficial. But now the touch axis is not working properly. please guide me on this issue.
There is a post on the Official Forum that explains how to rotate touch interface using “xinput”:
https://www.raspberrypi.org/forums/viewtopic.php?f=108&t=120793
short and precise instructions … as it should be, it works perfectly, thanks
For non official HDMI touchscreen (7″ 1024×600):
– Rotate display:
sudo nano /boot/config.txt
Add at the end:
hdmi_force_hotplug=1
hdmi_cvt 1024 600 60 3 0 0 0
hdmi_group=2
hdmi_mode=88
hdmi_drive=1
– Rotate touchscreen:
https://www.instructables.com/Rotate-Raspberry-Pi-Display-and-Touchscreen/
Edit cd /usr/share/X11/xorg.conf.d/40-libinput.conf (or similar file *libinput*)
Search the Section with one line called “libinput touchscreen catchall”
In this section add:
90° = Option “TransformationMatrix” “0 -1 1 1 0 0 0 0 1”
180° = Option “TransformationMatrix” “-1 0 1 0 -1 1 0 0 1”
270° = Option “TransformationMatrix” “0 1 0 -1 0 1 0 0 1”
thx bro you..