Arduino TFT Screen and Arduino Nano

In this Arduino Tutorial we will learn how to use the Arduino TFT screen on the Arduino platform. The following video shows the results of this project, read the tutorial below for more details.

Overview 

The Arduino TFT screen is a backlit TFT LCD screen with a micro SD card slot in the back. You can draw text, images, and shapes to the screen with the TFT library.

When you have finished reading this tutorial, you will be familiar with:

  • Connecting and using a Arduino TFT screen

What You Will Need

We will need the following parts and libraries in this tutorial:

Parts:

Libraries:

The following libraries will be used in this tutorial. Please refer to this tutorial on how to add an Arduino library in eclipse

We will be using Eclipse for Arduino, if you haven’t setup please refer to my previous tutorial on eclipse for Arduino.

Circuit Schematics

The screen’s headers are designed to fit into the socket on the front of the Arduino Esplora or the Arduino Robot but, this module is compatible with any AVR-based Arduino (Uno, Leonardo, etc…) or with the Arduino Due. If you want to use on these other boards, some slight changes on connections are required.

Connect the pins following this default configuration:

TFT screen Arduino Board
+5V: +5V
MISO: pin 12
SCK: pin 13
MOSI: pin 11
LCD CS: pin 10
SD CS: N/A (Only connect if using SD – pin 4)
D/C: pin 9
RESET: pin 8
BL: +5V
GND: GND.

 

Source Code

The project has the following workflow: First we display a welcome screen and then in the loop we display a series of text and shapes in different screen orientations.

Now let’s take a look at the code. So first we need to include the libraries for the TFT module, define some variables needed for the program below as well as create the instances of the libraries

In the setup section, first we initialize the TFT module, set the background color, then the text color   and display our content on the welcome screen.

Let’s take a look at the testText( ) custom function. First it sets the background color to BLACK and displays the texts using different text sizes and color. We set the  text size using setTextSize( x ) where x is the size, the text coordinate using setCursor( x, y ),the text color using setTextColor( WHITE ) where WHITE is the fore color of the text and finally print the text using println( “TFT” ).

Next let’s look at the testGraphic( ) custom function this prints various shapes on the screen.

So that’s pretty much everything and here’s the complete code of the project:.

Leave a Reply