1. Buy 3.5 Inch HDMI Screen from following link:

Buy from OSOYOO Buy from US Buy from UK Buy from DE Buy from IT Buy from FR Buy from ES Buy from JP

2. Buy 3.5 Inch HDMI Screen with case:

Buy from US Buy from UK Buy from DE Buy from IT Buy from FR Buy from ES Buy from JP

Overview

The OSOYOO 3.5HDMI resistive touchscreen does not work properly when using the default Wayfire graphics system on the Raspberry Pi 4B and 5B. However, if you change the default graphics system on these models to X11, it will work fine.

The tutorial you mentioned for adapting the OSOYOO 3.5HDMI resistive touchscreen on the Bullseye system should still be applicable. However, the touchscreen functionality does not seem to work on Bookworm’s default Wayfire graphics system. If you want to adjust this resistive touchscreen to the default Wayfire graphics system in Bookworm, you may need to perform additional configuration steps. In this case, you may need to explore other methods or configurations to make the ADS7846 touchscreen compatible with Wayfire in Bookworm. It is recommended that you consult the official documentation or community forums for Bookworm and Wayfire for further assistance in adjusting the touchscreen.

Click here for more information about Bookworm.

Getting Started

Hardware Connection

Connect the GPIO and HDMI interface

Raspberry Pi leads out 40 GPIO pins, while the screen leads out 12 pins. When connecting, pay attention to the corresponding pins and Raspberry Pi pins.

Install image file

1) Install the Bookworm image as the official website or follow our tutorial.
2)After the image has finished writing, save and quit the TF card safely.
3) Insert the TF card into the Raspberry Pi, power on the Raspberry Pi, and wait for more than 10 seconds to display normally. But the touch is abnormal at that time, and the touch needs to be calibrated as the following steps.

Touch settings

Note: Recommend to remotely control Raspberry Pi via ssh, VNC or other remote desktop tools, as the resolution is too high as default. (Here we use putty for Windows users. You can learn more about remotely control Raspberry Pi from: https://osoyoo.com/?p=56660)
Step 1) Set to use X11 instead of Wayland,

1. Run the following commends firstly:
sudo raspi-config

2. Then select Advanced Options, then Wayland which now controls which backend to use for the desktop, then X11. Save your settings and reboot the Raspberry Pi. In Bookworm it now defaults to Wayland on the PI4 & soon PI5, so we need to switch it to W1 X11.



Step 2) Change the Screen Configuration
Use a mouse to control your screen, then Click the Raspberry Pi icon -> Preferences -> Screen Configuration, in the new window, click layout -> screen -> HDMI -> resolution -> 680×480, then click Apply, and click Yes in the new pop. We recommend setting the resolution to 640×480.
Note: Raspberry Pi OS Bookworm branch system, since dtoverlay=vc4-kms-v3d is loaded by default, it is invalid to modify the resolution in /boot/config.txt. 

Step 3) Add settings to the config.txt file
1. Run the following commend to edit config.txt. (Before installing xpt2046(ads7846) driver, we need to add settings to the config.txt file).

sudo nano /boot/config.txt

2. Add the following parameters at the end of the config.txt file

hdmi_group=2
hdmi_mode=87
hdmi_drive=1
hdmi_pixel_freq_limit=20000000
hdmi_cvt 480 320 60 6 0 0 0
dtoverlay=ads7846,cs=1,penirq=25,penirq_pull=2,speed=50000,keep_vref_on=0,swapxy=0,pmax=255,xohms=150,xmin=200,xmax=3900,ymin=200,ymax=3900

3. Press ctrl + X then Y, then enter to save this file, then run the following commend to reboot your Raspberry Pi

sudo reboot 

Step 4)Install xpt2046 driver, and calibrator by typing the following commends
sudo apt install xserver-xorg-input-evdev
sudo apt install -y xinput-calibrator


Step 5)Config touch calibration files

1. Run the following commends
sudo cp -rf /usr/share/X11/xorg.conf.d/10-evdev.conf /usr/share/X11/xorg.conf.d/45-evdev.conf
sudo nano /usr/share/X11/xorg.conf.d/99‐calibration.conf

2. Add the following parameters in 99-calibration.conf,

Section "InputClass"
Identifier "calibration"
MatchProduct "ADS7846 Touchscreen"
Option "Calibration" "211 3942 3905 141"
Option  "SwapAxes"  "1"
EndSection

3. Press ctrl + X then Y, then enter to save this file, then run the following commend to reboot your Raspberry Pi

sudo reboot

Step 6) Calibrate touch

a. Use mouse to control your screen, then click [Preferences]-[Calibrate Touchscreen] from main menu, (or enter DISPLAY=:0.0 xinput_calibrator in the terminal), click four crossbar points on corners, it will show the calibration values which are similar to previously written to the 99-calibration.conf file.

b. After calibration (click four cross bar points on corners), it will show the calibration values which are similar to previously written to the 99-calibration.conf file.

c. Edit 99‐calibration.conf file again by typing the following commend:

sudo nano /usr/share/X11/xorg.conf.d/99‐calibration.conf

d. Replace the following lines with new values shown in the calibration result (from step b). Check touch, repeat calibration if it is not correct.
Option  “Calibration” “211 3942 3905 141”
Option  “SwapAxes” “1”


Remark: Doing so means you are no longer using Wayland. Might a temporary solution only as all Pi’s will be ‘converted’ to use Wayland and then that option will be dropped most likely. Yes – it would be great if I could figure out how to calibrate within Wayland, but I just couldn’t find anything.

For now, Wayland is only the default on Raspberry Pi 4 and 5. The performance of Wayfire on earlier platforms is still being optimized, so for now they will continue to run the old X11 display server and the Openbox window manager, but at some point these platforms will also be switched to Wayfire.

We’ll be following the official Raspberry Pi posts and updating the tutorials!

How to verify that your X11 desktop system is running properly

You can tell which one you are running by using “echo $GDMSESSION” in a terminal.(Connecting to the system using SSH-like tools and executing this command will not produce any results.)
“LXDE-pi-wayfire” means Wayland.
“LXDE-pi-x” means X11