Introduction: Arduino - TFT Display of Icons and Images From FLASH Memory

Picture of Arduino - TFT Display of Icons and Images From FLASH Memory

In this Instructable you will find a library and sketch to plot images stored in the Arduino FLASH memory onto a TFT screen.

Here we use my favorite 2.2" 320 x 240 pixel ILI9341 based TFT display. This display is a nice size for Arduino based projects and is available at low cost on eBay.

I have other Instructables on the topic of interfacing with these displays so this one is going to be brief!

Step 1: Connecting Up

Connections between UNO and the display are:

  • UNO +5V to display pin 1 (VCC)
  • UNO +5V through a 56 Ohm resistor to display pin 8 (LED)
  • UNO 0V (GND) to display pin 2 (GND)
  • UNO digital pin 7 through a 1K2 resistor to display pin 4 (RESET), add a 1K8 resistor from display pin 4 to GND
  • UNO digital pin 9 through a 1K2 resistor to display pin 5(DC/RS), add a 1K8 resistor from display pin 5 to GND
  • UNO digital pin 10 through a 1K2 resistor to display pin 3 (CS), add a 1K8 resistor from display pin 3 to GND
  • UNO digital pin 11 through a 1K2 resistor to both display pin 6 (MOSI), add a 1K8 resistor from display pin 6 to GND
  • UNO digital pin 13 through a 1K2 resistor to display pin 7 (SCK), add a 1K8 resistor from display pin 7 to GND

Other pin outs at the Arduino can be used by adapting the sketch should you have a display from another supplier or wish to use an existing setup.

The connections are compatible with my Instructable here which shows how to plot images pulled off an SD Card.

Step 2: Libraries and Sketch

Picture of Libraries and Sketch

The sketch to plot the bitmaps is an example in the "Adafruit_ILI9341_AS" library attached.

This library needs the Adafruit_GFX_AS supporting library.

The sketch draws graphical icons to the screen. the icon images are stored in FLASH. You can add your own icon images, commensurate with the available FLASH space, by using the UTFT library utility "ImageConverter565.exe" that is within the UTFT library.

The image pixels are stored in a 16 bit integer array, the array is created by importing a bitmap file of the .bmp type into the ImageConverter565 application and saving as a .c file. The array can then be cut and pasted from the .c file into the "Flash_icons.h" file that is part of the sketch. Take a note of the width and height numbers, add a comment in front of the array.

Look at the example sketch and you will get the idea!

Comments

FabriceA6 (author)2017-08-07

Hello, great tutorial, thanks. Do you have a similar one for touch screen?

GerardoM1 (author)2016-03-17

Hello, I bought this TFT:

http://www.ebay.it/itm/Schermo-TFT-LCD-320-x-480-3-2-pollici-Arduino-963573-/121868650556?hash=item1c5ff0083c:g:LbkAAOSw5dNWnLH6

I would mount it on an Arduino Mega and recall the images uploaded to SD with a button ... can you help me?

Thank you and congratulations for the job!

regards,

Gerry

Bodmer (author)2015-04-03

I'm working on a method to RLE encode the icons so many more could be fitted into a given FLASH allocation. Watch this space " " !

About This Instructable

5,739views

7favorites

License:

More by Bodmer:Arduino - TFT display of icons and images from FLASH memoryArduino - TFT display of bitmap images from an SD CardArduino analogue 'ring' meter on colour TFT display
Add instructable to: