My plan was to use the Python code developed from the Billboard project to create the screen animation. In 2018, I had developed working python scripts that produced the screen animation. A simple change of images would have the the tv screen working. NOT!
The Billboard code was developed in Python version 2. The default Python language on the Raspberry Pi O/S is Python version 3. My skills with Python are more of a resurrectionist than a programmer. The instruction to duplicate the Billboard environment using Python3 didn’t work.
My first hurdle was to learn about Python3 and virtual environments. My lack of knowledge resulted in this post.
No response to my post left me to combing Google search results to understand the virtual environment. This link gave me the much needed insight to start assembling the software components to build a script.
With a Python environment that worked, I abandoned the Billboard code and decided to start over by looking at what the hardware vendor had to offer. It didn’t work, CRAP!
A full eight hour day of wash, rinse and repeat of code development by researching error code, left me with this cropped history file of commands that produced a working display.
#Corner stone of working with Pi software: sudo apt update sudo apt upgrade # Using the Raspberry Pi O/S configuration tool to enable SPI, IC2 and auto login sudo raspi-config #Setting up virtual environment: mkdir tvscreen/ cd tvscreen python3 -m venv tvscreen cd tvscreen source bin/activate #Python package requirements python3 -m pip install --upgrade pip sudo apt install libjpeg-dev zlib1g-dev python3 -m pip install --upgrade setuptools wheel sudo apt install build-essential python3-dev sudo ldconfig python3 -m pip install Pillow python3 -m pip install st7789 python3 -m pip install rpi.gpio
Final listing of Python software installs:
pip list
Package Version
---------- -------
gpiod 2.3.0
gpiodevice 0.0.5
numpy 2.2.5
pillow 11.2.1
pip 25.1.1
RPi.GPIO 0.7.1
setuptools 80.3.1
spidev 3.6
st7789 1.0.1
wheel 0.45.1
Let test it.
#https://github.com/pimoroni/st7789-python The instructions on the page don’t work but the examples we can use for testing.
unzip st7789-python-main.zip
cd st7789-python-main/examples/
./gif.py deployrainbows.gif square
I created a gif file from some television test pattern images and used the example code to produce the output.
#Modify the example file above to work in my scenario
gif.py
old: #!/usr/bin/env python3
new: #!/home/pi/tvscreen/bin/python3
old: rotation=0 if display_type == "rect" else 90,
new: rotation=0 if display_type == "rect" else 270,
old: time.sleep(0.05)
new: time.sleep(3)
#run inside an autologin terminal window
add at bottom of .bashrc
python3 /home/pi/tvscreen/tvscreen/gif.py /home/pi/tvscreen/tvscreen/tvscreen.gif square
Top Comments