Adafruit 2.
Guide Contents Guide Contents Overview Connecting Pinouts 2 3 6 6 TFT Screen Pins Resistive Touch Controller Pins Capacitive Touch Pins MicroSD card Pins 6 7 7 7 Using with an Uno R3 8 Using Capacitive Touch Version w/Older Arduino Using with a Mega/Leonardo Graphics Test Install Libraries Install Adafruit ILI9341 TFT Library Adafruit GFX library Resistive Touchscreen Paint Demo Capacitive Touchscreen Paint Demo Download the FT6206 Library FT6206 Library Reference FT6206 Library Reference Drawing Bi
Overview Spice up your Arduino project with a beautiful large touchscreen display shield with built in microSD card connection. This TFT display is big (2.8" diagonal) bright (4 white-LED backlight) and colorful (18-bit 262,000 different shades)! 240x320 pixels with individual pixel control. It has way more resolution than a black and white 128x64 display.
This shield uses a SPI display - its much easier to use with Mega & Leonardo than our v1 shield. We also include an SPI resistive touchscreen controller or a I2C capacitive touch screen controller so you only need one or two additional pins to add a high quality touchscreen controller. Even with all the extras, the price is lower thanks to our parts sourcing & engineering skillz! The shield is fully assembled, tested and ready to go.
© Adafruit Industries https://learn.adafruit.
Connecting Pinouts There's two versions of the shield. One has a resistive touch screen, one has a capacitive one. The TFT display and pinouts is the same for both. The microSD card is the same too. The differences come in on the touch screen controller TFT Screen Pins © Adafruit Industries https://learn.adafruit.
TFT Screen Pins Digital #13 or ICSP SCLK - This is the hardware SPI clock pin. By default its digital #13. By cutting a jumper and soldering another on the back, you can move this line from #13 to the ICSP clock pin. This pin is used for the TFT, microSD and resistive touch screen data clock Digital #12 or ICSP MISO - This is the hardware SPI master-in-slave-out pin. By default its digital #12. By cutting a jumper and soldering another on the back, you can move this line from #12 to the ICSP MISO pin.
Using with an Uno R3 Because the TFT is about the same size as an Arduino, we pre-assemble the shield in the factory. To use, simply place it onto your Arduino Uno/Duemilanove/compatible. No wiring, no soldering! Bam! Using Capacitive Touch Version w/Older Arduino If you have an old Arduino without the SCL/SDA pins brought out (pre UNO R3) use a soldering iron to short these two jumpers: Using with a Mega/Leonardo © Adafruit Industries https://learn.adafruit.
With just a little effort you can make this shield plug-n-play with the Mega/Leonardo. Look at the bottom of the shield and find the area with the 6 jumpers. Three of them are closed, and three are open. Solder close the three ICSP jumpers. You can then cut the small line in between the #11, #12, #13 pads. This will free up digital #11, 12, and 13 for you to use on the Leo or Mega. That's it! No software or firmware hacking other than that is required. © Adafruit Industries https://learn.adafruit.
With this mod, the shield uses the ICSP header for data so make sure your duino (or stack of shields) has a ICSP plugged into the socket as above! © Adafruit Industries https://learn.adafruit.
Graphics Test We have a library with example code ready to go for use with these TFTs. The library is not incredibly fast and optimized but its a good start and can easily be ported to other micrcontrollers. However, we'll assume you're using an Arduino. Our github repository (https://adafru.it/d4d) contains all the code and examples you'll need for driving the TFT. Install Libraries You'll need a few libraries to use this display From within the Arduino IDE, open up the Library Manager...
Repeat this process one more time, looking for the Adafruit_ZeroDMA library. Install that one too. Restart the Arduino software. You should see a new example folder called Adafruit_ILI9341 and inside, an example called graphicstest. Upload that sketch to your Arduino! You should see a collection of graphical tests draw out on the TFT. © Adafruit Industries https://learn.adafruit.
© Adafruit Industries https://learn.adafruit.
Adafruit GFX library The TFT LCD library is based off of the Adafruit GFX graphics core library. GFX has many ready to go functions that should help you start out with your project. Its not exhaustive and we'll try to update it if we find a really useful function. Right now it supports pixels, lines, rectangles, circles, round-rects, triangles and printing text as well as rotation. Check out the GFX tutorial for detailed information about what is supported and how to use it (https://adafru.
Resistive Touchscreen Paint Demo This page is for the Resistive Touch Screen version of the Shield! The LCD has a 2.8" 4-wire resistive touch screen glued onto it. You can use this for detecting finger-presses, stylus', etc. Normally, you'll need 4 pins to talk to the touch panel but we decided to go all snazzy and put a dedicated touch screen driver onto the shield.
Getting data from the touchscreen is fairly straight forward. Start by creating the touchscreen object with Adafruit_STMPE610 ts = Adafruit_STMPE610(STMPE_CS); We're using hardware SPI so the clock, mosi and miso pins are not defined here. For the shield, CS is #8 always. Then you can start the touchscreen with ts.begin() Check to make sure this returns a True value, which means the driver was found.
© Adafruit Industries https://learn.adafruit.
Capacitive Touchscreen Paint Demo This page is for the Capacitive Touch Screen version of the Shield! 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.
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 ts.
FT6206 Library Reference FT6206 Library Reference (https://adafru.it/Atz) © Adafruit Industries https://learn.adafruit.
Drawing Bitmaps There is a built in microSD card slot into the shield, and we can use that to load bitmap images! You will need a microSD card formatted FAT16 or FAT32 (they almost always are by default). Its really easy to draw bitmaps. We have a library for it, Adafruit_ImageReader, which can be installed through the Arduino Library Manager (Sketch→Include Library→Manage Libraries…).
To make new bitmaps, make sure they are less than 240 by 320 pixels and save them in 24-bit BMP format! They must be in 24-bit format, even if they are not 24-bit color as that is the easiest format for the Arduino to decode. You can rotate images using the setRotation() procedure. The ShieldILI9341 example sketch shows everything you need to work with BMP images. Here’s just the vital bits broken out… Several header files are included at the top of the sketch.
ImageReturnCode stat; stat = reader.drawBMP("/purple.bmp", tft, 0, 0); You can draw as many images as you want — though remember the names must be less than 8 characters long. Call like so: reader.drawBMP(filename, tft, x, y); 'x' and 'y' are pixel coordinates where top-left corner of the image will be placed. Images can be placed anywhere on screen…even partially off screen, the library will clip the section to load. Image loading is explained in greater depth in the Adafruit_GFX library guide.
Backlight & Touch IRQ Both the resistive and capacitive versions of this shield have the ability to dim the backlight and get an interrupt from the resistive or capacitive touch controller chip on-board. Controlling the Backlight By default, we assume you'll want the backlight on all the time. However, you may want to PWM control or otherwise turn off the LED backlight to save power. You can do this with a simple hack. On the back, look for the backlight jumper.
Downloads Datasheets & Files STMPE610 (https://adafru.it/d4k) ILI9341 (TFT controller) (https://adafru.it/d4l) Raw 2.8" Resistive TFT datasheet (https://adafru.it/sEt) Raw 2.8" Capacitive TFT datasheet (https://adafru.it/rwA) FT6206 Datasheet (https://adafru.it/sEu) & App note (https://adafru.it/dRn) (capacitive chip) PCB CAD files for both resistive and capacitive versions on GitHub (https://adafru.
Schematic of the v2 Capacitive touchscreen © Adafruit Industries Last Updated: 2018-12-22 01:42:42 AM UTC Page 26 of 26