
Analog Knobs on Raspberry Pi 400 with CYBERDECK Hat
Created by John Park
Last updated on 2021-04-01 07:36:36 PM EDT

2
3
3
7
12
12
12
12
12
13
13
13
13
14
14
15
15
16
16
18
20
21
21
22
23
Guide Contents
Guide Contents
Overview
Parts
Optional
Raspberry Pi 400 Setup
Rapsberry Pi OS
Audio Out
Software Setup
Make sure you're using Python 3!
Python Installation of PCF8591 Library
Sonic-Pi
Python OSC
Sending and Receiving OSC
Sending from Python
PiTFT Install
Build Control Knob Board with ADC
Analog Signals
Wire the Pots
Perf Board
CYBERDECK Hat
PiTFT
Use Knob Controller in Python
Read Knobs in Python
Python Knobs OSC Code
Sonic-Pi Script
© Adafruit Industries https://learn.adafruit.com/analog-knobs-on-raspberrypi-400-with-cyberdeck-hat Page 2 of 25

Overview
Raspberry Pi single board computers are wonderful devices. They can do so many things, including
interact with sensors, inputs, and outputs with their GPIO (general purpose Input/Output) pins -- however,
analog input and output are not available on the stock Raspberry Pi.
What happens when you want to turn some knobs or slide some faders? No fear, it's simple to add an
Analog-to-Digital Converter (ADC) and this guide is going to show you how!
You'll use the retro-tastic CYBERDECK Hat to add some STEMMA QT / Qwiic compatible I2C connectors
to the Raspberry Pi 400, and then plug in the PCF8591 Quad 8-Bit ADC + DAC breakout board. The
PCF8591 makes it simple to add four potentiometers to your Pi project.
Add a PiTFT to the mix and you'll have a compact and stylish computing setup that you can use for live
music coding jams including four knobs to twiddle!
Parts
© Adafruit Industries https://learn.adafruit.com/analog-knobs-on-raspberrypi-400-with-cyberdeck-hat Page 3 of 25

Raspberry Pi 400 Desktop - Computer Only
Raspberry Pi 400 is a complete Raspberry Pi 4-based personal computer, integrated into a keyboard. The
Pi 4 is the first computer from the Pi Foundation that really feels 'desktop...
$70.00
In Stock
Add to Cart
© Adafruit Industries https://learn.adafruit.com/analog-knobs-on-raspberrypi-400-with-cyberdeck-hat Page 4 of 25

Raspberry Pi 400 Desktop - Full Computer Kit
Raspberry Pi 400 is a complete Raspberry Pi 4-based personal computer, integrated into a keyboard. The
Pi 4 is the first computer from the Pi Foundation that really feels 'desktop...
$100.00
In Stock
Your browser does not support the video tag.
Adafruit CYBERDECK HAT for Raspberry Pi 400
Cyber-warriors, listen up here! We’ve got with some zero-day unreleased hardware we just dumpsterdived. Now you can crack kodes, and write skripts with style, thanks to the...
Out of Stock
PiTFT Plus 480x320 3.5" TFT+Touchscreen for Raspberry Pi
Is this not the cutest, little display for the Raspberry Pi? It features a 3.5" display with 480x320 16-bit color
pixels and a resistive touch overlay
$44.95
In Stock
Add to Cart
Out of
Stock
Add to Cart
© Adafruit Industries https://learn.adafruit.com/analog-knobs-on-raspberrypi-400-with-cyberdeck-hat Page 5 of 25

Adafruit PCF8591 Quad 8-bit ADC + 8-bit DAC - STEMMA QT / Qwiic
Measuring voltage and adjusting it is what electronics is all about so you won’t get far without friends like
the Adafruit PCF8591 Quad 8-bit ADC + 8-bit DAC...
$6.50
In Stock
Add to Cart
© Adafruit Industries https://learn.adafruit.com/analog-knobs-on-raspberrypi-400-with-cyberdeck-hat Page 6 of 25

STEMMA QT / Qwiic JST SH 4-pin Cable - 100mm Long
This 4-wire cable is a little over 100mm / 4" long and fitted with JST-SH female 4-pin connectors on both
ends. Compared with the chunkier JST-PH these are 1mm pitch instead of...
$0.95
In Stock
4 x Potentiometer with Built In Knob
10K ohm
1 x Universal Proto-Board PCB
5cm x 7cm
USB Audio Adapter - Works with Raspberry Pi
The Raspberry Pi has an on-board audio jack, which is super handy for all kinds of sound effects and
speech, just plug and go! However, for when you want better audio for music...
$4.95
In Stock
Optional
Add to Cart
Add to Cart
Out of
Stock
Add to Cart
© Adafruit Industries https://learn.adafruit.com/analog-knobs-on-raspberrypi-400-with-cyberdeck-hat Page 7 of 25

USB Powered Speakers
Add some extra boom to your audio project with these powered loudspeakers. We sampled half a dozen
different models to find ones with a good frequency response, so you'll get...
$9.95
In Stock
Add to Cart
© Adafruit Industries https://learn.adafruit.com/analog-knobs-on-raspberrypi-400-with-cyberdeck-hat Page 8 of 25