Graphical display modules or shields like
this are easy to use and cost effective solution
for showing
significant amount of data to the user.
Anything from text to plotted sensor data
or images.
This is 2.4" TFT touch screen shield sent
to me by ICStation.com.
They sent this for free,
so I could make this demonstrational test
video for you.
The price of this display is around $5, you
can check the current price and availability
at the website,
link is in the description.
Topic of this video is getting this display
to work.
I hate to ask this in advance, but if you
find this
video useful, interesting or just want to
show your support, hit the like button and
if you aren't one of
over 1000 subscribers I already have, consider
subscribing.
The pinout is printed on the silkscreen, but
you don't need to worry about that, because
the pinout is
predefined in the library that I used.
One important thing about the pinout: If you
use the built-in microSD-
card slot, this shield will use almost all
the GPIO of the Uno.
The controller inside the display hasn't been
marked on the board, but that's not a problem
either...
The library can read the identification bytes
from it and use the received bytes to determine
all
the necessary things.
On the hardware side this is plug and play,
so I'll just plug this in and we can see what
libraries to use...
Two required libraries can be installed through
the Arduino IDE's library manager.
First one is MCUFRIEND_kbv
by David Prentice.
This is the library made specifically for
these MCUFriend TFT shields, which share the
same
pinout.
This library relies on popular Adafruit GFX
Library, which can also be installed using
the library manager.
After installing those two libraries, you
can open gpraphictest_kbv -example, flash
it to your UNO which has
the display shield connected and try if it
works with your display.
If it works, you don't need to do anything,
just start developing your own project using
the libraries.
But if display stays white, but text printed
on the serial port states "ID = 0x9342", you
need to modify the
library's MCUFRIEND_kbv.cpp file, which can
be found in the folder where you have your
Arduino libraries installed.
There is small amount of code that needs to
be added to that file, I will add information
in the description, but
don't worry...
It's just copy-pasting one code block to that
file.
You can do all the common things, like draw
lines, text, etcetera, but there is one cool
feature: Vertical scroll
It's done in the display's hardware, so you
can scroll the display without having to redraw
it using slowish
Arduino.
When you scroll the display, lines that overflow
from the display area will appear on the other
end,
data on the first line goes to last line and
other lines move up by one, or the opposite
depending on the direction
of the scrolling.
Vertical scroll on this display support scrolling
partial screen as well, instead of just whole
display.
For some reason it took me a while to understand
how the vertScroll -function works, but it's
actually really simple.
Maybe I was trying to think it was more complicated
than it really is.
You pass three arguments: First one tells
how many lines from the top of the display
are NOT part of the scrolled area, second
tells the height of scrolled
area and third tells how much to scroll.
Being able to leave part of the display outside
of the scrollable area allows having a static
title bar on the screen
while rest of the screen scrolls.
If you want to use the touch screen, you need
to also download a third library.
You can do it by going to this
Adafruit's Touch-Screen-Library repo on github,
click "Clone or Download" and "Download ZIP".
Folder inside
the downloaded Zip file should be moved to
folder where your Arduino libraries are and
renamed to TouchScreen.
After that you can run MCUFRIEND_kbv library's
Toucscreen calibration sketch and take values
that the sketch
outputs and use them in your own projects
as calibration data.
This should be enough for all of you to make
your 2.4" TFT shields working.
Now it's time for you continue from
here and use the display in your own applications.
