In this article, we will show you step by step how to calibrate the touchscreen pointer of a Raspberry Pi display for better touch precision.
Welcome back again to another article on Raspberry-pi. In this article, we will show you how to calibrate the touchscreen pointer for better touch precision. I have heard many people having such issues that the touchscreen display is not accurately pointing, so if you’re having such an issue, I request you to check this article till the end.
We recommend you set up your display properly before starting with this calibration setup. So let’s get started.
First, let’s start with the calibration step of touch control. This will make the pointer much more accurate and easier to use. We will go step by step.
Step 1: This process needs to be done using superuser (root) privileges. Enter
sudo su at the command prompt to enter root mode:
Step 2: Now we need to install the calibration tool we will be using, xinput_calibrator; and other filters for controlling the touchscreen response. Install the tslib library by entering
aptitude install libts-bin:
more to read on Raspberry Pi :
This will create a configuration file called /etc/ts.conf, which contains settings for variance and jitter that can be changed to optimize pointer response. See here for information about configuring ts.conf.
Step 3: The calibration tool we will use is called ts_calibrate. We will also be using a program to check the results of the calibration called ts_test. In order to use ts_calibrate and ts_test, we must first set proper environmental variables. Enter
export TSLIB_TSDEVICE=/dev/input/event0 into the command prompt, then enter
You will need to re-enter these two lines each time you want to use ts_calibrate or ts_test if you log out of PuTTY or reboot your Raspberry Pi.
Step 4 : Now we can use ts_calibrate. Enter
ts_calibrate at the command prompt (make sure you are still in root mode) to run the ts_calibrate program. The program will consecutively display five crosses on different parts of the screen, which you need to touch with as much precision as possible:
PuTTY will output the calibration data after the calibration is complete:
This calibration data will be written to a calibration file called /etc/pointercal. To view the contents of this file, enter
cat /etc/pointercal at the root command prompt.
Step 5: We should now test the calibration by using the ts_test program. Enter
ts_test at the root command prompt to start the program:
Drag the cross around the screen and observe how closely it follows your finger or stylus to test the accuracy of the calibration. Now press the “Draw” button to enter the drawing mode:
Drag your finger or stylus around the screen to test the accuracy of the calibration.
Press Ctrl-C to stop the test.
If necessary, run ts_calibrate again to improve the calibration.
sudo reboot at the command prompt to reboot, and you should be all set to explore the Raspbian desktop on your LCD touch screen!
This is a long procedure to do, but it is well worth it if you want to get the LCD touchscreen calibrated properly. So if you have any trouble setting this up or have anything to say, please leave a comment below. Also, if you found this article useful, please share it with your friends! Until Next Time! Peace Out!
Share This Article