Examples for Pimoroni's HyperPixel 4.0 Square high-resolution, high-speed, 4.0" display with optional touchscreen for Raspberry Pi written in Python 3.
Python | Description |
---|---|
3.7 | development on macos |
3.9 | testing on Raspberry Pi Zero |
3.9 | testing on Raspberry Pi 4 |
- Tkinter
- HyperClock
- HyperCoin
- HyperStream Raspberry PI 4 only
- HyperWeather API Key from openweathermap.org needed
- HyperHolidays
- HyperTimeWeather API Key from openweathermap.org needed
- HyperText
- Kivy
- HyperCarousel
- HyperVideoCarousel Raspberry PI 4 only
You can adapt, improve and use the code for your projects as you wish. The author of this repository take no responsibility for your use or misuse or any damage on your devices!
You can run all examples in this form.
# change into HOME
$ cd ~
# clone repository
$ git clone https://github.com/Lupin3000/HyperPixel-4.0-Square.git
# change into example (eq. clock)
$ cd ~/HyperPixel-4.0-Square/tk_modules/
# execute (stop with <ESCAPE>)
$ python3 hyperclock.py
Please note that the fonts are only available for private use (see www.1001freefonts.com)!
# create directory
$ mkdir ~/.fonts
# copy all fonts
$ cp ~/HyperPixel-4.0-Square/*.ttf ~/.fonts/
# create directory
$ mkdir -p ~/.config/autostart
# create desktop file
$ touch ~/.config/autostart/display.desktop
Example for display.desktop
[Desktop Entry]
Type=Application
Name=HyperWeather
Exec=/usr/bin/python3 ~/HyperPixel-4.0-Square/tk_modules/hyperweather.py
On bullseye you don't need to install any library/package for Hyperpixel! Also, i2c don't need to be enabled.
The only thing you need to do, is to add one line in /boot/config.txt
.
# start editor
$ sudo vim /boot/config.txt
Example of /boot/config.txt
to enable hyperpixel display:
# Enable DRM VC4 V3D driver
dtoverlay=vc4-kms-v3d
dtoverlay=vc4-kms-dpi-hyperpixel4sq
Restart the device and the display should work!
# install via pip from file
$ pip3 install -r requirements.txt
# verify installed pip packages (optional)
$ pip3 freeze
Depend on API you like to use!!!
# minimum needed packages
$ sudo apt install espeak python3-pyaudio
# optional or if issues (sphinx)
$ sudo apt install flac pavucontrol libportaudio2 libportaudiocpp0 portaudio19-dev
$ sudo apt install swig libpulse-dev bison libasound2-dev alsa-utils gcc python3-pocketsphinx
# list playback hardware devices
$ aplay -l
# list capture hardware devices
$ arecord -l
If you failed and see error like "No module named cv2"
# update apt and install needed apt packages
$ sudo apt update && sudo apt install python3-opencv
# verify installation (optional)
$ python3 -c "import cv2"
If you failed and see error like "cannot import name ImageTk from PIL"
# update apt and install needed apt packages
$ sudo apt update && sudo apt install python3-pil python3-pil.imagetk
# verify installation (optional)
$ python3 -c "from PIL import ImageTk"