Create Rasberry Pi TV

Prerequisite:
– A lot of the files you will need are here on my github
– Raspberry Pi 3
– 3.5 inch IPS 480×640 Display 
– GPIO Ribbon Cable 40Pin Male to Female

Installing Raspberry Pi:

using version: 2023-05-03-raspios-buster-armhf.img
You will need to install the raspberry pi OS.
SSH into your pi then run
sudo raspi-config
Step down to Interface options then SPI option and enable it.

Set up screen 3.5 :

SSH into your rasberry pi

Clone the repo to your desktop

git clone https://github.com/djmason9/LCD-show.git

cd LCD-show/
chmod +x LCD35-show
./LCD35-show
https://www.waveshare.com/wiki/2.8inch_DPI_LCD

Download the 3.5inch DPI LCD DTBO file and extract the dtbo files. Copy these files to the overlays directory (/boot/overlays/).
wget https://files.waveshare.com/upload/e/e4/3.5DPI-dtbo.zip

unzip contents and move them to the /boot/overlays

dtoverlay=vc4-kms-v3d
dtoverlay=vc4-kms-DPI-35inch
dtoverlay=waveshare-35dpi-3b-4b
dtoverlay=waveshare-35dpi-3b
dtoverlay=waveshare-35dpi-4b
dtoverlay=waveshare-35dpi
dtoverlay=waveshare-touch-35dpi

Configure Config

sudo nano /boot/config.txt

Open the /boot/config.txt file in the root directory of the TF card, add the following code at the end of config.txt, save


#####################################
#3.5 inch display
######################################
dtparam=audio=on
dtoverlay=audremap,enable_jack,pins_18_19

gpio=0-9=a2
gpio=12-17=a2
gpio=20-25=a2
dtoverlay=dpi18
enable_dpi_lcd=1
display_default_lcd=1
extra_transpose_buffer=2
dpi_group=2
dpi_mode=87
dpi_output_format=0x6f006
hdmi_timings=640 0 20 10 10 480 0 10 5 5 0 0 0 60 0 60000000 1
dtoverlay=waveshare-35dpi-3b-4b:rotate=0
dtoverlay=waveshare-35dpi-3b:rotate=0
dtoverlay=waveshare-35dpi-4b:rotate=0
display_rotate=0

avoid_warnings=1
gpu_mem=64

convert your video
https://github.com/djmason9/Gif_To_Code_Array
Details on how
https://www.raspberrypi.com/news/this-teeny-tiny-tv-plays-the-simpsons-all-day-every-day/

Upload your player and video files

mkdir videos

https://github.com/djmason9/Pi-Video-Encode

install
sudo apt install mpv

To run the video

python3 player.py

Auto start player

sudo nano /etc/systemd/system/player.service

[Unit]
Description=Start Python Video Player
After=bluetooth.target pulseaudio.service

[Service]
ExecStart=/usr/bin/python3 /home/pi/Desktop/player.py
Restart=always
User=pi
Environment=”DISPLAY=:0″ “XAUTHORITY=/home/pi/.Xauthority” “PULSE_RUNTIME_PATH=/run/user/1000/pulse/”

[Install]
WantedBy=multi-user.target

Set up auto start

sudo systemctl daemon-reload
sudo systemctl enable player.service
sudo systemctl start player.service

Disable annoying voltage banner
sudo apt remove lxplug-ptbatt