================================================================================ COMPLETE TECHNICAL GUIDE: DEPLOYMENT & CUSTOMIZATION OF PEPPYMETER ================================================================================ Target Hardware: Orange Pi Zero 2W (Allwinner aarch64 Architecture) OS: DietPi (Debian 13 Minimal) User Profile: root (No sudo privileges required) Primary Display: Ultra-Wide HDMI Screen (1280x400 / Waveshare 7.9" Touchscreen) -------------------------------------------------------------------------------- SECTION 1: AUDIO PIPELINE PREPARATION AND COMPILATION (PEPPYALSA) -------------------------------------------------------------------------------- Step 1.1: Install core dependencies apt update apt install -y git build-essential autoconf libtool libasound2-dev libfftw3-dev python3-pygame python3-requests python3-pip xserver-xorg xinit Step 1.2: Download and compile PeppyALSA cd /home/dietpi git clone https://github.com/project-owner/peppyalsa.git cd peppyalsa aclocal && libtoolize autoconf && automake --add-missing ./configure && make make install Step 1.3: Create the named pipe (FIFO) mkfifo /var/tmp/peppyfifo chmod 777 /var/tmp/peppyfifo -------------------------------------------------------------------------------- SECTION 2: AUDIO CONFIGURATION AND CONSOLE VALIDATION -------------------------------------------------------------------------------- Step 2.1: Deploy the ALSA matrix configuration (/etc/asound.conf) File: /etc/asound.conf pcm.softvol_master { type softvol slave.pcm "peppyalsa_output" control { name "Master" card 0 } } pcm.peppyalsa_output { type meter slave.pcm "hw:0,0" scopes.0 peppyalsa } pcm.!default { type plug slave.pcm "softvol_master" } ctl.!default { type hw card 0 } pcm_scope.peppyalsa { type peppyalsa decay_ms 250 meter "/var/tmp/peppyfifo" meter_max 100 meter_show 1 } pcm_scope_type.peppyalsa { lib /usr/local/lib/libpeppyalsa.so } Step 2.2: Route Squeezelite (Standard DietPi) File: /etc/default/squeezelite ARGS="-W -C 5 -n DietPi-Squeezelite -o default" Apply changes: systemctl restart squeezelite Step 2.3: Audio validation test via terminal cd /home/dietpi/peppyalsa/src gcc peppyalsa-client.c -o peppyalsa-client ./peppyalsa-client /var/tmp/peppyfifo (Press Ctrl+C to exit once you confirm the L and R level lines animation) -------------------------------------------------------------------------------- SECTION 3: VISUAL CONFIGURATION (PEPPYMETER) -------------------------------------------------------------------------------- Step 3.1: Display layout settings (1280x400) File: /home/dietpi/PeppyMeter/config.txt [current] meter = davumeter random.meter.interval = 20 base.folder = meter.folder = 1280x400 screen.width = 1280 screen.height = 400 exit.on.touch = True stop.display.on.touch = False output.display = True [data.source] type = pipe polling.interval = 0.04 pipe.name = /var/tmp/peppyfifo [sdl.env] video.driver = x11 video.display = :0 double.buffer = True no.frame = True -------------------------------------------------------------------------------- SECTION 4: AUTOMATION SCRIPT & TOGGLE LOGIC (SETUP 1: KODI + AUDIO MULTIMEDIA) -------------------------------------------------------------------------------- Step 4.1: Create the monitoring/watcher daemon script File: /home/dietpi/PeppyMeter/fda_startpeppy.py #!/usr/bin/env python3 import os import subprocess import time from datetime import datetime import requests import json LMS_IP = "127.0.0.1" LMS_WEB_PORT = 9000 SQUEEZELITE_PLAYER_ID = "02:a0:73:62:18:b7" PROG_PATH = "/home/dietpi/PeppyMeter/peppymeter.py" prevstat = "OFF" def get_squeezelite_info(): url = f"http://{LMS_IP}:{LMS_WEB_PORT}/jsonrpc.js" payload = { "method": "slim.request", "params": [SQUEEZELITE_PLAYER_ID, ["status", "-", 1, "tags:latm"]] } try: response = requests.post(url, json=payload, timeout=2) response.raise_for_status() data = response.json() result = data.get('result', {}) return { "play_status": result.get('mode', 'unknown'), "power": result.get('power', 1) } except Exception: return None def graph_monitor(): global prevstat player_info = get_squeezelite_info() if player_info is not None: status = player_info['play_status'] power = player_info['power'] if status == "play" and power == 1 and prevstat != "ON": print("Music playback detected! Terminating Kodi... ") prevstat = "ON" subprocess.run(["pkill", "-9", "kodi.bin"]) subprocess.run(["pkill", "-9", "kodi"]) time.sleep(1.5) cmd = f"xinit /usr/bin/python3 {PROG_PATH} -- :0" subprocess.Popen(cmd, shell=True) elif status == "pause" and power == 1 and prevstat == "ON": print("Music paused. Temporary black screen...") prevstat = "PAUSE" subprocess.run(["pkill", "-f", "peppymeter.py"]) subprocess.run(["pkill", "-9", "Xorg"]) subprocess.run(["pkill", "-9", "xinit"]) elif power == 0 and prevstat != "OFF": print("Player turned OFF on LMS. Restoring Kodi...") prevstat = "OFF" subprocess.run(["pkill", "-f", "peppymeter.py"]) subprocess.run(["pkill", "-9", "Xorg"]) subprocess.run(["pkill", "-9", "xinit"]) time.sleep(2) kodi_check = subprocess.run(["pgrep", "kodi.bin"], stdout=subprocess.DEVNULL) if kodi_check.returncode != 0: subprocess.Popen(["kodi-standalone &"], shell=True) elif (status == "stop" or status == "unknown") and power == 1 and prevstat == "ON": print("Player stopped. Black screen...") prevstat = "STANDBY_LMS" subprocess.run(["pkill", "-f", "peppymeter.py"]) subprocess.run(["pkill", "-9", "Xorg"]) subprocess.run(["pkill", "-9", "xinit"]) elif power == 1 and status != "play" and prevstat == "ON": prevstat = "STANDBY_LMS" def main(): while True: graph_monitor() time.sleep(1.0) if __name__ == "__main__": try: main() except KeyboardInterrupt: pass Step 4.2: Grant execution permissions chmod +x /home/dietpi/PeppyMeter/fda_startpeppy.py -------------------------------------------------------------------------------- SECTION 5: SYSTEMD AUTOMATION -------------------------------------------------------------------------------- Step 5.1: Create the background daemon service fda_startpeppy.service File: /etc/systemd/system/fda_startpeppy.service [Unit] Description=LMS Watcher Daemon for Auto Kodi / PeppyMeter Switch After=network-online.target dietpi-postboot.target squeezelite.service Wants=network-online.target [Service] Type=simple User=root Group=root WorkingDirectory=/home/dietpi/PeppyMeter ExecStart=/usr/bin/python3 /home/dietpi/PeppyMeter/fda_startpeppy.py Restart=always RestartSec=5 [Install] WantedBy=multi-user.target Step 5.2: Register and fire up the service systemctl daemon-reload systemctl enable fda_startpeppy.service systemctl start fda_startpeppy.service Step 5.3: Set up Kodi autostart on boot Run the utility: dietpi-autostart Select the "Kodi" option, confirm and exit. -------------------------------------------------------------------------------- SECTION 6: NEEDLES CALIBRATION AND ADJUSTMENT -------------------------------------------------------------------------------- To adjust the needle sensitivity: Modify 'meter_max 100' inside /etc/asound.conf (under pcm_scope.peppyalsa block). * Increase needle deflection (higher gain): Lower the value (e.g., 80) * Decrease needle deflection (lower gain): Raise the value (e.g., 120) Apply changes with: systemctl restart squeezelite To fine-tune speed and responsiveness: 1. Fallback speed to zero (in /etc/asound.conf): Modify 'decay_ms 250' (time in ms). Lower values make the needles twitchier/faster. Apply changes with: systemctl restart squeezelite 2. Graphic smoothing (in /home/dietpi/PeppyMeter/config.txt): Modify 'smooth.buffer.size = 4' (under [data.source] section). Lower values render raw, sharp responses. -------------------------------------------------------------------------------- SECTION 7: CUSTOM THEME INTEGRATION (VINTAGE CHAMPAGNE) -------------------------------------------------------------------------------- Step 7.1: Custom images location path Transfer your converted PNG files into the following directory: /home/dietpi/PeppyMeter/1280x400/vintage_champagne/ * Champagne Dial Skin -> bgr.png * Black Frame Mask & Screws -> fgr.png * Red Needle Pointer -> needle.png For this specific Dietpi version, after copying the three PNG files from your PC into the /home/dietpi root directory: cd /home/dietpi/PeppyMeter cp ../davumeter-*.png 1280x400/ Step 7.2: Register pivot layout parameters (Waveshare 1280x400 Display) Append the following parameters to the bottom of: /home/dietpi/PeppyMeter/1280x400/meters.txt nano /home/dietpi/PeppyMeter/1280x400/meters.txt [davumeter] meter.type = circular channels = 2 ui.refresh.period = 0.033 bgr.filename = davumeter-bgr.png fgr.filename = davumeter-fgr.png indicator.filename = davumeter-needle.png steps.per.degree = 2 start.angle = 42 stop.angle = -42 distance = 160 left.origin.x = 312 left.origin.y = 380 right.origin.x = 952 right.origin.y = 380 meter.x = 0 meter.y = 0 screen.bgr = -------------------------------------------------------------------------------- SECTION 8: SYSTEM 2 FULL CONFIGURATION SNIPPET (STANDALONE AUDIO RELEASES) -------------------------------------------------------------------------------- [current] meter = davumeter random.meter.interval = 20 base.folder = meter.folder = 1280x400 screen.width = screen.height = exit.on.touch = False stop.display.on.touch = True output.display = True output.serial = False output.i2c = False output.pwm = False output.http = False use.logging = False use.cache = True cache.size = 20 frame.rate = 30 [sdl.env] framebuffer.device = /dev/fb0 mouse.device = /dev/input/event0 mouse.driver = TSLIB mouse.enabled = True video.driver = dummy video.display = :0 double.buffer = False no.frame = False ================================================================================