4-Wire Resistive Touch Screen Push Button: 1.8” TFT and ST Nucleo-L476RG
This application note uses the 1.8” TFT display with 4-wire resistive touch and the ST Nucleo-L476RG microcontroller. Here we will discusses how to program a digital push button activated by the resistive touch panel. A section of this application note requires information from FAN4205.
1. Introduction
The display used in this project is a 1.8” TFT with 128×160 pixels of resolution. The microcontroller used is the Nucleo-L476RG from ST. The TFT display will be interfaced with the microcontroller via a 4-wire serial connection. This application note is a continuation of FAN4205 to further demonstrate the features of this display.
In just a few steps the TFT can be wired and programmed to display up to 65K colors and 128×160 pixels of resolution. Various wiring and interface options are available, from 3-4 wire serial, to 16/18-bit RGB and 8/9/16/18-bit MCU parallel. Additional features of this display are below. As always, check out the data sheet for the specs of this specific display. (datasheet)
- 45 pins, 34.0×47.0 mm
- 128(RGB)x160 pixels, TN
- 4-wire Resistive Touch Screen
- ILI9163 controller
- White LED Backlight
- Transmissive/Normally White
- Serial and Parallel interfaces
- 3.3V (TYP)
2. What You’ll Need
First you will need an IDE to program the display. This ST microcontroller lets you use a range of IDE’s so it is up to personal preference. I am going to use the Arduino IDE, any IDE that supports C++ and is compatible with the ST microcontroller will work. There is a list of options on ST’s website. We will come back to this after the hardware is setup.
Below is a list of the physical materials you will need to setup the project.
Qty | Description | Note |
1 | ST Nucleo-L476G Microcontroller with USB Cable | TI |
1 | E17RG11216LW6M300-N 1.8” TFT display | Focus LCDs |
1 | 45-pin FPC connector board 0.5 mm pitch | |
1 | Male-to-Male Jumper Wires | |
1 | 55Ω resistor | |
1 | Soldering Iron | |
1 | Solder | |
1 | Solderless breadboard |
3. Hardware Connections
Refer to application note FAN4205 on how to connect this display to the microcontroller.
Figure 1: 1.8″ TFT with FPC Cable
Consult the datasheet for a detailed explanation of each pin assignment and their functions. The 4-wire serial data pins are connected to the ST specific serial inputs for the “Hardware SPI” programming option. Refer to the previous application note for pin assignments and wiring.
There are four additional wires to connect the resistive touch panel to the microcontroller. These represent the conductive layers of the 4-wire resistive touch screen.
The measured resistance across the two X terminals is approximately 365 Ω. This can be verified with a multimeter. This value will be used to determine the change in resistance once the push button is pressed.
4. Programming the ST Nucleo-L476RG
Now to program the microcontroller. For this example, the Arduino IDE was used. There are alternative IDE’s that can be used to program the display. This was chosen from preference and the accessibility of a variety of TFT graphics libraries that are available. If you choose to go this route, refer to the previous application note on how to interface the ST Nucleo with the Arduino IDE.
Here is the example program that displays a push button that switches between the play and pause symbol once pressed. The locations of the pins are defined below. These include the serial input locations and the four resistive touch terminal connections
This example is dependent on two libraries, “Adafruit_GFX” and “Adafruit_TouchScreen”. You can download them from the Libraries Manager in the Arduino IDE or on Github. One is a graphics library and the other is a resistive touch library. These libraries are useful for a variety of TFT features.
The touch screen library allows for a function that will track the x and y positions of the touch as well as the pressure applied across the terminals. This allows for testing and calibration through the serial monitor when running the program. This is useful when troubleshooting and defining the parameters of the buttons.
Further calibration of the 4-wire resistive touch sensor can be done with the functions in the Touch Screen library. If the touch aspect of the screen is sensitive and the button changes without pressing, a minimum pressure definition can be implemented.
Here is what the pushbuttons should look like on the screen. For this example, pause and play buttons were chosen and are created using the Adafruit GFX library. A different approach would be to upload custom bitmap images of a push button. Depending on size and the communication protocol used, this may slow the image rendering speed.
5. Summary
This 1.8” TFT with a 4-wire resistive touch screen is a good option for creating digital push buttons and 65K color images. This display is compatible with a variety of microcontrollers and can store bitmaps and images with using a small amount of on-board memory. This is beneficial for flash memory storage on the microcontroller can be used which leads to faster data uploading speeds. 4-wire resistive touch screens are a cheaper alternative to capacitive and are a great choice for smaller applications such as this.
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.