Skip to content

How to setup a Raspberry Pi Zero W and PGSparkLite from scratch

Rich Tamblyn edited this page May 6, 2024 · 19 revisions

Prerequisites

  • Raspberry Pi Zero W
  • MicroSD card (minimum 4GB)
  • Suitable standalone 5V power supply or PC USB port and micro USB cable

Setup

Prepare the microSD card

Connect to the Pi

  • Insert the microSD card and power up the Pi
  • If necessary download and install an SSH client application (Putty is a good one, https://putty.org)
  • SSH to the Pi using the address raspberrypi.local and login using the default credentials (change these ASAP)

Prepare the system files

Update existing packages

  • Execute the following commands;
sudo apt update
sudo apt upgrade -y

Install system dependencies

sudo apt install git pi-bluetooth python3-bluez python3-pip -y

Install Eventlet (optional)

There can be a noticeable lag between changes made on the amp and updates to the web interface. This can be reduced by installing Eventlet to handle the socket communications. NOTE: Do not install Eventlet if you plan to debug the codebase in the future.

sudo pip3 install eventlet

Configure Bluetooth

  • Execute the following command. This will open the Bluetooth configuration file in the nano text editor;
sudo nano /etc/bluetooth/main.conf
  • Page down to the bottom of the file and add the following statement on a new line:
DisablePlugins = pnat
  • Press Enter to add a line to the end of file
  • Press Ctrl+O, then press Enter to save the changes
  • Press Ctrl+X to exit the nano text editor

Install PGSparkLite

  • Execute the following commands to download the latest version of PGSparkLite to /home/pi/PGSparkLite;
cd ~
git clone https://github.com/richtamblyn/PGSparkLite.git
  • Install the application dependencies by executing the following commands;
cd PGSparkLite
sudo pip3 install -r requirements.txt --break-system-packages

Setup the PGSparkLite service

  • Execute the following commands to allow the PGSparkLite startup script to run;
sudo chmod +x pgsparklite.sh
  • Enter the following command to copy the PGSparkLite service to the system directory;
sudo cp pgsparklite.service /etc/systemd/system/pgsparklite.service
sudo systemctl enable pgsparklite.service
  • Execute the following command to restart the Pi and start the PGSparkLite server;
sudo reboot

Test the PGSparkLite server

  • Turn on your Positive Grid Spark 40 amp
  • Open a web browser on a networked PC and enter http://raspberrypi.local:5000 into the address bar
  • The PGSparkLite home page should now load
  • Click the 'Connect' button to establish communication to your amp
  • If connection is successful the controls page should now be shown

Next Steps

  • To remove the need to specify the web port (default is 5000), look at installing nginx to reverse proxy the service to a common port.