.8" TFT Display Breakout and Shield Created by lady ada Last updated on 2018-12-12 04:11:18 AM UTC
Guide Contents Guide Contents Overview 1.8" TFT Breakout Breakout Assembly 2 3 5 6 Prepare the header strip: Add the breakout board: And Solder! 6 7 8 Breakout Wiring & Test Install Adafruit ST7735 TFT Library Changing Pins Displaying Bitmaps Breakout Wiring Example Sketch 1.8" TFT Shield V2 TFT Display Buttons & Joystick SD Card seesaw I2C Expander Testing the Shield Open the Arduino Library manager 20 1.8" Shield with seesaw 20 Displaying a Bitmap 22 Original V1 Shield Original V1.
Overview This tutorial is for our 1.8" diagonal TFT display. It comes packaged as a breakout or as an Arduino shield. Both styles have a microSD interface for storing files and images. These are both great ways to add a small, colorful and bright display to any project. Since the display uses 4-wire SPI to communicate and has its own pixel-addressable frame buffer, it requires little memory and only a few pins. This makes it ideal for use with small microcontrollers.
type and thus have poor color and slow refresh, this display is a true TFT! The TFT driver (ST7735R) can display full 18bit color (262,144 shades!). And the LCD will always come with the same driver chip so there's no worries that your code will not work from one to the other. Both boards have the TFT soldered on (it uses a delicate flex-circuit connector) as well as a ultra-low-dropout 3.3V regulator and a 3/5V level shifter so you can use it with 3.3V or 5V power and logic.
1.8" TFT Breakout This color display uses SPI to receive image data. That means you need at least 4 pins - clock, data in, tft cs and d/c. If you'd like to have SD card usage too, add another 2 pins - data out and card cs. However, there's a couple other pins you may want to use, lets go thru them all! Lite - this is the PWM input for the backlight control. Connect to 3-5VDC to turn on the backlight. Connect to ground to turn it off. Or, you can PWM at any frequency.
Breakout Assembly Prepare the header strip: Cut the strip to length if necessary. It will be easier to solder if you insert it into a breadboard - long pins down © Adafruit Industries https://learn.adafruit.
Add the breakout board: Place the breakout board over the pins so that the short pins poke through the breakout pads © Adafruit Industries https://learn.adafruit.
And Solder! Be sure to solder all pins for reliable electrical contact. (For tips on soldering, be sure to check out our Guide to Excellent Soldering (https://adafru.it/aTk)). You're done! Check your solder joints visually and continue onto the next steps © Adafruit Industries https://learn.adafruit.
Breakout Wiring & Test There are two ways to wire up these displays - one is a more flexible method (you can use any pins on the Arduino) and the other is much faster (4-8x faster, but you are required to use the hardware SPI pins) We will begin by showing how to use the faster method, you can always change the pins later for flexible 'software SPI' Wiring up the display in SPI mode is pretty easy as there's not that many pins! We'll be using hardware SPI, but you can also use software SPI (any pins) later
the Arduino “Sketch” menu, select “Include Library” then “Manage Libraries…” Search for and install the Adafruit GFX library: And the Adafruit ST7735 library: Repeat the search and install steps one more time, looking for Adafruit_ZeroDMA. That’s the third and final library. If this is all unfamiliar, we have a tutorial introducing Arduino library concepts and installation (https://adafru.it/aYM). Restart the IDE! © Adafruit Industries https://learn.adafruit.
After restarting the Arduino software, you should see a new example folder called Adafruit_ST7735 and inside, an example called graphicstest. Now upload the sketch to your Arduino. You may need to press the Reset button to reset the arduino and TFT. You should see a collection of graphical tests draw out on the TFT. Once uploaded, the Arduino should perform all the test display procedures! If you're not seeing anything - first check if © Adafruit Industries https://learn.adafruit.
you have the backlight on, if the backlight is not lit something is wrong with the power/backlight wiring. If the backlight is lit but you see nothing on the display make sure you're using our suggested wiring. Changing Pins Now that you have it working, there's a few things you can do to change around the pins. If you're using Hardware SPI, the CLOCK and MOSI pins are 'fixed' and cant be changed. But you can change to software SPI, which is a bit slower, and that lets you pick any pins you like.
Displaying Bitmaps In this example, we'll show how to display a 128x160 pixel full color bitmap from a microSD card. We have an example sketch in the library showing how to display full color bitmap images stored on an SD card. You'll need a microSD card such as this one (http://adafru.it/102). You'll also need to download our SD library modified to allow faster reads (these changes will hopefully be added to arduino v23) but for now you can download the new library here (https://adafru.it/aP6).
Breakout Wiring Shield users can skip directly to the "Example Sketch" section. Wire up the TFT as described on the wiring & test page. Test that your wiring is correct by uploading the graphics test sketch with the high speed SPI lines. Once you are sure that the TFT is wired correctly, add the two wires for talking to the SD card. Connect CARD_CS (the unconnected pin in the middle) to digital pin 4 (you can change this later to any pin you want).
from the right) to the Arduino's hardware SPI MISO pin. For Classic arduinos, this is pin 12. For Mega's this is pin 50. You can't change the MISO pin, its fixed in the chip hardware. Example Sketch Load the spitftbitmap example sketch into the Arduino IDE. Breakout and Shield on an Arduino Uno users can use the code as-is. Now upload the spitftbitmap example sketch to the Arduino. It should display the parrot image.
1.8" TFT Shield V2 Let's take a tour of the 1.8" TFT Shield TFT Display In the center is the 1.8" TFT display. This display is full color (16-bit RGB), 128x160 pixels, and has a backlight. The display receives data over SPI plus two pins: SCK - SPI Clock MOSI - SPI Data Digital 10 - Chip Select Digital 8 - Data/Command Select The TFT reset is connected to the seesaw chip. The backlight is also PWM controlled by the seesaw chip.
In addition of the display, you also get a bunch of userinterface buttons. In the top left is the Reset button, this will reset the shield and Arduino when pressed. It is connected directly to the Reset pins There are three buttons labeled A B C below the TFT, these are connected to the seesaw chip. You can read the values over I2C To the right of the TFT is a 5-way joystick. It can be pushed up/down/left/right and select (in).
Instead of taking up a bunch of GPIO pins to read the buttons and joystick, as well as controlling the TFT backlight, we use an I2C expander chip called the seesaw. It is connected to the SDA/SCL pins and can read/write pins with our library.
Testing the Shield You can test your assembled shield using the example code from the library. Start by installing a bunch of libraries! Open the Arduino Library manager Install the Adafruit GFX Library Adafruit ST7735 Library Adafruit seesaw Library You can read more about installing libraries in our tutorial (https://adafru.it/aYG). Restart the Arduino IDE. 1.8" Shield with seesaw © Adafruit Industries https://learn.adafruit.
If your shield looks like this, you have the 1.8" seesaw version (the most recent) which will work with just about any/all boards.
loop. The graphics don't look identical to the below but you should still press all the buttons as shown! For more details about seesaw, check out our guide (https://adafru.it/Cmk) - we made a nice wrapper for the 1.8" TFT to control the backlight and read buttons but it still might be useful to know the underlying protocol Displaying a Bitmap If you have parrot.bmp (https://adafru.
© Adafruit Industries https://learn.adafruit.
Original V1 Shield Original V1.0 Shield If your shield looks like this, you have the original 1.8" TFT shield which does not have a helper seesaw chip The shield uses the "Classic Arduino" SPI wiring and will perform best with Atmega 328-based Arduinos such as the Uno. It can work with other Arduinos but not very well.
processors can use the "Option 1" version of the constructor for best performance: Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST); Mega and Leonardo users should use the "Option 2" version of the constructor for compatibility: Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST); Be sure to select only one option and comment out the other with a pair of //'s. Now upload the sketch to see the graphical display! © Adafruit Industries https://learn.adafruit.
Assembling the Shield The shield comes with all surface mount parts pre-soldered. All that remains is to install the headers! Cut the Header Sections Cut the breakaway header strip into sections to fit the holes on the edge of the shield. You will need 2 sections of 6-pins and 2 sections of 8 pins. You can use wire-cutters as shown or pliers to snap them apart between pins. © Adafruit Industries https://learn.adafruit.
Insert the Headers into an Arduino To align the header strips for soldering, insert them (long pins down) into the headers of an Arduino. Note that for R3 and later Arduinos, there will be an extra 2 unused pins on the end closest the USB and DC power jacks. © Adafruit Industries https://learn.adafruit.
Add the Shield Place the shield over the header strips so that the short pins stick up through the holes. © Adafruit Industries https://learn.adafruit.
And Solder! Solder each pin to assure good electrical contact. For tips on soldering see the Adafruit Guide to Excellent Soldering (https://adafru.it/aTk). © Adafruit Industries https://learn.adafruit.
Reading the Joystick The 5-way joystick on the shield is great for implementing menu navigation or even for use as a tiny game controller. To minimize the number of pins required, the joystick uses a different resistor on each leg of the control to create a variable voltage divider that can be monitored with a single analog pin. Each movement of the joystick control connects a different resistor and results in a different voltage reading.
You can use this code as the input method for your menu system or game: void setup() { // initialize serial communication at 9600 bits per second: Serial.
Graphics Library We've written a full graphics library specifically for this display which will get you up and running quickly. The code is written in C/C++ for Arduino but is easy to port to any microcontroller by rewritting the low level pin access functions. 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.
Downloads Files & Datasheets Adafruit GFX library (https://adafru.it/aJa) Adafruit ST7735 library (https://adafru.it/aHm)(See our detailed tutorial for installation assistance (https://adafru.it/aYG)) Fritzing object in the Adafruit library (https://adafru.it/aP3) Datasheet for the display (https://adafru.it/aP8) Datasheet for the display driver chip (https://adafru.it/aP9). EagleCAD PCB files for TFT shield (https://adafru.it/qxB) EagleCAD PCB files for TFT breakout (https://adafru.
Shield v2 Schematic & Fab Print This is the newer seesaw version © Adafruit Industries https://learn.adafruit.
Shield V1 Schematic & Fab Print This is the 'original' non-seesaw version © Adafruit Industries https://learn.adafruit.
© Adafruit Industries https://learn.adafruit.