Saturday, February 5, 2022

Library for ST7735 TFT display driver for AVR microcontrollers

There are already some libraries for the ST7735 display driver such as the one from Adafruit but made only for Arduino. I needed one for AVR microcontrollers in general, so I made this one. With a bit of twiking it could also be adapted to work with other types of microcontrollers. This library is based on the one from Adafruit but with some functions removed, modified and others added. The interface needs 4 microcontroller pins and it uses SPI for communication.

Library for the ST7735 TFT display driver for AVR microcontrollers

Library for the ST7735 TFT display driver for AVR microcontrollers demo

There are many GUI elements that can be created and above are a few examples such as: selectable menus, scrollbars, check-boxes and animated icons. I made those in Inkscape for a battery charger project.

Contents:


Wiring the ST7735 TFT display

It is important to note that the power supply voltage for the ST7735 display driver is maximum 3.3V and same for the other input pins. Some TFT modules include a 3.3V regulator and a voltage level shifter in which case it can be used with 5V microcontrollers, if not some level shifting must be done if the microcontroller is not powered from 3.3V.

ST7735 connection diagram with voltage level shifter

This schematic is an example that also includes an SD card. Here, MISO is used for DC pin (Data/Command) since the ST7735 doesn't use the MISO in the 1-Wire SPI protocol, and also as MISO (Master In Slave Out) for the SD card. The 74AHC125D can't be used for this pin since is not bi-directional, hence the mosfet level shifter.

ST7735 connection diagram with voltage level shifters and pinout

1 - GND - ground power supply

2 - VCC - 3.3V power supply (minimum 150mA)

3 - SCL - SPI serial clock pin (SCK)

4 - SDA - SPI serial data input/output (MOSI)