Wiring up the 8-bit mode is kind of a pain, so we really only recommend doing it for UNO (which we show) and Mega (which we describe, and is pretty easy since its 8 pins in a row). Anything else, like a Leonardo or Micro, we strongly recommend going with SPI mode since we don't have an example for that. Any other kind of 'Arduino compatible' that isn't an Uno, try SPI first. The 8-bit mode is hand-tweaked in the Adafruit_TFTLCD pin_magic.h
file. Its really only for advanced users who are totally cool with figuring out bitmasks for various ports & pins.
Really, we'll show how to do the UNO but anything else? go with SPI!
Make sure you're soldering and connecting to the 8-bit side!
Part 1 - Power & backlight test
Begin by wiring up the 3-5VDC
Connect the 3-5V
pin to 5V
on your Arduino. I'm using the breadboard rails but you can also just wire directly.
Power it up and you should see the white backlight come on.
Part 2 - Data Bus Lines
Now that the backlight is working, we can get the TFT LCD working.
There are many pins required, and to keep the code running fairly fast,
we have 'hardcoded' Arduino digital pins #2-#9 for the 8 data lines.However, they are not in that order!
D0 and D1 go to digital #8
, then D2-D7 connect to #2
. This is because Arduino pins #0 and #1 are used for serial data so we can't use them
Begin by connecting D0 and D1 to digital #8 and 9 respectively as seen above.
If you're using a Mega, connect
the TFT Data Pins D0-D1 to Mega pins #22-23, in that order. Those Mega
pins are on the 'double' header.
Now you can connect the remaining 6 pins over. Connect D2-D7 on the TFT pins to digital 2 thru 7 in that order. If you're using a Mega, connect
the TFT Data Pins D2-D7 to Mega pins #24-29, in that order. Those Mega
pins are on the 'double' header.
In addition to the 8 data lines, you'll also need 4 or 5 control lines. These can later be reassigned to any digital pins, they're just what we have in the tutorial by default.
- Connect the third pin CS (Chip Select) to Analog 3
- Connect the fourth pin C/D (Command/Data) to Analog 2
- Connect the fifth pin WR (Write) to Analog 1
- Connect the sixth pin RD (Read) to Analog 0
You can connect the seventh pin RST (Reset)
to the Arduino Reset line if you'd like. This will reset the panel when
is Reset. You can also use a digital pin for the LCD reset if you want
to manually reset. There's auto-reset circuitry on the board so you
probably don't need to use this pin at all and leave it disconnected
pin is used to read the chip ID off the TFT. Later, once you get it all
working, you can remove this pin and the ID test, although we suggest
keeping it since its useful for debugging your wiring.
OK! Now we can run some code
8-Bit Library Install
We have example code ready to go for use with these TFTs. It's
written for Arduino, which should be portable to any microcontroller by
adapting the C++ source.
libraries need to be downloaded and installed: first is the Adafruit_TFTLCD library
(this contains the low-level code specific to this device), and second is the Adafruit GFX Library
(which handles graphics operations common to many displays we carry). If you have Adafruit_GFX
already, make sure its the most recent version since we've made updates for better performance
Download both ZIP files, uncompress and rename the folders to Adafruit_TFTLCD
) and Adafruit_GFX
) respectively. Then place them inside
your Arduino libraries
folder and restart the Arduino IDE. If this is
all unfamiliar, we have a tutorial introducing Arduino library concepts and installation
In the Adafruit_TFTLCD
Library folder, you may need to edit Adafruit_TFTLCD.h
. On about line 12, you will see
Make sure this line is commented out with a // in front (it should but if you're having issues, its worth checking.
After restarting the Arduino software, you should see a new example folder called Adafruit_TFTLCD and inside, an example called graphicstest.
Upload that 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.
(The images below shows SPI wiring but the graphical output should be similar!)
If you're having difficulties, check the serial console.The first thing the sketch does is read the driver
code from the TFT. It should be 0x9341 (for the ILI9341 controller inside)
If you Unknown Driver Chip then it's probably something with your wiring, double check and try again!
Last updated on 2015-11-20 at 02.52.14 PM
Published on 2014-03-18 at 04.50.41 PM