Like many things in the Raspberry Pi ecosystem, functions such as rotating the display output can be a little unintuitive at first.
Hi guys, my name is Sam from Core Electronics and today we're going to walk through how you can rotate the video output on your Raspberry Pi. Any model of Raspberry Pi and how you can get rid of that annoying black border that can sometimes be around your screen.
So if you're using a display, I've got the official Raspberry Pi 7 inch touchscreen display here along with the Pimoroni case which is incredibly popular, but with most of these cases and mounts for the screen it actually mounts the display upside-down and a lot of people get this and plug it in and say ah I must have done something wrong. They go and redo the steps and it can be frustrating but it's really really easy to just adjust this in software not an issue at all. So, we're going to take a look at how to do this I'm going to be doing it in the terminal interface because we need to edit the config.txt file, which can be found the boot directory. You can also just take your SD card out of your Pi, put it into a card reader on your computer and you can edit the file there but it's a little clunky it's not as easy and it's definitely a lot easier to just do it in the terminal.
So here goes, now to go into this let me just zoom in a bit, doesn’t seem to be working for me, give me a moment, I'll do this the clunky way by clicking a lot of times. All right there we go seems a reasonable size. So to get into the config text edit you might have done this before we want to write
sudo Nano /boot/config.txt
There's some directory navigation. We get taken to the config.txt file here. Make a bit bigger, so to rotate what we need to do is use a command called display_rotate or LCD_rotate, they're two different ones for two different cases. Now display_rotate simply rotates the whole output of the video display as you would expect however if you have a touchscreen all of the touch inputs will still be in their original orientation, which is an issue so if you're using a touch display you want to use LCD_rotate which also rotate the touch important function exactly like you would expect. So few differences there, but they're not too major. So, where we need to do is go to the bottom of your file, you can put it somewhere else it might make sense to put it with the rest of the display things here but down the bottom just make sure it's going to work exactly like you'd expect. So display rotate now we make this equal to either 0 1 2 or 3, 0 is no rotation, 1 rotates 90 degrees clockwise, 2 is 180 degrees and 3 is 270 degrees clockwise or in other words, you know it goes round you know right, down, left, up, there we go. So, if we put 0 no rotation, let's put 1 and to do this we need to save the file Ctrl + X then press Y and then enter, and we need to reboot for any of these changes to take effect because the config file is read upon boot it won't actually make any changes. Now we need to go to sudo reboot when there's reboot we'll see the whole display is actually rotated on its side and you'll notice in the editor that a lot of the ones will comment it out using hash symbols you might be familiar with this in the terminal or any but if you're not all that does is makes it a comment so instead of it being an actionable line of code the hash symbol just makes a plain text so you can describe and leave yourself notes and also it's a really good way of toggling features on and off without having to delete them and rewrite them every time this is kind of weird we're rotated here and you can see it is rotated. So, if you need to go back into the other because this is rather unusable by going into reboot because I can't go in with that so there you have it that's rotation and again LCD rotate if you're using a touch screen and display rotate if you're using a standard screen. Now you can also flip the screens very little use case I can see this, but the same way display rotates then we're using a hex number here so 0 X 1 followed by four 0's so 1 0 0 0 0. Right let's zoom in a bit sure why this doesn't save the zoom, it’s been a while since I've done Raspberry Pi. But I'll take a look at how to do that all right but we're here, so I went going to the flipping you can do that if you want. I've got some examples here in the tutorial if you scroll down. You can see what you need to do to flip it yeah.
But the other thing I said we were going to look at is how to remove that black border which is also the underscan. All right so we're rebooting here, all good that just did a bit I might have accidentally unplugged the power it's a little bit frustrating oh well everything is clean cut sometimes this is frustrating, the zoom and I'll make sure I'm a really good solution and work around for the next video the last thing is get rid of that over skin. Now we need to go into the config file again scroll down and you'll see a line called disabled_overscan equals it should be 1. I've altered it a little bit to make it exact as it needs to because this is an image I've used before. So disabled or underscore_equals 1. Now if we comment that out and reboot that's going to do exactly what we wanted to remove that border and then if you want to change it back to having that over scan you can either re comment out the line or change that one to a zero. But if we do that it's going to leave it here plenty of rebooting want everything to take effect and as soon as it reboots you'll see that there's no border at all and again really simple but a little unintuitive and then we have it Raspberry Pi rebooting exactly as you would expect and that is how you can easily adjust the display output settings for your Raspberry Pi. All you need to do is go into the terminal it's not scary it's really easy and if you have any questions or comments then, jump in start the conversation below I'd love to hear back from you and if there's anything else you would like us to cover in some future tutorials then be sure to get in touch that's all for today guys keep an eye on for some future tutorials and happy making.