Topics

► Games

► Sound & Music

► Watches & Clocks

► GPS

► Power Supplies

► Computers

► Graphics

► Thermometers

► Wearables

► Test Equipment

► Tutorials

► Libraries

► PCB-Based Projects

By processor

AVR ATtiny

► ATtiny10

► ATtiny2313

► ATtiny84

► ATtiny841

► ATtiny85

► ATtiny861

► ATtiny88

AVR ATmega

► ATmega328

► ATmega1284

AVR 0-series and 1-series

► ATmega4809

► ATtiny1604

► ATtiny1614

► ATtiny3216

► ATtiny3227

► ATtiny402

► ATtiny404

► ATtiny414

► ATtiny814

AVR DA/DB-series

► AVR128DA28

► AVR128DA32

► AVR128DA48

► AVR128DB28

ARM

► ATSAMD21

► RP2040

► RA4M1

About me

  • About me
  • Twitter
  • Mastodon

Feeds

RSS feed

Universal TFT Display Backpack

11th May 2022

This project is a microcontroller board, based on an ATtiny414, that can accommodate a range of different Adafruit and AliExpress colour TFT displays:

TFTBackpackBarchart.jpg

The Universal TFT Backpack driving Adafruit's new 1.9" 320x170 TFT display.

It's ideal for use with my Tiny TFT Graphics Library 2, and includes an I2C interface and optional crystal, making it suitable for use in sensor and clock projects.

Introduction

While working on my Tiny TFT Graphics Library I needed to test it with several different TFT displays on a prototyping board, and noticed that many of them, with a small number of exceptions, had one of two standard pin connection layouts. That gave me the idea of designing a breakout board that would take any of these displays, and be a great starting point for a variety of display-based projects.

The board accommodates any of a variety of Adafruit or AliExpress colour TFT displays – for details see the tables below. The display connection header pin holes are staggered so you can push the display in place, and it will stay firmly connected without soldering. This is especially useful if you want to try different displays in an application.

Although you could drive these TFT displays from an 8-pin ATtiny processor such as the ATtiny402, I decided to base the board on a 14-pin device, such as the ATtiny414, to allow it to offer the following additional optional features:

  • The board provides I2C connections so you can connect the board to sensors. For example, you could use this to make a graphical weather station.
  • The board provides optional connections to the backlight and SD-card select. The pin used to control the backlight supports PWM analogue output, so you can vary the brightness of the backlight from the microcontroller with analogWrite(). These signals are also taken to the edge connector so you can use them for other applications instead.
  • The board includes space for a 32.768kHz crystal for use as the timer clock source with 1-series or 2-series processors, such as the ATtiny414, allowing you to build an accurate graphical clock.

The board and graphics library accommodate any of the new 0-series, 1-series, or 2-series 14-pin microcontrollers, from the ATtiny404 with 4Kbytes of flash and 128 bytes of RAM, up to the ATtiny3224 with 32Kbytes of flash and 3Kbytes of RAM.

Adafruit displays

The Universal TFT Display Backpack is compatible with the following Adafruit displays:

Manufacturer Size Width Height Voltage Driver Link
Adafruit 1.44" 128 128 3.3 - 5V ST7735R Adafruit 1.44" Color TFT LCD Display
Adafruit 0.96" 160 80 3.3 - 5V ST7735 Adafruit 0.96" 160x80 Color TFT Display
Adafruit 1.14" 240 135 3.3 - 5V ST7789 Adafruit 1.14" 240x135 Color TFT Display
Adafruit 1.3" 240 240 3.3 - 5V ST7789 Adafruit 1.3" 240x240 Wide Angle TFT LCD Display
Adafruit 1.54" 240 240 3.3 - 5V ST7789 Adafruit 1.54" 240x240 TFT LCD Display *
Adafruit 1.9" 320 170 3.3 - 5V ST7789 Adafruit 1.9" 320x170 Color IPS TFT Display
Adafruit 1.47" 320 172 3.3 - 5V ST7789 Adafruit 1.47" 320x172 Round Rectangle TFT Display
Adafruit 2.0" 320 240 3.3 - 5V ST7789 Adafruit 2.0" 320x240 Color IPS TFT Display

* The latest version of this display includes an additional TE pin, but it is compatible if you omit this.

Use the 11-way row of pins for Adafruit displays. Note that a couple of Adafruit TFT displays have an incompatible pinout; if you're not sure whether your display is compatible check that it has the following 11-way pin header:

BL SDCS D/C RST CS MOSI MISO SCK GND 3V3 VIN

The Adafruit displays all include an LDO 3.3V regulator and logic-level translation, so can be safely interfaced to processors powered from either 5V or 3.3V. They also include an SD-card socket, and a separate SDCS select line for the SD card.

AliExpress displays

The Universal TFT Display Backpack is also compatible with the following displays available from AliExpress and other Chinese suppliers:

Manufacturer Size Width Height Voltage Driver Link
AliExpress 1.44" 128 128 3.3V ST7735S 1.44" 128x128 SPI TFT display
AliExpress 0.96" 160 80 3.3V ST7735 0.96" 80x160 SPI TFT display
AliExpress 1.8" 160 128 3.3V ST7735 1.8" 128x160 SPI TFT display
AliExpress 1.14" 240 135 3.3V ST7789 1.14" 240x135 SPI TFT display
AliExpress 1.54" 240 240 3.3V ST7789 1.54" 240x240 SPI TFT display
AliExpress 1.9" 320 170 3.3V ST7789 1.9" 320x170 TFT LCD Display
AliExpress 1.47" 320 172 3.3V ST7789 1.47" 172x320 Round Rectangle TFT LCD Display
AliExpress 2.4" 320 240 3.3V ILI9341 2.4" 320x240 TFT Display Module

Use the 8-way row of pins for AliExpress displays. To ensure that your display is compatible, check that it has the following 8-way pin header:

GND VCC SCL SDA RES DC CS BLK

Some of the AliExpress displays include a LDO 3.3V regulator, but none of them include logic-level translation, so I recommend only interfacing them to a processor running from 3.3V.

Here's the backpack with an AliExpress 1.8" 160x128 TFT display:

TFTBackpackLuminance.jpg

The Universal TFT Backpack driving an AliExpress 1.8" 160x128 TFT display.

Display header pins

The header pin holes are staggered, with each hole shifted 8 mil (~0.2 mm) off-centre. This allows you to push the display's pin headers in place, and they will stay firmly connected without soldering. To remove them press evenly with a suitable flat object. Of course you also have the option of soldering them if you prefer, for a permanent solution.

Circuit

Here's the circuit of the Universal TFT Display Backpack:

MultiTFTDisplay.gif

Circuit of the Universal TFT Display Backpack using an ATtiny414.

If you're using an Adafruit display you can power the backpack from 3.3V to 5V, but if you're using an AliExpress display you should use 3.3V.

The processor can be any of the 0-series, 1-series, or 2-series ATtiny range in a 14-pin SOIC package, from the ATtiny404 to the ATtiny3224, but note that the timer crystal is only supported by a 1-series or 2-series device. They are all software compatible, so the same program will work on any of them. My Tiny TFT Graphics Library 2 needs more than 2Kbytes so I don't recommend using the ATtiny204 or ATtiny214, which only have 2Kbytes of program memory.

The 10kΩ pullup resistor on reset is only needed on AliExpress displays; on the Adafruit displays it's included on the board.

The crystal and associated capacitors are optional, and you only need to fit them if you want to use the timer on a 1-series or 2-series device for accurate timing. To calculate the capacitor values I used the formula C = 2(CL - CS), where CL is the load capacitance 6pF, and CS is the stray capacitance which is usually estimated to be 2.5pF on a PCB. This gives C=7pF. I used the closest available value, 6pF.

► Parts list

Construction

I designed a PCB in Eagle and sent it to PCBWay for production. There's a link at the end of the article you you want to make yourself some boards.

I used a Youyue 858D+ hot air gun at 275°C and Chip Quik SMD291AX10 solder paste to solder the SMD components onto the front of the board, but if you don't have a hot air gun or reflow oven you should be able to solder the SMD components with a bit of care using a fine-tipped soldering iron and fine solder, or solder paste. Most of the components are 0805 size, with a lead spacing of 1.65mm (0.065in). The component with the smallest spacing is the SOIC processor, which has a lead spacing of 1.27mm (0.05in).

If you want to control the backlight, or use the SD-card socket on the Adafruit displays, fit 0Ω resistors in the appropriate positions to act as links. Alternatively PA5 and PA6 are available on header pins D1 and D2 for other uses.

TFTBackpack.jpg

The assembled Universal TFT Display Backpack board.

Using the graphics library

The Universal TFT Display Backpack is ideal for use with my Tiny TFT Graphics Library 2, which is optimised for use with ATtiny microcontrollers such as the ATtiny414. You could also use my Compact TFT Graphics Library which uses standard Arduino SPI routines, but I'm not sure why you would want to as it's not as fast as the Tiny TFT library.

To adapt the library to the different pin position of the CS pin on the ATtiny404 or ATtiny414, edit the assignments at the top of the program to:

// ATtiny402/412 PORTA positions. Change these for the chip you're using
int const dc = 7;
int const mosi = 1;
int const sck = 3;
int const cs = 4;

Backlight

If you've fitted the leftmost 0Ω link resistor, you can use PA5 (Arduino pin 1) to control the display backlight. For example, to turn the backlight off:

digitalWrite(1, LOW);

To dim the backlight to half brightness:

analogWrite(1, 127);

Crystal

I'll give some examples of using the crystal for accurate timing in future projects.

Compiling the graphics library

Compile the program using Spence Konde's megaTiny Core on GitHub. Choose the ATtiny3224/1624/1614/1604/824/814/804/424/414/404/241/204 option under the megaTinyCore heading on the Board menu. Check that the subsequent options are set as follows (ignore any other options):

Chip: "ATtiny414" (or as appropriate)
Clock: "20 MHz internal"
millis()/micros() Timer: "Enabled (default timer)"

Then upload the program to the Universal TFT Display Backpack using a UPDI programmer. The recommended option is to use a USB to Serial board, such as the SparkFun FTDI Basic board [1], connected with a 4.7kΩ resistor as follows:

SerialUPDIProgrammer.gif

Set the Programmer option to "SerialUPDI with 4.7k resistor or diode (230400 baud)".

Resources

Get the Eagle files for the PCB here: https://github.com/technoblogy/universal-tft-display-backpack.

Or order boards from OSH Park here: Universal TFT Display Backpack.

Or order boards from PCBWay here: Universal TFT Display Backpack.

Update

26th October 2022: Added support for the 1.47" 320x172 Round Rectangle displays available from Adafruit or AliExpress.


  1. ^ SparkFun FTDI Basic Breakout - 5V on Sparkfun.

blog comments powered by Disqus