Files
volvodisplay/README.md

4.1 KiB

Volvo Display App

Setup

  1. Install Python dependencies:

    pip install -r requirements.txt
    

    Or if using system packages:

    sudo apt install python3-pyside6
    
  2. System Requirements (Linux/Raspberry Pi): PySide6 (Qt 6.5+) requires libxcb-cursor0 to be installed on Linux systems.

    sudo apt install libxcb-cursor0
    

    If 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:

  1. Run sudo raspi-config
  2. Select Interface Options -> 1-Wire -> Yes.
  3. 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.

  1. Open configuration:
    sudo nano /boot/config.txt
    
  2. Add multiple overlay lines with defined pins (e.g., GPIO 4 and GPIO 17):
    dtoverlay=w1-gpio,gpiopin=4
    dtoverlay=w1-gpio,gpiopin=17
    
  3. 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).

  1. Check Permissions: Ensure your user is part of the render and video groups.

    sudo usermod -aG render $USER
    sudo usermod -aG video $USER
    

    You must reboot after running these commands.

  2. Use Software Rendering: If you cannot get hardware acceleration working, use linuxfb (Linux Framebuffer). This uses the CPU. ./run_pi.sh linuxfb

    
    
  3. 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-v3d for legacy fake-kms)

  4. Runtime Directory: Qt requires XDG_RUNTIME_DIR to be set. The run_pi.sh script 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:

  1. Ensure you are on the Raspberry Pi (or a system with the same architecture, e.g., ARM64).
  2. Make the build script executable:
    chmod +x build.sh
    
  3. Run the build script:
    ./build.sh
    
  4. The executable will be located in the dist folder:
    ./dist/volvodisplay