13.1 PROJECT 13.1 – Touch Screen LED ON-OFF

13.1.1 Project Description

This is perhaps the simplest GLCD project utilising touch screen. In this project, an LED is connected to pin RC7 of the microcontroller. Two buttons are placed on the screen, labelled ON and OFF. Touching the ON button will turn the LED ON. Similarly, touching the OFF button will turn the LED OFF.

The principle of operation of a touch screen is such that, as shown in Figure 13.1, if one side of a layer is connected to +V and the other side to ground, a potential gradient results on the screen layer, and the voltage at any point on this layer becomes directly proportional to the distance from the +V side.

Figure 13.1 Voltage gradient in a screen layer

img

In a 4-wire resistive touch screen, two measurements are made one after the other one to determine the X and Y co-ordinates of the point touched by the user. Figure 13.2a shows how the X co-ordinate can be determined. Here, the right- and left-hand sides of the top layer can be connected to +V and ground, respectively. The bottom layer can then be used to sense and measure the voltage at the point touched by the user. An A/D converter is used to convert this voltage to digital and then determine the X co-ordinate. Similarly, Figure 13.2b shows how the Y co-ordinate can be determined. Here, the upper and lower sides of the bottom layer can be connected to +V and ...

Get Using LEDs, LCDs and GLCDs in Microcontroller Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.