Home Interests Raspberry Pi

How to Rotate Raspberry Pi Screen or Display (and Touchscreen) Output

Screen upside down? No problem.
howchoo   (467)
August 14, 2023
7 minutes

Share

You'll Need 1

What you'll need
Interests
Howchoo is reader-supported. As an Amazon Associate, we may earn a small affiliate commission at no cost to you when you buy through our links.
Posted in these interests:
pi • 92 guides

So you’ve just finished setting up your Raspberry Pi touchscreen, and it’s upside-down. This guide will show you how to rotate or flip your Raspberry Pi’s display and touchscreen output between landscape and portrait modes. This is useful if you want to display your Raspberry Pi screen output in portrait mode or if your screen is upside down!

This guide will also show you how to flip your screen (as if you’re looking at it in a mirror), which is an odd request but might be necessary for some projects.

This should work for any display or touchscreen you might be using, including those on our list of the best touchscreens for the Raspberry Pi. If you need to know what resolution your Pi is outputting, check out this guide to look up your Raspberry Pi display resolution.

1 – Edit boot/config.txt

There are two methods for editing the boot/config.txt file required to change screen rotation:

SD card method

Put your Pi’s SD card in your computer and open the /boot/config.txt file in a plain-text editor such as Notepad or Sublime Text.

Connect remotely

From your computer, open Terminal (Mac) or Command Prompt (Windows) and connect to your Raspberry Pi via SSH.

How to Connect to a Raspberry Pi Remotely via SSH
The preferred (and most common) method of connecting to your Pi to run commands.

Then, run the following command to edit the file:

sudo nano /boot/config.txt

2 – Rotate the Raspberry Pi display

If you’re using a touchscreen, skip this step.

If you have a value for dtoverlay that contains the rotate=90 command, change that value to your desired rotation:

dtoverlay=pitft35-resistive,rotate=90,speed=20000000,fps=20

Note: The dtoverlay value likely won’t be the same as the lcd_rotate value. For example, the default “normal” screen rotation would be rotate=90lcd_rotate=0. Therefore, you may need to test multiple configurations.

If you have no dtoverlay “rotate” value, insert one of the following values instead:

display_rotate=0 # Normal (landscape)
display_rotate=1 # 90 degrees (portrait, upside down)
display_rotate=2 # 180 degrees (landscape)
display_rotate=3 # 270 degrees (portrait, upside down)
display_rotate=0x10000 # horizontal flip
display_rotate=0x20000 # vertical flip
🛈 If a value is already set for display_rotate (WITHOUT a # before it), you can edit that value instead.

3 – Rotate the Raspberry Pi touchscreen

If you’re using a touchscreen, you’ll also need to adjust touchscreen rotation. Otherwise, your taps will all be on the wrong part of the screen! This will adjust both display and touchscreen rotation.

Insert one of the following values at the end of the file:

lcd_rotate=0 # default (normal landscape)
lcd_rotate=1 # 90 degrees (portrait, upside down)
lcd_rotate=2 # 180 degrees (landscape)
lcd_rotate=3 # 270 degrees (portrait, upside down)

4 – Restart your Pi

Restart your Pi for things to take effect:

sudo reboot
NEXT UP

How to Run a Minecraft Server on the Raspberry Pi

A whole world trapped inside your Pi.
howchoo   (467)
December 7, 2023

There are several ways to go about running a Minecraft server on the Raspberry Pi. In this guide, I’ll cover how to install Nukkit—a cross-platform Minecraft server that’s super easy to set up on the Raspberry Pi. This server should work with PCs, consoles, and tablets running Minecraft 1.14. I’ll be using a Raspberry Pi

Continue Reading

howchoo

 467 guides

Introducing Howchoo, an enigmatic author whose unique pen name reflects their boundless curiosity and limitless creativity. Mysterious and multifaceted, Howchoo has emerged as a captivating storyteller, leaving readers mesmerized by the uncharted realms they craft with their words. With an insatiable appetite for knowledge and a love for exploration, Howchoo's writing transcends conventional genres, blurring the lines between fantasy, science fiction, and the surreal. Their narratives are a kaleidoscope of ideas, weaving together intricate plots, unforgettable characters, and thought-provoking themes that challenge the boundaries of imagination.

Discover interesting things!

Explore Howchoo's most popular interests.

Explore