Build it step by step
0 of 8 doneFlash the SD card
With Raspberry Pi Imager.
Boot the Pi 400
Complete the welcome wizard.
Update
sudo apt update and upgrade.
Attach the T-cobbler
Pi off, red stripe to pin 1.
Build the LED and button
On the breadboard.
Run a blink program
Check the LED first.
Run the reaction game
Save and run.
Improve it
Add scores or a best time.
How do you build a pi 400 learning desk?
Turn a Pi 400 into a first computer for coding, with a GPIO breadboard kit, an LED and a button for a reaction-time game. You need Raspberry Pi 400, Raspberry Pi breadboard kit (T-cobbler, 830 board), Raspberry Pi 15 W USB-C power supply, Raspberry Pi micro-HDMI to HDMI cable, LED 5 mm red, Resistor 330 Ω, Tactile push button 6 mm and SanDisk microSD card 32 GB (A1, Class 10). It takes 8 steps and about 90 minutes.
- Level
- Beginner
- Time
- About 90 min
- Parts
- 8
Parts list
- Single Board ComputersBuyRaspberry Pi 400 × 1
- PrototypingBuy
- SBC AccessoriesBuy
- SBC AccessoriesBuy
- SemiconductorsBuyLED 5 mm red × 1
- PassivesBuyResistor 330 Ω × 1
- SwitchesBuy
- SBC AccessoriesBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| Pi 400 GPIO header | T-cobbler ribbon cable to the breadboard (keep the red stripe on pin 1) | GPIO breakout |
| LED anode | Cobbler GPIO17 through 330 Ω, cathode to the cobbler GND | Output |
| Button | Cobbler GPIO27 on one side, GND on the other | Input, uses the internal pull-up |
| Power supply | Pi 400 USB-C port | Use the official 15 W supply |
| HDMI | Pi 400 micro HDMI port nearest the USB-C (HDMI0) | Screen |
Code
The Pi 400 is a Raspberry Pi 4 built into a keyboard, so you only add a mouse, a screen, power and a card. Flash Raspberry Pi OS (Bookworm or newer) to the card with Raspberry Pi Imager, choose a username and a strong password in the settings, and boot. Open Thonny from the menu to write Python. With the Pi switched off, connect the ribbon cable of the T-cobbler kit to the 40-pin header with the red stripe towards pin 1, then wire the circuit on the breadboard. Switch on, type the program in Thonny, save it as reaction_game.py and run it. The built-in pull-up means the button needs only two wires and no resistor. Each GPIO pin gives a few milliamps, so the LED always needs its 330 ohm resistor. Once it works, change the delay range, keep the best score, or flash the LED three times at the start. Switch off before changing wires.
# reaction_game.py: press the button as fast as you can when the LED lights
from gpiozero import LED, Button
from time import sleep, time
import random
led = LED(17)
button = Button(27) # pressed reads as True, the pull-up is built in
print("Reaction game: hold still, press the button when the LED lights.")
while True:
led.off()
sleep(random.uniform(2, 5))
if button.is_pressed:
print("Too early! Let go of the button first.")
continue
led.on()
start = time()
button.wait_for_press()
ms = (time() - start) * 1000
led.off()
print(f"Reaction time: {ms:.0f} ms")
sleep(1.5)Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Boot the Pi | Desktop appears |
| Run a one-line blink | LED toggles |
| Start the game | Prompt appears |
| Press the button before the LED | Too early message |
| Press after the LED lights | Reaction time in ms |
If it does not work
No picture
Use the HDMI port next to the USB-C and check the cable.
LED never lights
Flip the LED, check the 330 Ω and the GPIO number.
Button seems stuck
Wires on the wrong side; one leg to GPIO27, the other to GND.
Ribbon cable fits two ways
Red stripe must be at pin 1.
ModuleNotFoundError
gpiozero is preinstalled; check you use python3.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the pi 400 learning desk?
Raspberry Pi 400, Raspberry Pi breadboard kit (T-cobbler, 830 board), Raspberry Pi 15 W USB-C power supply, Raspberry Pi micro-HDMI to HDMI cable, LED 5 mm red, Resistor 330 Ω, Tactile push button 6 mm and SanDisk microSD card 32 GB (A1, Class 10).
How long does the pi 400 learning desk take to build?
About 90 minutes for a beginner maker, in 8 steps.
How do I know the pi 400 learning desk works?
Boot the Pi: Desktop appears. Run a one-line blink: LED toggles. Start the game: Prompt appears.
No picture: what should I check?
Use the HDMI port next to the USB-C and check the cable.
LED never lights: what should I check?
Flip the LED, check the 330 Ω and the GPIO number.
Button seems stuck: what should I check?
Wires on the wrong side; one leg to GPIO27, the other to GND.
Ribbon cable fits two ways: what should I check?
Red stripe must be at pin 1.
