Toggle menu
480-503-4295

We Welcome Your Feedback

"We are pleased that we made the decision to work with Focus Displays. The engineering staff was helpful in the design of our custom LCD module. They created the counter drawing in a few days. They were able to accommodate any changes we made and quickly modified the counter drawing. We currently purchase a few different displays from Focus and we have been happy with their service and support."

Karin Reed, T. Designs

View Our Latest Brochure

Focus LCDs Brochure

Calibrating Touch Screens

Application Note FAN4203

This application note is part 2 of our 2 part TFT LCD screen series. Part 1 discusses configuring the screen resolution of a TFT with a Raspberry Pi. Part 2 discusses calibrating the touch screen of a TFT. Click here to read part 1.

 

 

 

After the display is setup with the Raspberry Pi you may want to calibrate the touch feature for accuracy. The display used in this example is a 7” TFT with capacitive touch (E70RA-HW520-C). This is a continuation of a previous application with the same display. The touch feature is auto enabled upon download of the Raspbian software; however, it may be inconsistent with actual motion. Calibrating the touch feature of a display can be done in just a few simple steps.

  1. Verify Display 

First, we will verify that the Raspberry Pi recognizes the display. To do this we will run a command that specifies where the input devices are connected. Open Terminal and execute the following command:

ls -al /dev/input/by-id

You will get a list of the various connection ports and where they are located. The display is recognized and is located at event0 as specified below.

event0.jpg

  1. Find the Program

Next, we find the program that calibrates the display. There are a few options of programs that calibrate the touch setting, the one I will be using is called ts_lib. We can install this through the Terminal. Root privileges will need to be enabled to install the program that is used. Enable super user mode by entering:

sudo su

Now we will download the program that calibrates the display. This program runs a quick test that verifies user input. Make sure the Raspberry Pi is connected to the internet for this step. To download this file, enter the following in the Terminal:

apt install libts-bin

sudo-su.jpg

This will install a configuration file for the touch screen. Before the test we need to specify which device we’re using and where it is located. The display is located at “event0” as verified in the previous step. This could be a different value for you depending on the setup so be sure to refer to the results of step one. Enter the following commands to define the display variables.

export tslib_tsdevice=/dev/input/event0

export tslib_fbdevice=/dev/fb1

define-display-variable.jpg

  1. Run Calibration Test

Now we can run the calibration test. To do this enter the ts_calibrate command in the Terminal. You will need to be in super user mode for the calibration test to run. A screen will pop up asking you to touch five different points on the screen, try to touch them as accurately as possible. After the test is finished a list of the results will be displayed in the Terminal.

calibration-screen.jpg

calibration-screen1.jpg

  1. Verify Calibration

You can now test the calibration by running the ts_test command in the Terminal. This will run a short program to verify the calibration results by dragging a pointer or drawing an image. When you are finished testing, press quit, and the test information will be displayed in the Terminal. If you are unsatisfied with the accuracy of the test you can run through the ts_calibrate program again.

calibration-test.jpg

Once you are satisfied with the results and the reboot the system.

sudo reboot

The touch screen should now be configured to a precise setting. This is just a brief overview of how to calibrate the capacitive touch feature of a display. For further calibration settings you can visit the “ts.config” file. You can open this file from Terminal by entering:

sudo nano /etc/ts.conf

For more information on these calibration settings and others visit the tslib documentation website.

DISCLAIMER

Buyers and others who are developing systems that incorporate FocusLCDs products (collectively, “Designers”) understand and agree that Designers remain responsible for using their independent analysis, evaluation and judgment in designing their applications and that Designers have full and exclusive responsibility to assure the safety of Designers' applications and compliance of their applications (and of all FocusLCDs products used in or for Designers’ applications) with all applicable regulations, laws and other applicable requirements.

Designer represents that, with respect to their applications, Designer has all the necessary expertise to create and implement safeguards that:

(1)     anticipate dangerous consequences of failures

(2)     monitor failures and their consequences, and

(3)     lessen the likelihood of failures that might cause harm and take appropriate actions.

Designer agrees that prior to using or distributing any applications that include FocusLCDs products, Designer will thoroughly test such applications and the functionality of such FocusLCDs products as used in such applications.