← Back to Lectures
HalesAir Logo
HalesAir · Session 02

Hardware &
Electronics

Halesowen College · T Level Data Analytics

Raspberry Pi Pico W overview GPIO and I2C communication BME680 sensor board Breadboarding your first circuit
💻

Part 1
Raspberry Pi Pico W

Microcontrollers · Architecture · Wi-Fi

Microcontroller vs Microprocessor

Microprocessor (CPU)

  • Powerful general-purpose chip
  • Needs external RAM, storage, peripherals
  • Runs full operating systems (Linux, Windows)
  • High power draw — needs cooling
  • Examples: Intel i5, Apple M4, Raspberry Pi 4

Microcontroller (MCU)

  • CPU + RAM + Flash + I/O all on one chip
  • Designed to run a single dedicated program
  • Very low power — can run on batteries
  • Starts instantly, runs indefinitely
  • Examples: Pico W, Arduino Uno, ESP32

For our project, a microcontroller is ideal — it boots in milliseconds, sips power from a USB socket, and runs our sensor loop 24/7 without any user intervention.

The Raspberry Pi Pico W

Core hardware

  • RP2040 chip — designed by Raspberry Pi in the UK
  • Dual-core ARM Cortex-M0+ @ 133 MHz
  • 264 KB SRAM · 2 MB Flash memory
  • 26 GPIO pins · 3 × SPI · 2 × I2C · 2 × UART
  • 12-bit ADC for analogue sensors
5V USB powered 3.3V logic 40 pin ~£6

The 'W' — Wi-Fi

  • Infineon CYW43439 wireless chip
  • 802.11n 2.4 GHz Wi-Fi (single-band)
  • MicroPython's network module connects to WPA2
  • Can act as a Wi-Fi access point too

Important: The college Wi-Fi uses enterprise authentication (802.1x). We will use a mobile hotspot during initial testing.

Source: Raspberry Pi Ltd — datasheets.raspberrypi.com/picow
🔌

Part 2
GPIO & I2C Communication

How the Pico talks to the sensor

GPIO Pins — General Purpose I/O

What they are

  • Physical pins on the Pico — programmable in software
  • Input: read a button, a sensor signal, a switch
  • Output: light an LED, trigger a relay, send a signal
  • Digital: HIGH (3.3V) or LOW (0V)
  • 3 pins can also do ADC — analogue voltage reading

In MicroPython

Read a pin

from machine import Pin
btn = Pin(15, Pin.IN)
print(btn.value())

Write a pin

led = Pin(25, Pin.OUT)
led.value(1) # HIGH → on
led.value(0) # LOW → off

I2C — The Sensor Protocol

Inter-Integrated Circuit — a 2-wire serial bus invented by Philips (1982)

How it works

  • Just 2 wires carry all communication: SDA and SCL
  • One controller (Pico) + one or more targets (sensors)
  • Every device has a unique 7-bit address
  • BME680 default address: 0x76 or 0x77
  • Controller sends address, target responds with data
  • Can chain up to 127 devices on one bus pair
Pico W (controller) ├── SDA (GP4) ───────────┐ │ │ └── SCL (GP5) ─────────┐ │ │ │ BME680 (target) addr: 0x76 sends: temp · hum pres · gas

Why I2C and not SPI? SPI is faster but needs 4 wires per device. I2C's 2-wire bus is perfect for slow sensors where we want clean wiring.

Source: NXP Semiconductors — I2C-bus specification UM10204
🔬

Part 3
Wiring the BME680

4 connections. One sensor. All the data.

Connecting BME680 → Pico W

Only 4 jumper wires needed — power, ground, data, clock

BME680 pin Wire colour (convention) Pico W pin Why
VCC Red 3V3 (pin 36) Powers the sensor — 3.3 V, not 5 V
GND Black / Brown GND (pin 38) Completes the circuit
SDA Yellow GP4 (pin 6) Serial data line (I2C bus 0)
SCL Blue / White GP5 (pin 7) Serial clock line (I2C bus 0)

Critical: Always use the 3V3 pin (3.3 V), never the VBUS pin (5V) — the BME680 is a 3.3 V device. 5 V will destroy the sensor permanently.

How a Breadboard Works

The rows and rails

  • Each numbered row (1–30 etc.) connects horizontally
  • Left and right halves are not connected to each other
  • The coloured rails (+/−) run vertically — use for power & ground
  • Components straddle the central gap to avoid short circuits

No soldering. No permanent connections. Perfect for prototyping — pull a wire and fix your mistake.

Our setup

  • Pico W bridges the central gap — straddles both halves
  • 3V3 → red rail, GND → blue rail
  • BME680 module sits nearby on the same breadboard
  • 4 jumper wires complete the I2C connection

Check before powering on: Ask a partner to verify your wiring against the table before connecting USB.

🛠️

Part 4
Build Your Node

Hands-on assembly · Time to wire up

Activity: Assemble Your Sensor Node

⏱ 20 minutes

Follow the wiring table and build your breadboard circuit.

1

(3 min) Orient the Pico W so it straddles the central gap. Confirm the USB port is accessible from the edge of the board.

2

(5 min) Connect 3V3 → red rail and GND → blue rail using jumpers. Verify polarity before going further.

3

(5 min) Place the BME680 module. Wire SDA → GP4 and SCL → GP5 using a yellow and blue jumper respectively.

4

(7 min) Peer review: Swap boards with your neighbour. Cross-check the 4 connections against the wiring table. Only connect USB once both reviewers agree.

💡 If the Pico's LED blinks when you connect USB, it has power. If MicroPython is already flashed, the REPL prompt will appear in Thonny.

Verify: Scan the I2C Bus

Quick check — does the Pico see the BME680?

In Thonny REPL — type this

from machine import I2C, Pin i2c = I2C(0, sda=Pin(4), scl=Pin(5)) print(i2c.scan())

Expected output

[118] — hex 0x76, the BME680 address ✓

What the numbers mean

  • [] — empty list → sensor not found → check wiring
  • [118] — BME680 found at 0x76 → wiring correct ✓
  • [119] — BME680 at 0x77 → also valid ✓
  • [104, 118] — two devices found → normal if two sensors

Nothing shows? Power off → re-check VCC and GND → re-scan. Never wiggle wires while powered on.

Coming Up — Session 03

Date TBC · MicroPython Fundamentals

What we'll cover

Writing your first sensor-reading loop in MicroPython — variables, while True, formatted output, and your first live readings from the BME680.

Before next session: Install Thonny IDE on your device — free at thonny.org. We'll use it to write and upload code.

Optional reading: MicroPython Quick Reference for RP2040 at micropython.org/rp2

Questions? Get in touch:

jwilliams.science · HalesAir Project