5″ touchscreen for a Raspberry Pi

Recently bought a Generic 5″ touchscreen from AliExpress.

Model number ZC37200

resolution 800×480

XPT2046 touch controller.

Excellent quality, but getting it working was a bit of a trial.

Many of the tutorials out there are misleading, outdated, or just plain wrong.

This is what I did:

 

First (easy part), connect it all up, and install Raspbian from NOOBS 1.8.

Either open a terminal or from another PC:

ssh pi@<IP address of your pi>

First the easy part, we get the screen working with a full display.

Because these small screens will only display at native resolution, you may get a partial screen display, or a distorted one.

You need to force native resolution, in the case of the 5” display, that is 800×480.

edit /boot/config.txt

sudo nano /boot/config.txt

edit these lines as follows:

# uncomment if hdmi display is not detected and composite is being output
hdmi_force_hotplug=1
# uncomment to force a specific HDMI mode (here we are forcing 800x480)
hdmi_group=2
hdmi_mode=1
hdmi_mode=87
hdmi_cvt 800 480 60 6 0 0 0

The next step is to enable the touchscreen.

In the same file, remove the # from this line:

dtparam=spi=on

and add this line:

dtoverlay=ads7846,penirq=25,speed=10000,penirq_pull=2,xohms=150

save and reboot, everything worked!

Next we need to calibrate it, but I need more time to work that one out, will post in the next few days.

 

 

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s