By Kevin McAleer, 3 Minutes
Page last updated November 24, 2026

Before we wire anything, let’s gather the parts and agree on a pin plan. If every lesson uses the same pins, the programs you write in lesson 5 will still work in lesson 14.
| Part | What it is for | Needed from |
|---|---|---|
| Raspberry Pi Pico W | The brain. A plain Pico works too, without Wi-Fi | Lesson 3 |
| Reed switch (normally open) | Senses the magnet | Lesson 3 |
| Neodymium magnet, around 10mm | Goes on the door | Lesson 3 |
| 0.96 inch SSD1306 OLED, I2C, 128x64 | The status screen | Lesson 6 |
| Small speaker or piezo buzzer | SAM’s voice | Lesson 9 |
| 1K resistor (optional) | Smooths out pops and clicks from the speaker | Lesson 9 |
| Jumper wires and a breadboard | Connecting it all | Lesson 3 |
Strong neodymium magnets work best. The cheap black ceramic ones may not be strong enough to close a reed switch from a useful distance.
You also need Thonny (or mpremote) and MicroPython on your Pico. If you haven’t set that up, Learn MicroPython - The basics walks you through it.
Here is every connection the finished buddy uses:
| Part | Connects to | Pico pin |
|---|---|---|
| Reed switch, one side | GP15 | Pin 20 |
| Reed switch, other side | GND | Pin 23 |
| OLED SDA | GP4 | Pin 6 |
| OLED SCL | GP5 | Pin 7 |
| OLED VCC | 3.3V | Pin 36 |
| OLED GND | GND | Pin 38 |
| Speaker positive (through the optional 1K resistor) | GP0 | Pin 1 |
| Speaker negative | GND | Any GND pin |
Notice that the OLED is on GP4 and GP5. Kev’s OLED post uses GP0 and GP1 for I2C, but the SAM speech library drives its speaker from GP0. Both can’t have the same pin, so in this course the display moves to GP4 and GP5, which are a standard I2C0 pair on the Pico. If you follow the OLED post separately, remember that difference.
Important: Power the OLED from the 3.3V pin, not 5V. Most OLED modules expect 3.3V logic, and 5V might damage them.
In lesson 13 we move these numbers into a single config.py, so that porting the buddy to a different board only means editing that one file. Until then, each lesson sets the pins at the top of its program so you can see exactly what is going on.
Problem: My display’s pins are in a different order from the table.
Solution: Go by the labels printed on the module (VCC, GND, SCL, SDA), not by position.
Why: Manufacturers arrange the four pins in different orders, and the labels are the only reliable guide.
Comments