TECH LOGICS – Part 2
Welcome back! In this complete, no-BS guide we’re turning your Raspberry Pi Zero 2 W into a gorgeous little portable display using the super-popular 3.5-inch 480×320 ILI9486 touchscreen (the cheap one from AliExpress/eBay that everyone uses).
By the end you’ll have:
- A perfectly working touchscreen display
- A beautiful colorful text demo
- Everything auto-starting on boot (next tutorial)
Let’s go!
What You Need
- Raspberry Pi Zero 2 W
- MicroSD card with Raspberry Pi OS Lite (Bookworm recommended)
- 3.5-inch ILI9486 TFT LCD (480×320, SPI, GPIO-connected)
- SSH access (already set up in Part 1)
- Decent 5V power supply
Step 1: Hardware Assembly
- Power off your Pi completely
- Line up the display with the 40-pin GPIO header (Pin 1 → Pin 1)
- Gently push it straight down until fully seated
- Plug power back in → white backlight should turn on immediately
Step 2: Update Your Pi (SSH)
Connect via SSH (ssh admin@192.168.1.33 – change IP to yours)
Bash
sudo apt update
sudo apt full-upgrade -y
sudo reboot
Log back in after reboot.
Step 3: Install the Correct ILI9486 Driver (One Block – Just Paste!)
Bash
cd ~
sudo rm -rf LCD-show
git clone https://github.com/goodtft/LCD-show.git
cd LCD-show
chmod +x LCD35-show
sudo ./LCD35-show
The Pi will reboot automatically. When it comes back (~60 seconds), you should see the Raspberry Pi desktop or a black screen on your new LCD – success!
Step 4: Verify Framebuffer & Permissions
Bash
ls -l /dev/fb*
You should see both /dev/fb0 and /dev/fb1 Give your user permission to write to the LCD:
Bash
sudo usermod -a -G video admin
Step 5: Install Pygame
Bash
sudo apt install -y python3-pip
pip3 install --user pygame==2.6.1
Step 6: Clean Boot (No Splash, No Text)
Bash
sudo raspi-config
→ 1 System Options → S1 Splash Screen → Choose No → Finish → Reboot when asked
Step 7: Create the Beautiful Colorful Text Demo
Bash
nano ~/lcd_demo.py
Paste this entire script (copy it from below – also in the description):
Python
#!/usr/bin/env python3
import os
import pygame
import struct
os.environ['SDL_VIDEODRIVER'] = 'dummy'
os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = '1'
pygame.init()
screen = pygame.Surface((480, 320))
screen.fill((0, 0, 60)) # dark blue background
# Fonts
f80 = pygame.font.SysFont('freesansbold', 80)
f60 = pygame.font.SysFont('freesansbold', 60)
f50 = pygame.font.SysFont('freesansbold', 50)
f40 = pygame.font.SysFont('freesansbold', 40)
f30 = pygame.font.SysFont('freesansbold', 30)
# Colors
YELLOW = (255, 255, 0)
CYAN = (0, 255, 255)
MAGENTA = (255, 0, 255)
GREEN = (0, 255, 0)
RED = (255, 0, 0)
ORANGE = (255, 160, 0)
WHITE = (255, 255, 255)
def put(text, font, color, y_center):
s = font.render(text, True, color)
r = s.get_rect(center=(240, y_center))
screen.blit(s, r)
put("LCD TEST", f80, YELLOW, 55)
put("Pi Zero 2 W", f60, CYAN, 120)
put("3.5 inch TFT", f50, MAGENTA, 175)
put("Different", f40, GREEN, 220)
put("Fonts & Colors",f40, ORANGE, 260)
put("Working 100%", f30, WHITE, 305)
# Convert and write to /dev/fb1 (exactly like your working clock)
fb = open('/dev/fb1', 'wb')
def rgb565(r, g, b):
return ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3)
pixels = pygame.image.tostring(screen, 'RGB')
buffer = bytearray(480 * 320 * 2)
i = 0
for p in range(0, len(pixels), 3):
c = rgb565(pixels[p], pixels[p+1], pixels[p+2])
buffer[i:i+2] = struct.pack('<H', c)
i += 2
fb.seek(0)
fb.write(buffer)
fb.flush()
fb.close()
# Keep script running (so it stays on screen after boot)
try:
while True:
pygame.time.wait(10000)
except KeyboardInterrupt:
pass
Save: Ctrl + O → Enter → Ctrl + X
Step 8: Run It!
Bash
chmod +x ~/lcd_demo.py
python3 ~/lcd_demo.py
BOOM! Your 3.5-inch screen is now showing bright, colorful text in different fonts and sizes – 100% proof everything works perfectly!
(Press Ctrl + C to stop)
What’s Next?
Part 3 → Auto-start this (or any script) on boot Part 4 → Live clock, network monitor, YouTube subs counter, stock ticker…
Smash that LIKE button if this worked for you, drop a comment saying “It works!” and subscribe with the bell on – we’re just getting started!
See you in the next one! TECH LOGICS – Real projects. Real results. No fluff.












Leave a Reply