This guide walks you through the exact steps needed to get a Waveshare 4-inch HDMI LCD (800×480) working on a Raspberry Pi (headless), including Wi-Fi/SSH setup, display configuration, and touchscreen overlay. By following these instructions—along with the links below—you’ll be able to reproduce this configuration on your own Pi.
- Raspberry Pi (any model with HDMI output)
- microSD card (≥8 GB)
- Waveshare 4″ HDMI LCD (800×480)
- micro USB power supply (≥2 A recommended)
- A computer (Windows/macOS/Linux) with:
- SD-card reader
- Text editor (e.g., Sublime, VS Code, Notepad++)
-
Download the latest Raspberry Pi OS image from the official Raspberry Pi website:
- https://www.raspberrypi.com/software/ (choose “Raspberry Pi OS Lite” for a headless setup)
-
Flash the image to your microSD card using Raspberry Pi Imager or BalenaEtcher:
- Raspberry Pi Imager: https://www.raspberrypi.com/software/
- BalenaEtcher: https://www.balena.io/etcher/
-
Once flashing completes, eject and re-insert the microSD card. It should mount on your computer as a drive named
boot.
These two steps let your Pi connect to Wi-Fi on first boot and enable SSH access.
-
Create
wpa_supplicant.confIn your preferred text editor, paste:country=US ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="YOUR_WIFI_SSID" psk="YOUR_WIFI_PASSWORD" }Replace
YOUR_WIFI_SSIDandYOUR_WIFI_PASSWORDexactly (case-sensitive).Change
country=USto your two-letter ISO country code if you’re not in the U.S. (e.g., GB, DE, DK).Save the file as
wpa_supplicant.confto the root of thebootpartition (the same folder asconfig.txt). -
Create an empty
sshfile (no extension) in the root of thebootpartition.On Windows: Right-click → New → Text Document → Rename to
ssh(remove.txt).On macOS/Linux:
touch /Volumes/boot/ssh
This blank file tells Raspberry Pi OS to enable the SSH server on first boot.
The Waveshare 4″ HDMI LCD requires a custom HDMI mode + optional touchscreen overlay. Edit the existing config.txt on the boot partition as follows:
-
Open
/boot/config.txtin your text editor. -
Scroll down to the bottom and add (or replace) these lines under the
[all]section (create[all]if it isn’t already there):[all] # Use a custom HDMI mode for 800×480 @ 60 Hz hdmi_group=2 hdmi_mode=87 hdmi_cvt=800 480 60 6 0 0 0 hdmi_drive=2 # Rotate the display 90° clockwise (adjust if you want a different orientation) display_rotate=1 # Enable GPIO 18 to control the backlight (Waveshare’s wiring) gpio=18=op,dh
hdmi_group=2+hdmi_mode=87+hdmi_cvt→ forces Pi to output 800×480display_rotate=1→ rotates the screen upright (change to2/3/0as needed)gpio=18=op,dh→ configures GPIO 18 as an output and drives it HIGH at boot (powers the backlight)
-
Save and close
config.txt.
If your particular Waveshare model includes a resistive touchscreen controller (ADS7846), add the Device Tree overlay so the touchscreen works.
-
Download the
.dtbofile: Official wiki for Waveshare 4″ HDMI LCD: https://www.waveshare.com/wiki/4inch_HDMI_LCDUnder “Resources → Raspbian Driver,” locate and download
waveshare-ads7846.dtbo. -
Copy
waveshare-ads7846.dtbointo the Pi’s overlays folder: Insert the SD card if it’s not already mounted.Copy
waveshare-ads7846.dtboto:/boot/overlays/
-
Enable the overlay: Edit
config.txtagain (the same file in/boot/), and add this line below your HDMI settings:dtoverlay=waveshare-ads7846,penirq=25,xmin=150,xmax=3900,ymin=100,ymax=3950,speed=50000
This configures the ADS7846 touchscreen on GPIO 25 (
PENIRQ) and calibrates X/Y ranges.Adjust
xmin/xmax/ymin/ymaxif you need further calibration. -
Save/close
config.txt.
- Eject the microSD card safely from your computer.
- Insert it into your Raspberry Pi.
- Connect the OLED/HDMI cable from Pi → Waveshare LCD.
- Connect your micro USB power (≥2 A).
The LCD’s backlight should turn on automatically. You should see boot text on the screen (e.g., kernel messages).
SSH into your Pi (if Wi-Fi is configured):
ssh pi@<YOUR_PI_IP_ADDRESS>
# Default password: raspberryIf you’re unsure of the Pi’s IP, attach an HDMI monitor or check your router’s DHCP list.
No image on LCD:
- Double-check that
hdmi_cvt=800 480 60 6 0 0 0is correct and under[all]. - Make sure
hdmi_drive=2is present (enables HDMI sound/backlight). - Verify
gpio=18=op,dhif backlight stays off. - Try a different HDMI cable or port.
Touchscreen not responding:
- Ensure
waveshare-ads7846.dtbois in/boot/overlays/. - Confirm
dtoverlay=waveshare-ads7846,...is at the bottom ofconfig.txt. - Check GPIO 25 (“PENIRQ”) wiring.
- For further calibration, see Waveshare’s ADS7846 documentation: https://www.waveshare.com/wiki/4inch_HDMI_LCD
Headless/Wi-Fi issues:
- Make sure
wpa_supplicant.confis in/boot/. - Confirm SSID/PSK are correct (case-sensitive).
- Reboot Pi, then check router’s DHCP table for the Pi’s IP.
-
Waveshare 4″ HDMI LCD Wiki (official driver & .dtbo downloads): https://www.waveshare.com/wiki/4inch_HDMI_LCD
-
Raspberry Pi OS Download & Imager: https://www.raspberrypi.com/software/
-
Headless SSH & Wi-Fi Setup Guide (Raspberry Pi Foundation): https://www.raspberrypi.com/documentation/computers/configuration.html#configuring-networking-ssh-and-headless-operation