element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Spring Clean!
  • Challenges & Projects
  • Project14
  • Spring Clean!
  • More
  • Cancel
Spring Clean!
Projects Turn on the TV: The toughest part for last coding
  • News
  • Projects
  • Forum
  • Members
  • More
  • Cancel
  • New
Join Spring Clean! to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: colporteur
  • Date Created: 10 May 2025 11:27 PM Date Created
  • Views 910 views
  • Likes 7 likes
  • Comments 4 comments
  • python
  • lcd display
  • spring cleaning
Related
Recommended

Turn on the TV: The toughest part for last coding

colporteur
colporteur
10 May 2025

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

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

  • Sign in to reply

Top Comments

  • colporteur
    colporteur 5 months ago in reply to beacon_dave +1
    I posted at E14 my python environment issues figuring someone would have played in the space. The last time I looked there was nothing. Without a response I then set about discovering what I needed to…
Parents
  • dougw
    dougw 5 months ago

    Looking good. Congrats on your perseverance.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • dougw
    dougw 5 months ago

    Looking good. Congrats on your perseverance.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube