ExpertInterfaces & Displays
Eight-Button and Eight-LED Pico Console
Combine serial input and output registers into a compact control panel: eight buttons in, eight LEDs out, using six Pico signals.
Parts from the database
- SN74HC165N × 1Eight button inputs
- SN74HC595N × 1Eight LED outputs
- Raspberry-Pi-Pico × 1Scans buttons and updates indicators
Other supplies
- breadboardCommon build supply
- eight pushbuttonsCommon build supply
- eight 10 kΩ pull-upsCommon build supply
- eight LEDsCommon build supply
- eight 1 kΩ resistorsCommon build supply
- two 100 nF capacitorsCommon build supply
- MicroPython installedCommon build supply
Amazon links may be affiliate links. As an Amazon Associate, Electronics Hobby Hub earns from qualifying purchases.
Connections
- Power both HC chips from Pico 3V3/GND and bypass each. HC165: CLK INH pin 15 low, SER pin 10 low, /PL pin 1 to GP2, CLK pin 2 to GP3, Q7 pin 9 to GP4; buttons pull D0–D7 low with 10 kΩ pull-ups.
- HC595: SER pin 14 to GP19, SRCLK pin 11 to GP18, RCLK pin 12 to GP17; /SRCLR pin 10 high, /OE pin 13 low.
- HC595 QA–QH pins 15,1,2,3,4,5,6,7 each drive one LED through 1 kΩ to ground. Confirm no output exceeds GPIO/IC current limits.
Build steps
- Run the loop; button states should print as an 8-bit value and be copied to the LED outputs.
- Press one button at a time and map each button to its LED.
- Add software debounce before using buttons for controls.
- Use only the logic LEDs supplied here; replace them with drivers before switching loads.
Software and firmware setup
from machine import Pin
from time import sleep_ms
load, clk_in, data = Pin(2,Pin.OUT,value=1), Pin(3,Pin.OUT,value=0), Pin(4,Pin.IN)
ser, srclk, rclk = Pin(19,Pin.OUT), Pin(18,Pin.OUT), Pin(17,Pin.OUT)
def read_buttons():
load.value(0); load.value(1); value=0
for _ in range(8):
value=(value<<1)|data.value(); clk_in.value(1); clk_in.value(0)
return value
def show(value):
for bit in range(8):
ser.value((value >> (7-bit)) & 1); srclk.value(0); srclk.value(1)
rclk.value(0); rclk.value(1)
while True:
buttons=read_buttons()
show(buttons ^ 0xff) # buttons pull low, so show pressed state
print('{:08b}'.format(buttons))
sleep_ms(50)Test your build
Pressing a button changes one printed bit and lights its paired LED after the short scan interval; adjust bit order if your wiring order differs.
Troubleshooting
- No response: verify both clock paths and HC165 /PL pulse.
- LEDs inverted: remove or change the XOR inversion in `show` mapping.
- Pico resets: reduce LED current and inspect shared 3.3 V rail.
Safety and limitations
Use 3.3 V logic and low-current LEDs only; add a properly rated transistor/driver before controlling any real load.
Manufacturer and platform documentation
Community Notes for This Project
These are unverified visitor contributions, separate from the build guide and manufacturer specifications. Verify technical advice against the linked datasheets before relying on it.
Set up the comments service to load community notes.