How I solved the functioning problems of the
1.8” display with ST7735 controller
Giovanni Carrera, 03/03/2025
I had already used, with success, this type of
display with the Raspberry PI Pico board using MicroPython, now I wanted to use
it with a STM32F103C8T6 mounted on the board, now known as bluepill.
The display is a cheap 1.8-inch 160×128 pixel
TFT with 18-bit for 262k colors with 6-bit encoding per color. The control chip
used for this display is a Sitronix ST7735S and the interface is SPI with a few
more control pins.
To develop with the Arduino IDE with STM32 MCUs
you need to download the STM32duino package, an operation that I won't describe
here because you can easily find it online.
As libraries for the display I initially used
the Adafruit_ST7735.h library together with the Adafruit_GFX.h, I had already
used these with the ESP32. I preferred to use STMs because they consume less
and the boards have good LDO regulators and can also be powered by a lithium
ion cell.
As soon as I wrote the program with version
2.3.3 of Arduino IDE, numerous warnings appeared due to the fact that the new
version prefers to indicate boolean variables with the simple ‘bool’, but these
do not prevent compilation. The program, once transferred to the board via
serial, did not run. The display was on but appeared white. I wasted a lot of
time trying to understand the cause: was it the fault of the SPI bus
initialization or the pins used?
In the end I tried to use the Arduino TFT
library and I started to see something good on the screen, so the problem was
not the hardware but the software. I do not know why but the Adafruit libraries
do not work with ST processors.
The schematic of my system
Figure 1 shows the circuit I used. To power the
display, 3.3V and not 5V are needed and, since the current is not negligible, I
preferred to use an external regulator with a very low drop-out, discarding the
classic LM1117 that would require a power supply of at least 4.5V. I preferred
not to load the 3.3V output of the bluepill.
Also to reduce consumption, I control the
backlight LED with a transistor so as to turn it on and off only when needed. I
put both the display and the SD slot on the same SPI bus.
If you want a higher brightness (but also
consumption) of the display you can short-circuit the resistor R1.