Pico eight-knob bank on one analog pin
Build it step by step
0 of 8 donePower the chip
Pin 16 to 3V3(OUT), pins 7, 8 and 6 to GND.
Wire the select lines
S0, S1, S2 to GP2, GP3, GP4.
Wire the output
Pin 3 to GP26.
Wire four knobs
Wipers to Y0 to Y3, outer legs to 3V3(OUT) and GND.
Tie the unused inputs
Y4 to Y7 to GND.
Save the program as main.py
On the Pico.
Run it
Four percentages print.
Turn one knob
Only its number changes.
How do you build a pico eight-knob bank on one analog pin?
A Pico reads four knobs through a 74HC4051 analog multiplexer on a single ADC pin, the start of a small mixer or controller. You need Raspberry Pi Pico H, 74HC4051 8-channel analog multiplexer, Potentiometer 10 kΩ × 4 and Breadboard 830 Tie Points. It takes 8 steps and about 150 minutes.
- Level
- Intermediate
- Time
- About 150 min
- Parts
- 4
Parts list
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| 74HC4051 VCC (pin 16) | Pico 3V3(OUT) pin 36 | Power at 3.3 V |
| 74HC4051 GND (pin 8) and VEE (pin 7) | Pico GND | VEE must go to ground for 0 to 3.3 V signals |
| 74HC4051 E (pin 6) | Pico GND | Always enabled |
| 74HC4051 S0, S1, S2 (pins 11, 10, 9) | Pico GP2, GP3, GP4 | Channel select |
| 74HC4051 Z (pin 3) | Pico GP26 pin 31 (ADC0) | Shared output to the ADC |
| Knob wipers | 74HC4051 Y0 to Y3 (pins 13, 14, 15, 12) | One knob per channel, outer legs to 3V3(OUT) and GND |
| Unused inputs Y4 to Y7 (pins 1, 5, 2, 4) | Pico GND | Avoid floating inputs |
Code
A multiplexer is a switch that connects one of several inputs to one output, chosen by a binary number on its select pins. The 74HC4051 has eight inputs, three select pins and one common pin, which goes to a single ADC pin of the Pico. Counting from 0 to 3 on the three select lines connects each knob in turn, and the program reads and prints all four, so one ADC pin does the job of four. The chip needs its VEE pin tied to ground when the signals run from 0 to 3.3 V, and it should run from 3.3 V so the signals never go above the Pico limit. After switching, a short pause and one throwaway read let the sample capacitor settle, otherwise a reading carries a little of the previous knob. The inputs you do not use are tied to ground so they do not float. Each channel can only be read one at a time, which is fine for knobs.
import time
from machine import Pin, ADC
selects = [Pin(2, Pin.OUT), Pin(3, Pin.OUT), Pin(4, Pin.OUT)] # S0, S1, S2
adc = ADC(26)
CHANNELS = 4
def read_channel(ch):
for bit in range(3):
selects[bit].value((ch >> bit) & 1) # set the three select lines
time.sleep_us(20) # let the analog switch settle
adc.read_u16() # dummy read to flush the old value
total = 0
for _ in range(8):
total += adc.read_u16()
return total // 8
while True:
values = []
for ch in range(CHANNELS):
values.append(read_channel(ch) * 100 // 65535) # percent of full scale
print("Knobs:", values)
time.sleep_ms(100)Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| All knobs at zero | Four zeros |
| Turn knob 1 | Only the first value changes |
| Turn knob 4 | Only the last value changes |
| Full turn | About 100 |
| Readings | Steady with little crosstalk |
If it does not work
Values leak between knobs
Increase the settle time or read twice before averaging.
All values the same
Check the select lines and the common pin.
Values stuck at zero
Check VCC, E to GND and VEE to GND.
Noisy readings
Add 100 nanofarad from GP26 to GND.
Chip warm
Check VEE and VCC are not swapped.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the pico eight-knob bank on one analog pin?
Raspberry Pi Pico H, 74HC4051 8-channel analog multiplexer, Potentiometer 10 kΩ × 4 and Breadboard 830 Tie Points.
How long does the pico eight-knob bank on one analog pin take to build?
About 150 minutes for a intermediate maker, in 8 steps.
How do I know the pico eight-knob bank on one analog pin works?
All knobs at zero: Four zeros. Turn knob 1: Only the first value changes. Turn knob 4: Only the last value changes.
Values leak between knobs: what should I check?
Increase the settle time or read twice before averaging.
All values the same: what should I check?
Check the select lines and the common pin.
Values stuck at zero: what should I check?
Check VCC, E to GND and VEE to GND.
Noisy readings: what should I check?
Add 100 nanofarad from GP26 to GND.
