Introduction: Adding CS Pin to ST7789 1.3" IPS LCD
Recently I came across a low cost 1.3" IPS TFT screen. It has very high resolution of 240x240 pixels and very high pixel density due to its small size. It is a IPS panel, IPS stands for InPlane Switching. These are higher end type of LCD screens which have great viewing angles and better color reproduction than traditional TFT+TN/CSTN type LCD's. Thats why its one of my favorite LCDs.
It uses the SPI Interface to communicate with the microcontroller or a SOC.
Standard SPI uses 4 wires to communicate:
1) MOSI -> Master Out Slave In
2) MISO -> Master In Slave Out
3) SCK -> Serial Clock
4) CS/SS -> Chip Select/Slave Select
The SPI allows multiple devices on the bus and the active device is selected by pulling the chip select line LOW. This display does not have the chip select line broken out to the headers.
You may ask why bother hacking the CS line? Well that depends on application. If you have the display as the only device on the SPI bus then that's fine. The display will still work, although if you want to use some other device on the SPI bus such as a SD card adapter then you are out of luck as they both require separate CS lines in order to talk to the slave device. That is why we are going to get the CS line out of the module.
This module has total of 7 pins:
1) BLK = Backlight
2) D/C = Data/Command
3) RES = Reset
4) SDA = Serial Data or SPI MOSI
5) SCL = Serial Clock or SPI SCK
(Do not get confused with the I2C pins SDA and SCK, this screen is not I2C.)
6) VCC (3.3V)
By connecting the BLK pin to VCC we can enable the LED backlight of the screen but this pin is useless unless you want to control the backlight by software. But we can use this extra pin as a CS pin by removing the trace from the ribbon of the LCD.
1) Sharp cutter or knife.
2) Soldering Iron
3) Jumper wire or wire wrapping wire (>28AWG)
4) Hot glue gun (Optional)
Step 1: Interrupting First Trace
First get yourself a sharp cutter. Then cut the trace as shown in the picture. Do this carefully as the screen is fragile and do not let the cutter slip and damage the ribbon cable. After interrupting the trace make sure the BLK pin is disconnected from the resistor R2 below this trace with the help of multimeter in continuity mode.
Step 2: Adding Solder Pads
Again with the help of the cutter, carefully scrape away the solder mask in the three places shown in the picture. Be careful not to expose the neighbouring traces, doing so will make the soldering more difficult later. Scrape it until you see the bare copper. It should be big enough to solder the jumper wires which we will solder later.
Then tin these exposed copper pads with some fresh solder.
Step 3: Interrupting Second Trace
I recommend using a temperature controlled iron for the next step. Set the iron to around 350C to avoid breaking small solder pads for the LCD. I am going to use my trusty TS100 for this. Start by adding some fresh solder to the ribbon connecter solder pads. And starting from any one side gently pull the ribbon upwards to remove solder joint one at a time. Be very gentle! This ribbon is very fragile. bending it too much will break the internal traces. Now after removing the ribbon, cut the trace going from the 5th trace from the left side. This is our CS line, permanently tied to GND. Cut along the bottom side of the trace from the ground flood fill. After interrupting make sure this is disconnected from the GND pin.
After it is done, resolder the ribbon to the PCB and check all connections with multimeter.
Step 4: Adding Jumper Wires
Get some fine jumper wires (solid core recommended) and tin the stripped ends. Connect one wire from the BLK Header trace to the CS trace of the ribbon and one wire from VCC to the backlight trace.
This will tie the backlight to VCC and connect the free header to CS.
Add some hot glue on the wires and connections after checking.
Step 5: Test :)
Test the TFT with your favorite MCU.
10 months ago on Step 4
Hi, can we use 2 st7789 at the same time with TFT_eSPI library with this? I'm trying to do a project but needed second display on Esp 32
Reply 10 months ago
Yes you can. There are two methods actually,
First method would be to simply use two different SPI ports on the ESP32 (VSPI and HSPI) such that you don't need any hardware modification, you just have to modify the software driver. Refer GitHub for the same.
Second method would be to add the CS pins and use the same SPI port shared between the two displays. But this has the disadvantage of being slower than two dedicated ports.
Reply 10 months ago
Thanks. I figured it out 🙂
11 months ago
Thanks! Adding the CS pin allowed the Pico Pic to use this display with Bodmer's awesome Arduino graphics library TFT_eSPI. See the above link. Thanks again! Bill
Reply 11 months ago
That's awesome Bill!
TFT_eSPI is great with ESP32 and RP2040. I am using it in couple of my projects, its been fantastic. I now use it with my STM32 boards. With DMA transfer, it reaches 75+ FPS real-time with -O2 optimization on STM32F4.
long time ago I created this power logger with esp32, that's when I first came across TFT_eSPI.
Next time avoid those cheap displays without the CS pin. The 320x240 Waveshare version display is much better.
https://www.waveshare.com/2inch-lcd-module.htm (I am not affiliated with them in any way, just sharing for info)
Reply 11 months ago
You might find this interesting also. That is a workaround for TFT_eSPI where you don't need to make the hardware change:
It seems the displays work when set to use SPI Mode 2.
(75FPS with a micro is really impressive.)
2 years ago
This is very useful instruct because i was trying to add a TFT screen to my existing ESP project which already use several SPI devices on the bus and it wasn't possible without CS pin.
I have only 1 question - how did you know that 5th leg is the CS? :) I've found only this picture which look very similar to what i've probed.
Reply 2 years ago
Thanks for your reply, I'm glad you found it useful :)
Basically upon googling I found aliexpress seller who was selling the bare LCD module (without the breakout PCB) and on that page there was pinout for the LCD flat flex which was similar to the LCD interface soldered on the breakout board on the module which I had laying around, so I used my multimeter to buzz out which pins were shorted to ground (because usually CS pin is active low) and found the matching pin and traced the track and then cut it to find it was working perfectly :D
3 years ago
Thank you for sharing : )
Reply 3 years ago
I'm glad that you found it useful. This is my first instructable :D