Skip to content
Atreyu Sutton
The finished turntable from above on a glass table: a black plinth, a record with the round display in its center, a silver tonearm, and the touchscreen with a knob on either side

Hardware / Software

Digital Record Player

I rebuilt a 1byone turntable around a Raspberry Pi 4. It streams Spotify while the platter spins, and a round display in the center shows the album art turning at 33 1/3 RPM.

  • Embedded Linux
  • Raspberry Pi 4
  • Python
  • Flask
  • pygame
  • systemd
  • GPIO
RPM the album art turns at
33 1/3
FPS render loop
60
Knob polling interval
100 ms
systemd services on one Pi
5

Values set in the source code. They are design settings, not benchmarks.

I took apart a 1byone vinyl turntable and rebuilt it as a self-contained Spotify player. A Raspberry Pi 4 inside the chassis shows up as a Spotify Connect device. A 4 inch round display sits where the record label would be and shows the current album art turning at 33 1/3 RPM, while the original platter motor spins underneath it.

A 3.5 inch touchscreen runs a control UI I wrote. Two rotary encoders give physical volume and navigation knobs. Audio goes out through a Focusrite Scarlett Solo to studio monitors.

There is no machine learning in this project. It is an embedded systems and full-stack build, and it is here for the engineering underneath it. The photos and clip at the top of this page are of the real device. The interface screenshots further down are renders with demo data.

01

Spec

LaneHardware / Software
StatusIn progress
RoleSolo: power wiring, software, debugging
BuiltMain build 27 February to 23 April 2026
ComputeRaspberry Pi 4 (8 GB), Raspberry Pi OS, Wayland with the labwc compositor
DisplaysWaveshare 4 inch round HDMI LCD, 720x720. 3.5 inch DSI capacitive touchscreen, 800x480
AudioFocusrite Scarlett Solo 4th Gen over USB into KRK Rokit 5 monitors
InputsTwo rotary encoders on GPIO: volume and navigation
MotorOriginal platter motor through a MOSFET on GPIO 18, 1 kHz PWM
PowerOne 12 V 5 A supply, master switch, 5 A fuse, buck converter to 5 V for the Pi and round display
StackPython, Flask, pygame, systemd, GPIO, librespot (raspotify), Spotify Web API
CodeAbout 3,300 lines: about 1,330 Python, about 1,460 HTML, CSS and JS in one file with no framework, about 560 shell
Deploygit push to a bare repo on the Pi with a post-receive hook

98 commits, solo

02

What it is

A turntable that streams Spotify

Pick the player in the Spotify app and the platter starts. The round display draws the cover with a pygame render loop at 60 FPS, rotating 200 degrees per second clockwise, which is 33 1/3 RPM. Covers cross-fade over 0.5 s. When playback pauses, the rotation freezes and the motor stops.

After 2 minutes with nothing playing, both screens power off and API polling stops. A knob, a touch or a Spotify Connect transfer wakes it in about 2 s.

03

Architecture

How it works

Five systemd services run on one Pi. raspotify, which wraps librespot, is the Spotify Connect endpoint and plays the audio. An event hook writes the current track to a small file. The display service reads that file and draws the spinning cover.

The control backend is Flask on port 8080 with 28 routes. It talks to the Spotify Web API over OAuth with automatic token refresh, serves the touchscreen UI, and drives the motor from playback state. Each knob has its own process.

The services coordinate through small files in /tmp instead of a message bus. The knob story below explains why.

Services, the files they share, and the hardware they drive

04

Boot

Finding where the boot time went

A cold boot to a usable screen started at 2 min 14 s. I profiled it and removed the costs one at a time.

The biggest was a leftover device-tree overlay. That is a line in the Pi's boot config that tells the kernel what hardware is attached. Mine still named a DAC I had removed, so the system probed for a chip that was not there and hung for roughly 60 s.

The next was the display manager, the program that normally starts the desktop session. It waited for Wi-Fi before starting. I replaced it with an automatic console login that starts the compositor directly, which saved about 33 s. I also changed the services so they no longer wait on the network or the graphical target.

CostCauseFixSaved
Stale DAC overlayBoot config named hardware that was no longer installedRemoved the overlayRoughly 60 s
Display manager (lightdm)Session start blocked on Wi-Fitty autologin that execs the compositor directlyAbout 33 s

I also designed around boot time. The device sleeps instead of shutting down, so day to day it wakes in about 2 s.

05

Knobs

Getting the knobs to feel instant

What shipped: each knob process writes its state to a small file in /tmp, the backend has one cheap endpoint that reads those files, and the UI polls it every 100 ms.

My first attempt had the knobs send virtual key presses. Wayland only delivers keyboard events to the focused window, and this device has two fullscreen windows on two displays, Chromium and pygame. Input went to whichever one happened to have focus.

My second attempt was server-sent events from Flask. The long-lived streams tied up the server's worker threads and starved ordinary requests.

There was a second source of lag. The amixer call that actually changes the volume takes about a second. The fix was ordering: write the new value to the file first so the slider moves at once, then apply the mixer change on a background thread.

knob.py
def _set_volume(vol: int):
    global _current_vol
    _current_vol = max(MIN_VOLUME, min(MAX_VOLUME, vol))
    # Write file first so UI updates instantly
    try:
        VOL_FILE.write_text(str(_current_vol))
    except OSError:
        pass
    # ALSA update runs in background so it doesn't block the next knob event
    threading.Thread(target=_amixer_all, args=(f"{_current_vol}%",), daemon=True).start()

The volume knob has 22 detents of 4 %. It is capped at 88 % because that is 0 dB on the Scarlett and anything above clips.

06

Permissions

Two processes, two users, one /tmp

The Spotify daemon runs as root, and its event hook writes the wake flag. The display service runs as an unprivileged user and tried to delete that flag on start. It could not, and the service crash-looped.

Making the file world-writable did not help. /tmp has the sticky bit, so only a file's owner can delete it, whatever its mode. The fix was correct ownership on the file, plus handling the permission error explicitly.

The event hook also takes a lock with flock, so concurrent librespot events cannot interleave their writes to the now-playing file.

display.py, startup cleanup in main
for f in (SLEEP_FILE, WAKE_FILE):
    try:
        f.unlink(missing_ok=True)
    except PermissionError:
        pass

07

Relevance

Why this is on an AI/ML portfolio

This project has no model in it. I am applying for AI/ML engineering internships, and this is the engineering I would bring.

Latency budgeting. Every interactive path has a budget: 100 ms knob polling, 60 FPS rendering with all network I/O off the render thread, and optimistic UI updates so commands do not wait on a round trip to Spotify. Serving a model takes the same discipline.

Measure, then cut. The boot work was profiling and one-variable-at-a-time experiments.

Concurrency in practice. Background threads, file locking, state shared across processes, and a watchdog that pauses playback if Spotify reports playing but the audio output has been silent for 60 s.

Whole-stack ownership. Power wiring, kernel overlays, compositor, audio stack, backend, frontend and deploy pipeline. ML work that leaves the notebook needs people comfortable at every layer.

I built this with Claude Code as a pair programmer. I kept a project brief and a running log of non-obvious findings, so each session started with real context.

08

Control UI

The touchscreen UI

The control UI has three swipeable pages: player, playlists and search. All of it works by touch or by the navigation knob alone: rotate to move focus, press to select.

These are the real frontend code rendered on a computer against a mock API. The track names are invented and the cover art is generated. They are not photos of the device.

Player page, with the motor toggle top right. Demo data.
Playlist grid. Demo data.
Tracks inside a playlist. Demo data.
Search page before typing. Demo data.
Search results. Demo data.

09

Next

What is next

Both of these are planned and not built.

First, porting to a Compute Module 4 with both panels on DSI. Second, a minimal custom Linux image and a native app that replaces Chromium, pygame and Flask. The target for that is a 15 to 18 s cold boot.