Embedded systems and IoT
A hands-on microcontroller course at Arduino, ESP32 and STM32 level: pins and pull-ups, interrupts, timers and PWM, ADCs and sensors, UART, I2C and SPI drivers, registers and the memory map, FreeRTOS tasks, low power, watchdogs, and connecting to the internet with Wi-Fi and MQTT. It ends with a battery sensor node you could build. Every lesson is a board you can step through, then a short quiz. Assembly language is out of scope: we stay in C and C++.
Getting started with a microcontroller
Choosing a board and getting your code onto it. The Hardware lesson on microcontrollers explains what is inside the chip, so this module stays on boards, toolchains and your first firmware; the C++ basics lessons cover the language used here.
-
Lesson 01 · 10 min
Where embedded systems live and what limits them
10 stepsNot started -
Lesson 02 · 12 min
A tour of Arduino, ESP32 and STM32 boards
10 stepsNot started -
Lesson 03 · 12 min
From code to chip: compile, link and flash
10 stepsNot started -
Lesson 04 · 10 min
setup() and loop(): the superloop
10 stepsNot started -
Lesson 05 · 10 min
Blink: your first firmware
10 stepsNot started -
Lesson 06 · 12 min
Debugging with serial print
10 stepsNot started
Digital pins: inputs and outputs
Driving LEDs and reading buttons safely. Uses voltage dividers from the Circuits course and the Hardware lesson on transistors.
-
Lesson 07 · 10 min
Digital output: driving an LED
7 stepsNot started -
Lesson 08 · 12 min
Pin current limits and driving loads with a transistor
9 stepsNot started -
Lesson 09 · 10 min
Digital input and logic levels
8 stepsNot started -
Lesson 10 · 12 min
Pull-up and pull-down resistors
9 stepsNot started -
Lesson 11 · 10 min
Debouncing a button
9 stepsNot started -
Lesson 12 · 12 min
3.3 V and 5 V: level shifting
10 stepsNot started
Interrupts, timers and PWM
Reacting fast, keeping time without blocking, and structuring firmware as a state machine. The Hardware lesson on interrupts and I/O explains why polling wastes time and the Hardware lesson on state machines covers Moore and Mealy machines; the Circuits lesson on RC circuits explains PWM smoothing. Here you write the firmware.
-
Lesson 13 · 12 min
Interrupts in firmware: attachInterrupt, edges and latency
10 stepsNot started -
Lesson 14 · 12 min
volatile and sharing data with an ISR
9 stepsNot started -
Lesson 15 · 12 min
Hardware timers, prescalers and millis()
9 stepsNot started -
Lesson 16 · 12 min
PWM: dimming an LED
10 stepsNot started -
Lesson 17 · 14 min
Driving a servo and a one-way DC motor with a MOSFET
11 stepsNot started -
Lesson 18 · 12 min
Non-blocking code: replacing delay()
9 stepsNot started -
Lesson 19 · 12 min
Event-driven firmware as a state machine
10 stepsNot started
Analog: ADC, DAC and sensors
Turning the physical world into numbers and back. The Signals lessons on quantization, ADCs and DAC reconstruction explain the converters inside, and the Signals lessons on moving averages and IIR filters explain the smoothing used here; the Circuits op-amp lesson covers signal conditioning.
-
Lesson 20 · 12 min
Reading an analog pin
9 stepsNot started -
Lesson 21 · 12 min
Reference voltage, resolution and scaling
9 stepsNot started -
Lesson 22 · 14 min
Sensors: potentiometer, thermistor and light
9 stepsNot started -
Lesson 23 · 12 min
Smoothing noisy readings
8 stepsNot started -
Lesson 24 · 12 min
Making a voltage: DAC and filtered PWM
9 stepsNot started -
Lesson 25 · 12 min
Calibrating a sensor
8 stepsNot started
UART, I2C and SPI in firmware
Talking to other chips from your code. The Hardware lesson on serial buses explains the wires and the Hardware lesson on test and debug shows what a logic analyser is; here you write the drivers and use the analyser to find bugs in them. The UART ring buffer is the one from the DSA lesson on queues and ring buffers.
-
Lesson 26 · 14 min
UART in firmware: baud rate and ring buffers
10 stepsNot started -
Lesson 27 · 14 min
I2C in firmware: addresses, registers and ACKs
10 stepsNot started -
Lesson 28 · 14 min
SPI in firmware: modes and chip select
10 stepsNot started -
Lesson 29 · 14 min
Debugging your driver with a logic analyser: triggers, NACKs and glitches
10 stepsNot started -
Lesson 30 · 14 min
Writing a sensor driver from a datasheet
10 stepsNot started
Registers and the memory map
What digitalWrite() really does, ending with setting up DMA by hand. Builds on the C++ lessons on pointers, the Hardware lessons on registers and ROM and flash, and the OS lesson on polling, interrupts and DMA.
-
Lesson 31 · 12 min
The memory map: flash, RAM and peripherals
10 stepsNot started -
Lesson 32 · 12 min
Peripheral registers and bit masks
9 stepsNot started -
Lesson 33 · 12 min
Blink with registers, no library
10 stepsNot started -
Lesson 34 · 14 min
Reset, the vector table and startup code
8 stepsNot started -
Lesson 35 · 12 min
Living in 2 KB of RAM: stack, heap and globals
10 stepsNot started -
Lesson 36 · 12 min
Configuring DMA: moving data without the CPU
10 stepsNot started
Bare metal versus an RTOS
Running many jobs at once with FreeRTOS. The general theory lives in the OS course: semaphores, locks, the producer-consumer problem, deadlock, scheduling and real-time scheduling with deadlines and worst-case execution time. The C++ lesson on threads and atomics covers the language side. Here you use the FreeRTOS API: ticks, xQueueSend and semaphores given from an ISR.
-
Lesson 37 · 12 min
When the superloop is not enough
10 stepsNot started -
Lesson 38 · 14 min
FreeRTOS tasks and priorities
9 stepsNot started -
Lesson 39 · 14 min
The FreeRTOS tick and how it picks a task
11 stepsNot started -
Lesson 40 · 14 min
FreeRTOS queues: xQueueSend from tasks and ISRs
8 stepsNot started -
Lesson 41 · 14 min
FreeRTOS mutexes and waking a task from an ISR
10 stepsNot started -
Lesson 42 · 14 min
Priority inversion and priority inheritance
11 stepsNot started
Low power and reliability
Running for months on a battery and recovering from faults. Builds on the Hardware lessons on power supplies and batteries.
-
Lesson 43 · 14 min
Power budgets and battery life
11 stepsNot started -
Lesson 44 · 14 min
Sleep modes and wake-up sources
9 stepsNot started -
Lesson 45 · 12 min
Watchdog timers
9 stepsNot started -
Lesson 46 · 14 min
Brown-out, resets and fault handling
10 stepsNot started -
Lesson 47 · 14 min
Saving data in EEPROM and flash
8 stepsNot started
Connectivity and the capstone node
Putting your device on the network. The Networking lessons on Wi-Fi, Bluetooth, Zigbee and IoT with MQTT explain the protocols; here you use them from an ESP32.
-
Lesson 48 · 14 min
Joining Wi-Fi from an ESP32
10 stepsNot started -
Lesson 49 · 12 min
Publishing sensor data with MQTT
10 stepsNot started -
Lesson 50 · 14 min
A BLE sensor: services and characteristics
10 stepsNot started -
Lesson 51 · 14 min
Over-the-air updates and rollback
10 stepsNot started -
Lesson 52 · 14 min
Securing a device: TLS, secrets and secure boot
11 stepsNot started -
Lesson 53 · 15 min
Capstone: a battery sensor node
9 stepsNot started
Special topics
Stand-alone deep dives. Take them any time after the module they build on. GDB debugging assumes the Hardware lesson on test and debug (what SWD and JTAG are); motor control links the Control lesson on DC motor speed for closed-loop speed; testing on your laptop uses the Software lesson on unit testing and the Python lesson on pytest.
-
Lesson S1 · 14 min
Firmware debugging with GDB: watchpoints, hard faults and ISRs
Builds on Registers and the memory map
10 stepsNot started -
Lesson S2 · 14 min
Character LCD and OLED displays
Builds on UART, I2C and SPI in firmware
11 stepsNot started -
Lesson S3 · 12 min
MicroPython on the ESP32
Builds on Getting started with a microcontroller
10 stepsNot started -
Lesson S4 · 14 min
H-bridges, motor direction and stepper motors
Builds on Interrupts, timers and PWM
11 stepsNot started -
Lesson S5 · 12 min
Testing firmware on your laptop
Builds on Bare metal versus an RTOS
10 stepsNot started