Capacitive Touchscreen

We now have a super-fancy capacitive touch screen version of this shield. Instead of a resistive controller that needs calibration and pressing down, the capacitive has a hard glass cover and can be used with a gentle fingertip. It is a single-touch capacitive screen only!

The capacitive touch screen controller communicates over I2C, which uses two hardwire pins. However, you can share these pins with other sensors and displays as long as they don't conflict with I2C address 0x38.

The capacitive touch chip shares the same power and ground as the display, the only new pins you must connect are SDA and SCL - these must connect to the Arduino I2C pins.

  • Connect the SCL pin to the I2C clock SCL pin on your Arduino. On an UNO & '328 based Arduino, this is also known as A5, on a Mega it is also known as digital 21 and on a Leonardo/Micro, digital 3
  • Connect the SDA pin to the I2C data SDA pin on your Arduino. On an UNO & '328 based Arduino, this is also known as A4, on a Mega it is also known as digital 20 and on a Leonardo/Micro, digital 2

This demo uses the SPI 'side' of the display so get the SPI drawing demos working before you continue! You can adapt the code for use with the 8-bit side, just instantiate the FT6206 library and see the reference below!

Download the FT6206 Library

To control the touchscreen you'll need one more library - the FT6206 controller library which does all the low level chatting with the FT6206 driver chip. Click below to download and then install it as before.

Once you have the library installed, restart the IDE. Now from the examples->Adafruit_FT6206 menu select CapTouchPaint and upload it to your Arduino.

The touch screen is made of a thin glass sheet, and its very fragile - a small crack or break will make the entire touch screen unusable. Don't drop or roughly handle the TFT and be especially careful of the corners and edges. When pressing on the touchscreen, remember you cannot use a fingernail, it must be a fingerpad. Do not press harder and harder until the screen cracks!

FT6206 Library Reference

Getting data from the touchscreen is fairly straight forward. Start by creating the touchscreen object with

Adafruit_FT6206 ts = Adafruit_FT6206();

We're using hardware I2C which is fixed in hardware so no pins are defined.
Then you can start the touchscreen with


Check to make sure this returns a True value, which means the driver was found. You can also call begin(threshvalue) wish a number from 0-255 to set the touch threshhold. The default works pretty well but if you're having too much sensitivity (or not enought) you can try tweaking it

Now you can call

if (ts.touched())

to check if the display is being touched, if so call:

TS_Point p = ts.getPoint();

To get the touch point from the controller. TS_Point has .x and .y data points. The x and y points range from 0 to 240 and 0 to 320 respectively. This corresponds to each pixel on the display. The FT6206 does not need to be 'calibrated' but it also doesn't know about rotation. So if you want to rotate the screen you'll need to manually rotate the x/y points!

Touchscreen Interrupt pin

Advanced users may want to get an interrupt on a pin (or even, just test a pin rather than do a full SPI query) when the touchscreen is pressed. That's the IRQ pin, which is a 3V logic output from the breakout, you can connect it to any interrupt pin and use it like a 'button press' interrupt. We find that querying/polling the chip is fast enough for most beginner Arduino projects!

Last updated on 2015-05-04 at 04.27.56 PM Published on 2014-03-18 at 04.50.41 PM