Week 04 – Embedded Programming
Han Ferik
Assignments:
Check Out Our Group Assignment
Group assignment:
Demonstrate and compare the toolchains and development workflows for available embedded architectures
Document your work to the group work page and reflect on your individual page what you learned
Individual assignment:
Browse through the datasheet for a microcontroller
Write and test a program for an embedded system using a microcontroller to interact (with local input &/or output devices) and communicate (with remote wired or wireless connections)
Bill of Materials
Core Board
Raspberry Pi Pico W
Micro-USB cable
For Experiments
Breadboard
Jumper wires (Male-Male, Male-Female)
LEDs (5mm)
Servo motor (SG90 recommended)
HC-SR04 Ultrasonic sensor
L298N Motor driver module
DC motor
External 5–9V battery (for motor driver)
Introduction to the Raspberry Pi Pico W

Source: Raspberry Pi Website
The RP2040 Microcontroller:
The Pico W is built around the:
RP2040 microcontroller (designed by Raspberry Pi)
Core Processor Specifications
| Feature | Description |
|---|---|
| Dual-Core | 2 × ARM Cortex-M0+ |
| Clock Speed | Up to 133 MHz |
| RAM | 264 KB SRAM |
| Flash | 2 MB external flash |
| Programmable I/O | PIO state machines (very powerful feature!) |
| ADC | 12-bit ADC |
| PWM | 16 PWM channels |
Advanced Feature: PIO (Programmable IO) This is what makes RP2040 special. It allows you to create custom hardware protocols in software.
You can:
Create custom communication protocols
Drive displays
Generate precise signals
Model Comparison: Pico vs. Pico W
| Feature | Pico | Pico W |
|---|---|---|
| RP2040 Chip | ✅ | ✅ |
| Wi-Fi | ❌ | ✅ |
| Bluetooth | ❌ | ✅ (BLE) |
| Wireless Chip | ❌ | Infineon CYW43439 |
The Pico W includes:
Infineon CYW43439
Supports:
2.4 GHz WiFi
Bluetooth Low Energy (BLE)
It communicates internally with RP2040 using SPI.
Technical Specifications
| Parameter | Value |
|---|---|
| CPU | Dual ARM Cortex-M0+ |
| Clock | 133 MHz |
| RAM | 264 KB |
| Flash | 2 MB |
| GPIO | 26 usable |
| ADC | 3 external channels |
| PWM | 16 channels |
| Logic Level | 3.3V |
| Wireless | 802.11n WiFi + BLE |
Hardware Architecture

Source: www.mischianti.org
Pinout Overview
The Pico W has:
40 pins total
26 GPIO pins
3 ADC pins
Power pins
Ground pins
Power Pins
| Pin | Function |
|---|---|
| VBUS | 5V from USB |
| VSYS | Main power input (1.8–5.5V) |
| 3V3(OUT) | 3.3V regulated output |
| GND | Ground |
Safety & Power (VERY IMPORTANT)
3.3V LOGIC ONLY
The Pico W GPIO pins:
MAX voltage: 3.3V
If you connect 5V → you can permanently damage the board
Power Paths Explained
USB plugged → 5V on VBUS
VSYS feeds onboard regulator
Regulator outputs stable 3.3V
Never power motors directly from Pico.
GPIO Capabilities
Each GPIO can:
Digital input
Digital output
PWM
I2C
SPI
UART
ADC pins:
GP26
GP27
GP28
Initial Setup & Firmware
Flashing MicroPython (BOOTSEL Method)
- Hold BOOTSEL button

Plug USB into computer
Release BOOTSEL
A drive appears named:
RPI-RP2
- Drag MicroPython UF2 file into it (Access MicroPython UF2 From Here)

- Board reboots automatically
You’re done.
Setup Thonny IDE
Install Thonny (Download Thonny From Here)
Open Thonny
Go to:
Tools → Options → Interpreter
- Select:
MicroPython (Raspberry Pi Pico)
Choose correct COM port
Click OK

You should now see:
>>>
REPL prompt.
Experimenting with Our Microcontroller
Blink Onboard LED
The Pico W onboard LED is connected differently than standard Pico.
On Pico W, LED is controlled through wireless chip.
PHASE 1 – Blink Code
import network
import time
from machine import Pin
led = Pin("LED", Pin.OUT)
while True:
led.toggle()
time.sleep(0.5)
Run it.
If LED blinks → your environment is correct.
Blink External Led
Wiring
| Component | Connect To |
|---|---|
| LED long leg | GP15 |
| LED short leg | 220Ω resistor |
| Resistor other side | GND |
PHASE 2 – External LED Blink Code
from machine import Pin
import time
led = Pin(15, Pin.OUT)
while True:
led.on()
time.sleep(1)
led.off()
time.sleep(1)
Run it and see if the external led blinks
Be careful to not put resistor’s legs with led’s legs

