Raspberry Pi

How to Rotate Screen in Raspberry Pi?

So, you just finished setting up your Raspberry Pi board and started performing different operations with it. Many projects in Raspberry will want you to rotate the display out of raspberry pi. The normal use cases are using monitors vertically or the display upside down, which gets more often when using the Raspberry Pi touchscreen.You can rotate the screen In Raspberry from desktop and terminal by 90, 180, and 270 degrees. Rotating display in Raspberry pi involves a few steps, including editing the config file, setting up the display, etc.

Today, this article will be learning different steps for rotating screens in different Raspberry Pi models. Let’s start:

How To Rotate Screen in Raspberry Pi?

Now, we will be proceeding further to rotate your Pi’s display. Do note that you have checked all these below-mentioned requirements.

  • A stable internet connection
  • Raspberry Pi
  • An SD card
  • Un-interrupted power supply

Rotate Screen In Raspberry Pi From Desktop

To begin with, you will require to set up a display configuration tool on your Pi. Head to your Pi desktop and click on the Pin icon on the top left of the display. Hover on the preferences option and click on “Screen configuration”. Select the display you wish to rotate. Hover over orientation and choose the way you want to modify your Display. Click on the Ok button to confirm and wait for 10 seconds till the timer ends.

Rotate Screen In Raspberry Pi(Pi 3 and Previous) Using Terminal

The method mentioned above-using desktop might not work for you if you have enabled 3d drivers. I have got you covered; you can try modifying your display from the terminal.

In the terminal method, you first need to edit the boot/config.txt file. This can be done using your SD card or directly from the terminal.

For SD Card: Insert your SD card and open the boot/config.txt file in a text editor. You can use notepad or Sublime text.

For Terminal: Open Command prompt on your windows or terminal in MAC. Connect your Pi using SSH.

To edit the file, execute the command sudo nano /boot/config.txt

Now you can proceed to rotate your display. Different numbers represent the different rotations supported by Raspberry Pi.

  • 1 for 90 degrees
  • 2 for 180 degrees
  • 3 for 270 degrees

For rotating your Raspberry Pi’s display, you can enter any of the following commands.

display_lcd_rotate

display_hdmi_rotate

To rotate your Raspberry Pi’s Display by 90 degrees, you can enter the command display_lcd_rotate=1. Similarly, you can change the number for different outcomes. For resetting your display, use the same command replacing the number to 0.

Once you have rotated the screen, press Ctrl+X then Y, followed by the Enter key to save the file. To work on the new rotated display settings, you will have to restart your Raspberry Pi. Give the command sudo reboot.

Rotate Raspberry Pi Display In Raspberry Pi 4

Raspberry Pi 4 now comes with an updated video driver, due to which you won’t be able to rotate the screen using the boot config method.

You can use the screen configuration tool for rotating the display in RPi 4. That is quite simple than the other method using the command xrandr.

Launch the terminal and execute the command according to the rotation you want.

DISPLAY=:0 xrandr --output HDMI-1 --rotate right

DISPLAY=:0 xrandr --output HDMI-1 --rotate left

DISPLAY=:0 xrandr --output HDMI-1 --rotate inverted

To reset rotation back to normal, use the command

DISPLAY=:0 xrandr --output HDMI-1 --rotate normal

These were methods to rotate screens in Raspberry Pi boards casually. At the same time, some projects require touch and display to be rotated individually. So you have to synchronize the touch and display of your Raspberry Pi.

Rotating Touch On Raspberry Pi Touchscreen Display

You need to add one more line in your boot/config file. Here are commands you can execute according to the rotations.

  • Rotate Screen 90 degrees left – xinput set-prop ‘raspberrypi-ts’ ‘Coordinate Transformation Matrix’ 0 -1 1 1 0 0 0 0 1
  • Rotate Screen 180 degrees – xinput set-prop ‘raspberrypi-ts’ ‘Coordinate Transformation Matrix’ -1 0 1 0 -1 1 0 0 1
  • Rotate Screen 90 degrees right – xinput set-prop ‘raspberrypi-ts’ ‘Coordinate Transformation Matrix’ 0 1 0 -1 0 1 0 0 1
  • Return Screen upright – xinput set-prop ‘raspberrypi-ts’ ‘Coordinate Transformation Matrix’ 1 0 0 0 1 0 0 0 1

Yes, You can use the official raspberry touch screen with the RPi 4 board. For using Raspberry touchscreen and Pi 4 together, you need to a plugin power supply to Pi4 and use jumper wires from GPIO pins to send a charge to the display.

How to Fix Verticle Lines Issue On Official Raspberry Touchscreen Display?

This issue is not so common, but some users have reported it. Here are some fixes that you can apply.

Loose wiring can be the prime reason behind this. Turn off your Raspberry Pi and try re-fitting the ribbon cable to your DSI connector.

Use official RPi power supply cable for touchscreen. Avoid low-power power supplies.

The official display doesn’t support custom operating systems. Always use Raspberry Pi OS, and also, make sure your Raspberry Pi os is fully updated.

To update your RPi OS, launch the terminal window and execute the following command.

sudo apt-get update

sudo apt full-upgrade

The Final Words

These were some working methods to rotate your Raspberry output display to different angles. There are different methods and commands for respective models of Raspberry Pi.

I suggest you use the screen resolution tool to rotate your Raspberry Screen as it is quite simple like you do on mobile. You can read the first method again to know more about same.

About the author

Shubham Yadav

Shubham is a mechanical engineer by profession. Computer geek at heart he loves to explore new aspects of circuits, motherboards and general PC components.