Before you start, we'll need to tell the display to put us in SPI mode so it will know which pins to listen to. To do that, we have to connect tbe IM1, IM2 and IM3 pins to 3.3V. The easiest way to do that is to solder closed the IMx jumpers on the back of the PCB. Turn over the PCB and find the solder jumpers
With your soldering iron, melt solder to close the three jumpers indicated IM1 IM2 and IM3 (do not solder closed IM0!)
If you really don't want to solder them, you can also wire the breakout pins to the 3vo pin, just make sure you don't tie them to 5V by accident! For that reason, we suggest going with the solder-jumper route.
Wiring up the display in SPI mode is much easier than 8-bit mode since there's way fewer wires. Start by connecting the power pins
- 3-5V Vin connects to the Arduino 5V pin
- GND connects to Arduino ground
- CLK connects to SPI clock. On Arduino Uno/Duemilanove/328-based, thats Digital 13. On Mega's, its Digital 52 and on Leonardo/Due its ICSP-3 (See SPI Connections for more details)
- MISO connects to SPI MISO. On Arduino Uno/Duemilanove/328-based, thats Digital 12. On Mega's, its Digital 50 and on Leonardo/Due its ICSP-1 (See SPI Connections for more details)
- MOSI connects to SPI MOSI. On Arduino Uno/Duemilanove/328-based, thats Digital 11. On Mega's, its Digital 51 and on Leonardo/Due its ICSP-4 (See SPI Connections for more details)
- CS connects to our SPI Chip Select pin. We'll be using Digital 10 but you can later change this to any pin
- D/C connects to our SPI data/command select pin. We'll be using Digital 9 but you can later change this pin too.
That's it! You do not need to connect the RST or other pins for now.
You'll need a few libraries to use this display
From within the Arduino IDE, open up the Library Manager...
We have example code ready to go for use with these TFTs.
Two libraries need to be downloaded and installed: first is the Adafruit ILI9341 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
Search for ILI9341 and install the Adafruit ILI9341 library that pops up!
For more details, especially for first-time library installers, check out our great tutorial at http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use
Next up, search for Adafruit GFX and locate the core library. A lot of libraries may pop up because we reference it in the description so just make sure you see Adafruit GFX Library in bold at the top.
Repeat the search and install steps one more time, looking for Adafruit_ZeroDMA this time around. Install this one too!
After restarting 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 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.
If you're having difficulties, check the serial console.The first thing the sketch does is read the driver configuration from the TFT, you should see the same numbers as below
If you did not connect up the MISO line to the TFT, you wont see the read configuation bytes so please make sure you connect up the MISO line for easy debugging! Once its all working, you can remove the MISO line