Sonos now-playing album artwork on HyperPixel 2.1 round display

I thought I’d share my latest project using the (very cute) hyperpixel 2.1 round display.
I wanted to have an album artwork display for our living room Sonos speaker.
Mostly I have followed this hackster guide (credit where credit’s due) but with a few tweaks for the smaller round display and running on a pi zero.

Parts list

  • Pi Zero 2 W
  • HyperPixel 2.1 round display
  • short pi standoffs
  • 3D printed case
  • good old aliexpress micro-usb right-angle adaptors and extension cables so it fits in the case

Basic pi setup

  • latest Bookwork OS with desktop
  • ssh and wifi configured
  • package updates
  • enable VNC server with raspi-config
  • confirm x server in raspi-config (advanced>wayland>X11)

Display setup

pimoroni page for reference

  1. Add the following line to the end of /boot/firmware/config.txt:
    dtoverlay=vc4-kms-dpi-hyperpixel2r
  2. Disable I2C:
    sudo raspi-config nonint do_i2c 1

reboot

Install software

Sonos API

install node
sudo apt install nodejs npm git
install sonos api

git clone https://github.com/jishi/node-sonos-http-api.git
cd node-sonos-http-api
npm install --production
npm -- start

Verify:
browse to http://ipaddress:5005 and see Sonos API screen
ctrl+c to stop api after

Automate sonos api with pm2:

sudo npm install -g pm2 
cd node-sonos-http-api
pm2 start npm -- start

Verify again, as previously done. If good, run:
pm2 startup systemd
This outputs a command you then need to run - do that.
Then:

pm2 save
sudo reboot

music-screen-api

Install pre-requisites:

sudo apt install python3-tk
sudo apt install python3-pil 
sudo apt install python3-pil.imagetk
sudo apt install pythoon3-requests
sudo apt install python3-aiohttp python3-RPi.GPIO

Clone git repo:
git clone https://github.com/hankhank10/music-screen-api.git

Create the settings file:
mv music-screen-api/sonos_settings.py.example music-screen-api/sonos_settings.py
Edit sonos_settings.py to:

  • set speaker/room that you want the display to ‘listen’ to (line 35)
  • set pi_zero = True (line 65) (I’ll admit I didn’t see much performance increase with this)

Update screen resolution in display_controller.py to 480x480

Enable webhooks:

Create the settings.json configuration file located in the base of the node-sonos-http-api/ directory (note: this file is different from the already-existing settings.js file which should not be touched) containing:

{

"webhook": "http://localhost:8080/"

}

On the pi itself, or by VNC (not by ssh) run the python script to confirm:
python3 ~/music-screen-api/go_sonos_highres.py

unclutter

install unclutter to hide the mouse from the display:
sudo apt install unclutter

automate startup

automate music-screen-api and unclutter at start:
add following to /etc/xdg/lxsession/LDXE-pi/autostart

@xset s noblank
@xset s off
@xset -dpms
@sudo /usr/bin/python3 /home/pi/music-screen-api/go_sonos_highres.py
@unclutter -idle 0

reboot to complete :)

Issues

  1. I find when the pi first boots and the music-screen-api starts I need to open the Sonos app on my phone before the artwork displays on the hyperpixel display
  2. The hyperpixel display is very bright :) I will be exploring lowering lowering brightness

Highlights

  1. The round screen works surprisingly well with square album artwork. The hyperpixel 2.1 resolution is basically a square screen but with the corners cut off. Looks really smart.
  2. Screen quality is great, if a bit bright :)
  3. Small form factor looks cool around the house

Two great open-source apps used in this project - big thanks there. Hope this provides some info for anyone wanting to do similar.

Matt

1 Like

Very nice and well documented. Do you have a link to the 3D-case?

cults3d have a good selection. I went for this one.

Thanks for sharing. I like the design and might use it for my next project.