4.1 KiB
Volvo Display App
Setup
-
Install Python dependencies:
pip install -r requirements.txtOr if using system packages:
sudo apt install python3-pyside6 -
System Requirements (Linux/Raspberry Pi): PySide6 (Qt 6.5+) requires
libxcb-cursor0to be installed on Linux systems.sudo apt install libxcb-cursor0If you encounter other missing library errors, you may need additional Qt dependencies:
sudo apt install libxcb-xinerama0
Hardware Setup (Dallas DS18B20 Sensors)
To use real temperature sensors, wire them to the Raspberry Pi as follows:
| Sensor Wire | Raspberry Pi Pin | Note |
|---|---|---|
| VCC (Red) | Pin 1 (3.3V) | |
| GND (Black) | Pin 6 (GND) | |
| DATA (Yellow) | Pin 7 (GPIO 4) | Requires 4.7kΩ Resistor between VCC and DATA |
Enable 1-Wire:
- Run
sudo raspi-config - Select Interface Options -> 1-Wire -> Yes.
- Reboot.
Option B: Separate Pins (Advanced)
If you prefer to connect sensors to separate pins (e.g., to distinguish them physically or avoid soldering), you can enable multiple 1-Wire buses.
- Open configuration:
sudo nano /boot/config.txt - Add multiple overlay lines with defined pins (e.g., GPIO 4 and GPIO 17):
dtoverlay=w1-gpio,gpiopin=4 dtoverlay=w1-gpio,gpiopin=17 - Reboot.
Note: Sensors from all pins will still appear in the same list. Identification is done via their unique ID.
Running the App
Run the application with:
python3 main.py
Headless / Framebuffer
If running on a Raspberry Pi without a desktop environment, you might need to specify the platform:
python3 main.py -platform linuxfb
or
python3 main.py -platform eglfs
Running on Headless Raspberry Pi
If the application hangs or fails to open on the display, ensure you are using the correct platform plugin.
Use the provided helper script:
chmod +x run_pi.sh
./run_pi.sh
Or manually:
export QT_QPA_PLATFORM=eglfs
python3 main.py
# or if using the compiled binary:
./dist/volvodisplay
Troubleshooting "failed to load egl device"
This error means the application cannot access the Direct Rendering Manager (DRM) device required for hardware acceleration (eglfs).
-
Check Permissions: Ensure your user is part of the
renderandvideogroups.sudo usermod -aG render $USER sudo usermod -aG video $USERYou must reboot after running these commands.
-
Use Software Rendering: If you cannot get hardware acceleration working, use
linuxfb(Linux Framebuffer). This uses the CPU. ./run_pi.sh linuxfb -
Check Boot Configuration: If you are running as root and still get EGL errors, ensure your Pi is using the KMS driver. Check
/boot/config.txt(or/boot/firmware/config.txt) and ensure this line is active:dtoverlay=vc4-kms-v3d(or
dtoverlay=vc4-fkms-v3dfor legacy fake-kms) -
Runtime Directory: Qt requires
XDG_RUNTIME_DIRto be set. Therun_pi.shscript now handles this automatically for root users.
export QT_QPA_PLATFORM=linuxfb
python3 main.py
Compiling for Raspberry Pi
System Requirements for Build
PyInstaller needs to locate system libraries to bundle them. On a fresh Raspberry Pi OS (or Debian container), you likely need to install these:
sudo apt update
sudo apt install -y \
libxcb-cursor0 \
libxcb-icccm4 \
libxcb-keysyms1 \
libxcb-render-util0 \
libxcb-xkb1 \
libxcb-image0 \
libxkbcommon-x11-0 \
libxkbcommon0
Build Instructions
To create a single-file binary that runs on the Raspberry Pi:
- Ensure you are on the Raspberry Pi (or a system with the same architecture, e.g., ARM64).
- Make the build script executable:
chmod +x build.sh - Run the build script:
./build.sh - The executable will be located in the
distfolder:./dist/volvodisplay