logologologologo
  • home
  • learn to code
    • Space Invaders – Beginner’s Course
    • Asteroids – Beginner’s Level 2
    • Snake – a Beginner’s Challenge
  • learn to make
    • Arduino Tutorials
  • blog
    • Computer Science
    • Coding
      • Collision Detection
    • Retro Gaming
    • Computer Games for Vision Therapy
  • contact me
8 Queen Problem
The 8 Queen Problem – Computer Science
18th October 2020
The best computer language for beginners
The Best Computer Language for Beginners
8th November 2020
Published by Bob at 23rd October 2020
Categories
  • Arduino
  • Learn to Make
Tags
  • arduino
Connecting an SPI LCD touchscreen to Arduino

Connecting an SPI TFT Touchscreen to Your Arduino

Connecting an SPI TFT Touchscreen to Your Arduino

You can buy some great LCD modules for under £10 that will easily connect to your Arduino or microcontroller projects. These give you a full colour display to output information as text or graphics, and if you add in a touchscreen overlay you’ve got a fantastic user interface device.

Most of these small TFT modules connect using an SPI interface, often using the ILI9341 (or similar) display driver IC and XPT2046 to drive the touchscreen. If you opt for the cheaper Chinese versions you’ll get the module but no instructions or support to get it working. In this video I’ll show you everything you need to know to get both the screen and the touchscreen working on your Arduino.

Key Points to Get It Working

We’ll be using the Adafruit ILI9341 library to handle the low level communication with the LCD panel. The Adafruit modules referenced in their own tutorials contain extra circuitry to make the connection easier. For the generic panels we need to make sure we connect the reset pin and initialise the library, telling it which pin we’ve used on the Arduino.

We also need to add our own level shifting circuit to take the 5V Arduino logic down to 3.3V for the ILI9341.

We’ll be using the LCD and touchscreen together so we’ll also need to correctly set their slave select inputs to avoid errors as we start the devices.

Once you’ve got these extras in place the LCD modules should connect without any problems.

Circuits

The full connection circuit for the panel is shown below using an Arduino Uno.

SPI LCD touchscreen with Arduino Uno

You can use this breadboard layout as a guide to connecting it all together.

Arduino with TFT touchscreen panel breadboard layout

What Next?

Once you’ve got the module up and running you need to work out how to use it. Check out my next tutorial to get a Pong game running on the device. This will show the text and graphics in action and give you advice on the limitations of the screen and how to get animations working correctly.

Links

LCD module – Amazon
https://amzn.to/35quUJF

LCD eBay
https://rover.ebay.com/rover/1/710-53481-19255-0/1

ILI9341 Library
https://github.com/adafruit/Adafruit_ILI9341

XPT2046 Library
https://github.com/PaulStoffregen/XPT2046_Touchscreen

Adafruit GFX Library
https://github.com/adafruit/Adafruit-GFX-Library

Adafruit LCD tutorial
https://learn.adafruit.com/adafruit-2-8-and-3-2-color-tft-touchscreen-breakout-v2/spi-wiring-and-test

Adafruit GFX Library Tutorial
https://learn.adaruit.com/adafruit-gfx-graphics-library/overview

Share
2
Bob
Bob

Related posts

Display images on your LCD with Arduino
9th April 2021

How To Load Images Onto Your Arduino LCD Screen From an SD Card


Read more
Add and SD Card to your Arduino
28th March 2021

Add an SD Card To Your Arduino – Setup and basic file operations


Read more
Unzip multiple archive files in one go
14th March 2021

How to Unzip Multiple Archive Files in Windows 10


Read more

Comments are closed.

  • Privacy Policy
  • Contact Me
© 2020 Bytes N Bits