Raspberry pi resistive touch screen

3.2inch RPi LCD (B)

3.2inch RPi LCD (B)
320 × 240

3.2 inch Resistive Touch Screen TFT LCD Designed for Raspberry Pi, Raspbian IMG Provided

Primary Attribute
Category:OLEDs / LCDs, Raspberry Pi LCD
<<>>: <<>>
Brand: Waveshare
International:3.2inch RPi LCD (B)
Chinese:3.2inch RPi LCD (B)
Onboard Interfaces
RPi I/Os
Related Products
  • 15.6inch HDMI LCD (H) (with case)
  • 15.6inch HDMI LCD (H)
  • 15.6inch FHD Monitor
  • 13.3inch HDMI LCD (H) (with case) V2
  • 13.3inch HDMI LCD (H) (with case)
  • 13.3inch HDMI LCD (H)
  • 13.3inch Magic Mirror
  • 13.3inch Magic Mirror C4
  • 13.3inch PiPad
  • 13.3inch PiPad C4
  • 12.5inch FHD Monitor
  • 11.6inch HDMI LCD (H) (with case)
  • 11.6inch HDMI LCD (H)
  • 11.9inch HDMI LCD
  • 10.5inch HDMI AMOLED
  • 10.1inch HDMI LCD
  • 10.1inch HDMI LCD (B) (with case)
  • 10.1inch HDMI LCD (E)
  • 10.1inch HDMI LCD (G) (with case)
  • 10.1inch HDMI LCD (H) (with case)
  • 10.1HP-CAPQLED
  • 9inch 2560×1600 Monitor
  • 8.8inch Side Monitor
  • 8inch DSI LCD
  • 8inch DSI LCD (with cam)
  • 7.9inch HDMI LCD
  • 7inch FHD Monitor
  • 7inch HDMI LCD (H) (with case)
  • 7inch HDMI LCD (C)
  • 7inch HDMI LCD (B)
  • 7inch HDMI LCD
  • 7inch DPI LCD
  • 7inch DSI LCD
  • 7inch DSI LCD (with cam)
  • 7inch DSI LCD (with case A)
  • 7inch DSI LCD (C)
  • 6inch HDMI AMOLED
  • 5inch HDMI LCD (H)
  • 5inch HDMI LCD (H) V4
  • 5inch HDMI LCD (G)
  • 5inch HDMI LCD (B)
  • 5inch HDMI LCD
  • 5inch HDMI AMOLED
  • 5inch DPI LCD
  • 5inch DSI LCD
  • 5.5inch HDMI AMOLED
  • 4inch HDMI LCD (C)
  • 4inch DSI LCD
  • 4.3inch HDMI LCD (B)
  • 4.3inch DSI LCD
  • 4inch DSI LCD
  • 4inch DPI LCD (B)
  • 4inch DPI LCD (C)
  • 4inch HDMI LCD (H)
  • 4inch HDMI LCD
  • 4inch RPi LCD (C)
  • 4inch RPi LCD (A)
  • 3.5inch DPI LCD
  • 3.5inch HDMI LCD
  • 3.5inch RPi LCD (C)
  • 3.5inch RPi LCD (B)
  • 3.5inch RPi LCD (A)
  • 3.2inch HDMI LCD (H)
  • 3.2inch RPi LCD (B)
  • 2.8inch HDMI LCD (H)
  • 2.8inch DPI LCD
  • 2.8inch RPi LCD (A)
  • 2.23inch OLED HAT
  • 1.3inch OLED HAT
  • 1.3inch LCD HAT
  • 1.44inch LCD HAT
  • 1.8inch LCD Module
  • EINK-DISP-103
  • LCD1602 RGB Module
  • Pico-Clock-Green
  • Pico-RGB-Matrix-P3-64×32
  • RGB-Matrix-P3-64×32




3.2 inch Resistive Touch Screen TFT LCD is designed for Raspberry Pi, and provides Raspbian IMG.


  • The hardware resolution is 320 × 240.
  • Resistive touch control.
  • It is compatible and can be directly inserted into any version of Raspberry Pi.
  • Drivers provided (works with your own Raspbian/Ubuntu/Kali and Retropie system directly).
  • Support FBCP software driver, can set the software resolution and dual-screen display.
  • Gold sinking process, fine carving.

Getting Started

Hardware Connection

  • There are 40 pins on Raspberry Pi, but there are 26 pins on the LCD, so you should pay attention to connecting the pins to your Pi accordingly.

Install the touch driver

The RPi LCD can be driven in two ways: Method 1. install driver to your Raspbian OS. Method 2. use the Ready-to-use image file of which LCD driver was pre-installed.

Method 1. Driver installation

Please download the latest version of the image on the Raspberry Pi official website. (Raspbian/Ubuntu Mate/Kali or Retropie)

1) Download the compressed image file to the PC, and unzip it to get the .img file.

2) Connect the TF card to the PC, open the Win32DiskImager software, select the system image downloaded in step 1 and click‘Write’ to write the system image. ( How to write an image to a micro SD card for your Pi? See RPi Image Installation Guides for more details)

3) Connect the TF card to the Raspberry Pi, start the Raspberry Pi. The LCD will display after booting up, and then log in to the Raspberry Pi terminal,(You may need to connect a keyboard and HDMI LCD to Pi for driver installing, or log in remotely with SSH)

4) Then open the terminal of Raspberry Pi to install the touch driver.

Note: The Raspberry Pi must be connected to the network, or else the touch driver won’t be successfully installed.

The touch function will work after restart. For ease of use, you can set the screen orientation, see: #Screen orientation settings.

  • 1. Executing apt-get upgrade will cause the LCD to fail to work properly. In this case, you need to edit the config.txt file in the SD card and delete this sentence: dtoverlay=ads7846.
  • 2. Using with Raspbian-lite, the command of the touch driver installation should be:

Method 2. Using Ready-to-use image

The image file with pre-installed driver is located in the IMAGE directory of the CD, or you can download it from #Image. Extract the .7z file and you will get an .img file. Write the image to your micro SD card (How to write an image to a micro SD card for your Pi? See RPi Image Installation Guides for more details). Then insert the card to your Pi, power up and enjoy it.

Screen orientation settings

After installing the touch driver, you can modify the screen rotation direction by running the following commands.

The rotation command under Raspbian-lite is as follows:

Touch screen calibration

This LCD can be calibrated through the xinput-calibrator program. Note: The Raspberry Pi must be connected to the network, or else the program won’t be successfully installed.

  • Run the following command to install:
  • Click the «Menu» button on the taskbar, choose «Preference» -> «Calibrate Touchscreen».
  • Finish the touch calibration following the prompts. Maybe rebooting is required to make calibration active.
  • You can create a 99-calibration.conf file to save the touch parameters (not necessary if file exists).
  • Save the touch parameters (may differ depending on LCD) to 99-calibration.conf, as shown in the picture:

Install Virtual Keyboard

1. Install matchbox-keyboard

2. Copy the statements below to toggle-matchbox-keyboard.sh and save.

3. Execute the commands:

4. Copy the statements to toggle-matchbox-keyboard.desktop and save.

5. Execute commands as below. Note that you need to use «Pi » user permission instead of root to execute this command

6. Find the statement which is similar to below: (It maybe different in different version)

7. Append these statements to add an button option:

8. Reboot your Raspberry Pi. If the virtual keyboard is installed correctly, you can find that there is a keyboard icon on the left of the bar


1, 17 3.3V Power positive (3.3V power input)
2, 4 5V Power positive (5V power input)
3, 5, 7, 8, 10, 22 NC NC
6, 9, 14, 20, 25 GND Ground
11 TP_IRQ Touch Panel interrupt, low level while the Touch Panel detects touching
12 KEY1 button
13 RST Reset
15 LCD_RS Command/data register selection,low level select command, high level select data.
16 KEY2 button
18 KEY3 button
19 LCD_SI / TP_SI LCD display/SPI data input of Touch Panel
21 TP_SO SPI data output of Touch Panel
23 LCD_SCK / TP_SCK LCD display/SPI clock of Touch Panel
24 LCD_CS LCD chip selection, low active
26 TP_CS Touch Panel chip selection, low active


User Manual


Description: if you felt hard to install driver, try the image with driver pre-installed.


Adafruit PiTFT 3.5″ Touch Screen for Raspberry Pi

Resistive Touchscreen Manual Install & Calibrate

New Subscription

Please sign in to subscribe to this guide.

You will be redirected back to this guide once you sign in, and can then subscribe to this guide.

Now that the screen is working nicely, we’ll take care of the touchscreen. There’s just a bit of calibration to do, but it isn’t hard at all.

Before we start, we’ll make a udev rule for the touchscreen. That’s because the eventX name of the device will change a lot and its annoying to figure out what its called depending on whether you have a keyboard or other mouse installed.

to create a new udev file and copy & paste the following line in:

Remove and re-install the touchscreen with

sudo rmmod stmpe_ts; sudo modprobe stmpe_ts

Then type ls -l /dev/input/touchscreen
It should point to eventX where X is some number, that number will be different on different setups since other keyboards/mice/USB devices will take up an event slot

There are some tools we can use to calibrate & debug the touchscreen. Install the «event test» and «touchscreen library» packages with

sudo apt-get install evtest tslib libts-bin

Now you can use some tools such as

which will let you see touchscreen events in real time, press on the touchscreen to see the reports.

If you rotate the display you need to recalibrate the touchscreen to work with the new screen orientation. You can manually run the calibration processes in the next section, or you can re-run the installer script and select a new rotation:

If the «automagic» calibration technique isn’t working for you, or you have some other setup where you need to carefully calibrate you can do it ‘manually’

You will want to calibrate the screen once but shouldn’t have to do it more than that. We’ll begin by calibrating on the command line by running

sudo TSLIB_FBDEVICE=/dev/fb1 TSLIB_TSDEVICE=/dev/input/touchscreen ts_calibrate

follow the directions on the screen, touching each point. Using a stylus is suggested so you get a precise touch. Don’t use something metal, plastic only!

Next you can run

sudo TSLIB_FBDEVICE=/dev/fb1 TSLIB_TSDEVICE=/dev/input/touchscreen ts_test

which will let you draw-test the touch screen. Go back and re-calibrate if you feel the screen isn’t precise enough!

You can also calibrate the X input system but you have to use a different program called xtcal (xinput_calibrator no longer works)

You can do this if the calibration on the screen isn’t to your liking or any time you change the rotate=XX module settings for the screen. Since the screen and touch driver are completely separated, the touchscreen doesn’t auto-rotate

Download and compile it with the following:

You must be running PIXEL (the GUI) while calibrating.

Before you start the calibrator you will need to ‘reset’ the old calibration data so run

DISPLAY=:0.0 xinput set-prop «stmpe-ts» ‘Coordinate Transformation Matrix’ 1 0 0 0 1 0 0 0 1

Now you’ll have to run the calibrator while also running X. You can do this by opening up the terminal program and running the the xtcal command (which is challenging to do on such a small screen) OR you can do what we do which is create an SSH/Terminal shell and then run the calibrator from the same shell, which requires the following command:

DISPLAY=:0.0 xtcal/xtcal -geometry 640×480

Note that the geometry may vary!

If you are using a 2.4″/2.8″/3.2″ 320×240 display with landscape orientation, use 640×480. If you’re in portrait, use 480×640.

If you are using a 3.5″ display with landscape, use 720×480, portrait is 480×720

Follow the directions on screen

Run sudo nano /usr/share/X11/xorg.conf.d/20-calibration.conf and copy the 9 numbers into the TransformationMatrix option so it looks like:

or whatever you got, into there.

You will want to reboot your Pi to verify you’re done

Your touchscreen is now super calibrated, hurrah!

This guide was first published on Sep 17, 2014. It was last updated on Sep 17, 2014.

This page (Resistive Touchscreen Manual Install & Calibrate) was last updated on Oct 06, 2022.