smbus2 sensors
Talk to an I2C chip yourself: scan the bus as i2cdetect does, read one register and a block of them from a BME280, let a driver do the datasheet’s math, and read the error when nobody answers.
Open it in the simulatorThe Raspberry Pi’s hardware from Python: gpiozero beyond blinking, I2C sensors with smbus2, an SPI ADC with spidev, a servo gauge needle, your own OLED driver and callbacks, ending in a Pi weather terminal.
0 of 7 done
7 lessons in 4 chapters, about 6 hours on a simulated Raspberry Pi 4 Model B. Free, in your browser, every step checked by the simulator.
Talk to an I2C chip yourself: scan the bus as i2cdetect does, read one register and a block of them from a BME280, let a driver do the datasheet’s math, and read the error when nobody answers.
Open it in the simulatorA servo as a barometer’s needle: a 50 Hz pulse from 1 ms to 2 ms sets its angle, a duty cycle from 5 to 10 percent with RPi.GPIO PWM, and air pressure mapped onto 180 degrees.
Open it in the simulatorLet the button call your code: when_pressed, when_released and when_held with hold_time, a counter shared with the callbacks, and a main loop that stays free the whole time.
Open it in the simulatorEach lesson opens when the one before it is done, and each chapter ends in a project.
gpiozero’s devices, and a sensor register by register.
Devices with a value, not just on and off: PWMLED brightness, blink a set number of times, a pulse that runs in the background, and devices wired to each other with source.
0 of 7 steps
Talk to an I2C chip yourself: scan the bus as i2cdetect does, read one register and a block of them from a BME280, let a driver do the datasheet’s math, and read the error when nobody answers.
0 of 7 steps
An ADC over SPI, and a servo needle on PWM.
The Pi has no analog inputs, so an MCP3008 converts for it over SPI. Send the three bytes yourself with spidev and decode the 10-bit answer, then let gpiozero’s MCP3008 do the same in one line.
0 of 5 steps
A servo as a barometer’s needle: a 50 Hz pulse from 1 ms to 2 ms sets its angle, a duty cycle from 5 to 10 percent with RPi.GPIO PWM, and air pressure mapped onto 180 degrees.
0 of 7 steps
Your own OLED driver, and code the hardware calls.
Write the driver yourself: the SSD1306’s setup commands, a 1024-byte framebuffer where each byte is eight stacked pixels, pixel() with bit arithmetic, and show() in 16-byte I2C writes. Then a bar graph of the knob.
0 of 6 steps
Let the button call your code: when_pressed, when_released and when_held with hold_time, a counter shared with the callbacks, and a main loop that stays free the whole time.
0 of 7 steps
A Pi weather terminal from the whole bench.
The whole bench as one device: BME280 readings on the OLED, a knob that turns the pages, a servo pressure needle, a damp-air light, and a button that logs readings to a CSV file.
0 of 8 steps
All 7 lessons, in order, each with what it covers. Any of them opens in the editor right away.
Every lesson runs in the simulator with nothing to buy. When you want the real thing, these kits have the parts.
Pick the starter kit you own and run every lesson in its manual with the same parts on the same pins.
See every kitYes. All 7 lessons of Pi hardware in Python: I2C, SPI and PWM are free and run in your browser, with nothing to install and no parts to buy before you start.
No. Every lesson runs on a simulated Raspberry Pi 4 Model B with its parts on the canvas, and the simulator checks each step as you go. When you want to build it for real, the same wiring and code work on a real board.
About 6 hours: 7 lessons in 4 chapters, each one a few short steps. Your progress is kept, so you can stop after any lesson and pick up where you left off.
Each chapter ends in a project that puts it together: smbus2 sensors, PWM servos: a gauge needle and Callbacks.
With "gpiozero beyond basics", and each lesson builds on the one before it. New to circuits? Electronics basics is the course that starts from zero.