How to Mirror the Desktop of RPI OS on Any St7789 Spi Display on a Raspberry Pi

by quitox in Circuits > Raspberry Pi

61 Views, 1 Favorites, 0 Comments

How to Mirror the Desktop of RPI OS on Any St7789 Spi Display on a Raspberry Pi

IMG_2784.jpg

In this instructables, I'm going to show you how to mirror/copy the desktop from Raspberry pi OS (64bit) to any st7789 spi display (other drivers not tested). We are going to use the Raspberry-Pi-Installer-Scripts. Let's begin!

Supplies

  1. Raspberry pi, I'm using a pi3
  2. Any st7789 SPI screen, I'm using this one
  3. Some cables

Enable SSH

Vidéo sans titre ‐ Réalisée avec Clipchamp.gif
Vidéo sans titre ‐ Réalisée avec Clipchamp (1).gif

First, you need to have a fresh install of Raspberry pi OS 64 bit Desktop. We are going to use SSH, to activate it go to preferences --> interfaces --> SSH.

After this, check your IP adress to connect to the raspberry pi via SSH

Connect to SSH

Vidéo sans titre ‐ Réalisée avec Clipchamp (2).gif

Now you can connect to your Raspberry pi, to do it, I'm using Putty.

To use this software, after you installed it, enter the IP adress previously get, click open. A window appear, click accept.

Now you are connected to the Raspberry pi

  1. Enter your Username --> click enter
  2. Enter your password (for security, no letter appear) --> click enter

Connect Your Spi Screen to the Rapsberry Pi

b70fa8e4-27dc-4771-b91f-869b715b367f.__CR0,0,970,600_PT0_SX970_V1___.jpg

Screen connection:

  1. Reset is not connected
  2. CS -> CE0 (GPIO 7)
  3. SCLK (or CLK) -> SCLK (GPIO 11)
  4. MOSI (or DIN) -> MOSI (GPIO 10)
  5. BLK (or BL) -> GPIO 22 (can be configured in the config.txt)
  6. DC -> GPIO 25 (can be configured)
  7. VCC -> 3.3V
  8. GND -> GND

Update

First, we need to update and upgrade the raspberry pi:

sudo apt-get upgrade && update

Then REBOOT:

sudo reboot

Install Some "Prepare Your System" Stuff

Give you the root access and Create a new folder for our project in the root folder:

sudo -i
mkdir spi_screen

Install python3-pip:

apt-get install python3-pip

Because we need pip command, we'll going to use virtual environment (venv) since you can't install libraries directly into the system version of Python for RPI OS Bookworm.

Go in this folder and create the "venv" environment and start it:

cd spi_screen
python3 -m venv env
source env/bin/activate

Now we can install some dependencies:

pip3 install --upgrade click
pip3 install --upgrade setuptools
pip3 install --upgrade adafruit-python-shell

Then Desactivate the "venv" environment:

deactivate

Get the Adafruit Installer Scripts

Clone the reppo of adafruit

git clone https://github.com/adafruit/Raspberry-Pi-Installer-Scripts
cd Raspberry-Pi-Installer-Scripts

Install the Drivers + Mirroring

Adafruit give us several script for diffferent components, we are going to use python3 adafruit-pitft script:

python3 adafruit-pitft.py

Now when the script execute, it give you several choice for your display we are going to use the 7th option (ST7789V 2.0" no touch (320x240)):

  1. tap "7"+enter


Select the rotation of your screen, for me 90 degrees so 1st option:

  1. tap "1"+enter


Then , the most important option, do you want to:

  1. copy/mirror the desktop (HDMI output) on your screen
  2. execute the console (exactly like putty) on your scrren
  3. Or only install the st7789 driver (nothing will happen on your screen if you don't give it any programm)


Cause this instructables is for mirroring the desktop we are going to use the 1st option:

  1. tap "1"+enter

Configure Your Screen

IMG_2788.png
Capture d’écran 2026-02-09 123926.png

As you can see on the picture, after rebooting, the display seems broken. That's totally normal, in fact, since this script was created for Adafruit screen, the resolution is almost never exactly right for our display. To correct that, we are going to edit the config.txt file of your raspberry pi OS:

sudo nano /boot/firmware/config.txt

Scroll down until you see something like this:

# --- added by adafruit-pitft-helper Mon Feb 9 12:04:45 2026 ---
[all]
hdmi_force_hotplug=1 # required for cases when HDMI is not plugged in!
dtparam=spi=on
dtparam=i2c1=on
dtparam=i2c_arm=on
dtoverlay=mipi-dbi-spi,spi0-0,speed=40000000
dtparam=compatible=adafruit_st7789_drm\0panel-mipi-dbi-spi
dtparam=width=240,height=320
dtparam=dc-gpio=25,backlight-gpio=22,drm
# --- end adafruit-pitft-helper Mon Feb 9 12:04:45 2026 ---

You need to edit this line by replacing 240 and 320 by the resolution of your display:

dtparam=width=XXX,height=YYY

Save your modification (ctrl+"v" + enter)

And reboot:

sudo reboot

Well done, it should work properly!

If your screen do weird thing try to swap the XXX an YYY resolution, if it doesn’t get better follow the next step

Issue With the Screen

IMG_2787.jpg
IMG_2784.jpg

In my case, I was a little bit disappointed after searching on the internet to rectify the offset I had.

So I searched in the script file and I noticed this command:

"90": "width=240,height=240,x-offset=80"

Amazing! We just need to add the x-offset and y-offset to the config.txt:

sudo nano /boot/firmware/config.txt

Re-Edit the previous line and add your offsets:

dtparam=width=XXX,height=YYY,x-offset=XX,x-offset=YY

Reboot

sudo reboot

And it should work properly.

For Another Driver Than ST7789

I don't have others displays than an st7789 driver, but if you search in the script file you can found other drivers that will certainly work.

BTW here are my sources:

https://github.com/adafruit/Raspberry-Pi-Installer-Scripts

https://github.com/Teneppa/Raspberry-Pi-5-ST7789-usage

https://www.raspberrypi.com/documentation/computers/os.html