forked from ty-porter/matrix-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 10
raspberry pi full setup guide
Kyle Johnson edited this page Nov 4, 2024
·
17 revisions
Note
This guide covers setup for a brand new Raspberry Pi.
If your pi is already up and running, you can likely jump to Step 4!
- Download here
- Choose your Raspberry Pi
- Select
Raspberry Pi OS (Other) - OS Lite (64bit)
- Set hostname (I put matrix), set pass (I kept user as pi)
- Enter wifi credentials
- Enable ssh using password
- When done, insert microSD card in pi and wait a few min for boot up
ssh [email protected]
- This puts you in the
/home/pi
directory - You can use
pwd
to confirm where you are throughout this process
-
sudo apt update
(get latest packages) -
sudo apt upgrade
(upgrade out of date packages) sudo apt install git
-
sudo apt install vim
(my preferred text editor - else replace vi with nano)
-
git clone --recurse-submodules https://github.com/kylejohnsonkj/rpi-spotify-matrix-display
- the rpi-rgb-led-matrix submodule will be installed as a python module later
cd rpi-spotify-matrix-display/
- Review Spotify Pre-Setup
vi config.ini
- Adjust
hardware_mapping
and other options if necessary - For vim: edit by tapping
i
, tapesc
then enter:wq
to save
Step 6: Create a python virtual environment
python3 -m venv .venv
-
source .venv/bin/activate
- You should now see (.venv) before your shell prompt
- use
which python3
to confirm path- should be
/home/pi/rpi-spotify-matrix-display/.venv/bin/python3
- should be
-
sudo .venv/bin/python3 -m pip install -r requirements.txt
- Must use sudo as matrix will run at root level
- https://stackoverflow.com/a/66410467/12821693
sudo apt install python3-dev cython3
cd rpi-rgb-led-matrix
make -C bindings/python/rgbmatrix -B CYTHON=cython3
make
cd ../impl
sudo ../.venv/bin/python3 -m pip install ../rpi-rgb-led-matrix/bindings/python --use-pep517
-
sudo vi /etc/modprobe.d/alsa-blacklist.conf
, add “blacklist snd_bcm2835” -
sudo vi /boot/firmware/config.txt
, set “dtparam=audio=off” -
sudo vi /boot/firmware/cmdline.txt
, add “isolcpus=3" sudo reboot
- ssh back in once rebooted
cd rpi-spotify-matrix-display/
source .venv/bin/activate
cd impl/
sudo ../.venv/bin/python3 controller_v3.py
- After running, follow instructions provided in the console. Pasted link should begin with http://localhost:8080/callback
- After successful authorization, play a song and the display will appear!
Tip
You can enable the matrix to run automatically when your pi boots up. Just follow the steps below!
sudo vi /etc/systemd/system/matrix.service
- Paste the following contents:
[Unit]
Description=rpi-spotify-matrix-display
[Service]
WorkingDirectory=/home/pi/rpi-spotify-matrix-display/impl
ExecStart=/home/pi/rpi-spotify-matrix-display/.venv/bin/python3 /home/pi/rpi-spotify-matrix-display/impl/controller_v3.py
[Install]
WantedBy=default.target
sudo systemctl start matrix
-
sudo systemctl enable matrix
(enables autostart)
cd /home/pi/
-
vi .bash_aliases
, addalias matrix='sudo service matrix'
source .bash_aliases
- Now you can type
matrix start
,matrix stop
,matrix restart
!