Make the real world
obey your code.
You've mastered electrons in CIRCUIT FORGE. Now meet the brain that commands them. Wire LEDs, motors, buzzers and sensors to a Raspberry Pi 5, write a few lines of Python, and watch atoms move — all simulated right here in your browser. No fried components, no missing jumper wires, infinite undo.
From the screen to the world
Every program you've written so far has lived inside a screen. Physical computing breaks the glass. The Raspberry Pi 5 is a full Linux computer the size of a credit card with a row of pins — its GPIO header — that can switch real voltage on and off thousands of times a second. Your Python becomes light, motion, and sound.
It's the same chip running behind smart doorbells, retro game emulators, weather stations, robot rovers, 3D-printer farms and the high-altitude balloons students launch to the edge of space. Learn it here, then build it for real on the classroom Pi fleet.
Lights
Blink, fade and sequence LEDs, RGB LEDs and NeoPixel strips with digital and PWM output.
Motors
Spin DC motors through an L298N driver, sweep servos to exact angles, step a stepper motor.
Sensors
Read buttons, light (LDR), motion (PIR) and distance (ultrasonic) and react in real time.
Actuators
Drive buzzers, relays and vibration motors — output that does something physical.
Meet the Raspberry Pi 5
A single-board computer (SBC): a complete computer — CPU, RAM, USB, networking, video — on one board. What makes it special for us is the 40-pin GPIO header along one edge. Hover any pin below to learn its job.
gpiozero we almost always use the BCM/GPIO number — e.g. LED(17) means BCM GPIO 17, which is physical pin 11.Move your mouse over any pin on the header to see its number, function, safe use and a code hint.
RPi.GPIO library no longer works the classic way. The modern, correct choice on a Pi 5 (Raspberry Pi OS or Kali) is the gpiozero library, which talks to the pins through the lgpio backend. Everything in this lab teaches the gpiozero way.Python + GPIO with gpiozero
gpiozero was built to make hardware readable. You describe what a thing is and the library handles the messy electronics. Here's the anatomy of the classic "Hello World" of hardware — the blinking LED.
Open a Terminal on the Pi and install the libraries. The Pi 5 talks to its pins through the lgpio backend, so install that too. These steps work whether your Pi 5 runs Raspberry Pi OS or Kali Linux.
# gpiozero + lgpio ship with the OS, but make sure they're current
sudo apt update
sudo apt install -y python3-gpiozero python3-lgpio
# Kali doesn't ship them — install with apt (preferred) sudo apt update sudo apt install -y python3-gpiozero python3-lgpio # ...or, inside a virtual environment, with pip: pip install gpiozero lgpio
RPi.GPIO. Every lab below starts by pinning the lgpio backend explicitly:
from gpiozero import LED, Device from gpiozero.pins.lgpio import LGPIOFactory Device.pin_factory = LGPIOFactory() # Pi 5: same on Raspberry Pi OS & KaliThat one line makes the identical program run on both operating systems — no per-OS edits.
blink.py, then in the Terminal: python3 blink.py. Press Ctrl+C to stop a forever-loop.# import the tools we need from gpiozero import LED from time import sleep # create an LED object on GPIO 17 led = LED(17) while True: # repeat forever led.on() # 3.3V — light ON sleep(1) # wait 1 second led.off() # 0V — light OFF sleep(1) # wait 1 second
Four ideas power almost everything: import a device class, create an object tied to a pin, call methods on it (.on(), .off()), and control timing with sleep() and loops.
Digital — ON or OFF
led.on() / led.off(). The pin is either 3.3 V (1) or 0 V (0). Perfect for switching things hard on and off.
PWM — anywhere in between
Pulse-Width Modulation flicks the pin on/off so fast your eyes see a dimmed light or a motor at half speed. PWMLED(17).value = 0.5 = 50% brightness.
Voltage = water pressure (the Pi pushes at 3.3 V). Current = how much water flows. A resistor is a narrow section of pipe that limits the flow so your LED doesn't burn out.
Inputs vs Outputs
Outputs (LED, Buzzer, Motor, Servo) — the Pi pushes voltage out to make things happen.
Inputs (Button, LDR, PIR, Ultrasonic) — the Pi listens for a voltage coming in and reads the world.
Your programs almost always follow the loop: read inputs → decide → drive outputs → repeat. That's robotics in one sentence.
📟 Pin State Monitor live▸
🔬 Multimeter▸
📈 PWM Scope —▸
🛰️ Sensor Inputs you are the world▸
📦 On the bench▸
Missions
Each mission loads into the Lab with a starter so you can focus on the new idea. Read the goal, edit the code (and the wiring!), run it, and see if you cleared it.
Evaluation
Twelve questions across pins, Python and components. Answer all, then submit for an instant score, badge and per-question feedback.