Configuring a 5″ Raspberry Pi Display

I received a 5″ 800×480 Raspberry Pi screen recently, and needed to get the screen and touch input working correctly. After some digging around I got everything working, here’s how I did it.

The screen is marked as “5inch HDMI Display, 800×480 Pixel, XPT2048 Touch Controller”, and doesn’t need any drivers to get it working, despite coming with a driver CD.

Insert the SD card from your Pi into your computer, and open the config.txt file, we’ll be making a couple of changes here.

Resolution and touch input

The Pi can’t auto-detect the screen resolution, so we’ll need to let it know how many pixels we have. Add the following lines to set the resolution.

hdmi_cvt=800 480 60 6 0 0 0

Now we need to tell the Pi that we have a touch screen connected, in the same file add the following lines


Save the file, and put the SD card back into the Pi. You’ll find the whole screen being used and the touch screen working… but the touch screen input is off by a bit, which we’re going to fix next.


We can install a calibrator by running this in the terminal

sudo apt-get install xinput-calibrator

Then you can run it by typing


It’ll get you to touch on four calibration points, after which your touch screen should work much more accurately.

To make this change permanent you’ll need to copy the output from the above command into a config file. It’ll look something like this:

Section "InputClass"
        Identifier "calibration"
        MatchProduct "ADS7846 Touchscreen"
        Option "Calibration" "159 3903 139 4046"
        Option "SwapAxes" "0"

Edit your config file with:

sudo nano /etc/X11/xorg.conf.d/99-calibration.conf

Paste the output into that file, save, and you’re done.


For some reason the above changes will modify some permissions, which means you will get a non working login screen at boot. To fix this press Ctr-Alt-F5 at the login screen to get the command line.

Login there with your username and password (default is pi and raspberry) then run the following command to fix the permissions.

chown pi:pi .Xauthority

Reboot, your next login should work as normal

Leave a Reply

Your email address will not be published. Required fields are marked *