An embedded system is a computer built into a device to do a specific job. The controller in a thermostat, the engine management unit in a car, the processor in a camera — all embedded systems. The design decisions differ fundamentally from software on a general-purpose computer: resources are constrained, real-time behaviour often matters, and the software usually can't be patched in the field. Getting the architecture right early matters far more than it does for desktop software.
DSP, motor control, USB, Ethernet, real-time control
ARM Cortex-M33
STM32L5, nRF9160
Various
64–64 MHz
Security features (TrustZone), low-power IoT
Application processor
Raspberry Pi, BeagleBone, iMX6
512MB–4GB RAM
1–2+ GHz
Linux OS required, networking, complex UI, camera
The RP2040 (Raspberry Pi Pico, $1–4) stands out for its Programmable I/O (PIO) — 8 small state machines that implement custom serial protocols in hardware without touching the CPU. It can bit-bang SPI, UART, WS2812B LED protocols, and VGA signals in hardware at high speed.
Communication Interfaces
Interface
Wires
Speed
Multi-device
Half/Full duplex
Best for
UART
2 (TX, RX)
Up to ~12 Mbps
No (point to point)
Full
Debug, GPS, BT modules, PC communication
SPI
4 (MOSI, MISO, SCK, CS per device)
Up to 100+ Mbps
Yes (one CS per device)
Full
Displays, SD cards, ADCs/DACs, SPI Flash
I2C
2 (SDA, SCL)
100k–3.4 Mbps
Yes (127 devices, 7-bit addr)
Half
Sensors, EEPROMs, RTC, BME280, MPU-6050
1-Wire
1 (+ GND)
~15 kbps
Yes (ROM address per device)
Half
DS18B20 thermometer, iButton authentication
CAN
2 (CAN_H, CAN_L differential)
Up to 1 Mbps (CAN FD: 8 Mbps)
Yes (multi-master)
Half
Automotive, industrial — high noise immunity
USB
4 (D+, D−, VBUS, GND)
1.5–480 Mbps
Yes (host-controlled)
Half
PC connectivity, HID, CDC (virtual COM port)
Ethernet
Twisted pair + magnetics
10/100/1000 Mbps
Yes (IP addressing)
Full
Internet connectivity, industrial, Modbus/TCP
I2C Pull-up Resistors
Both SDA and SCL lines require pull-up resistors to VCC, as I2C devices only pull the lines low (open-drain).
Required: 4.7kΩ pull-up to VCC on both SDA and SCL
For fast I2C (400kHz) or many devices:
Use 2.2kΩ pull-ups (stronger pull, faster edges, more current)
For long cables or 3.3V systems:
Use 4.7kΩ → 10kΩ (weaker pull, slower, but lower current and less ringing)
Maximum pull-up resistance: R_max = 0.8V / I_ol(min) for standard mode
At 100kHz: V_OH = 0.8V, I_ol min = 3mA → R_max ≈ 267Ω (absolute minimum)
Practical: 2.2kΩ – 10kΩ for most designs
Context switch overhead, complexity, stack usage per task
FreeRTOS Basics
Tasks: each has own stack, priority, and function
Queues: pass data between tasks safely (thread-safe FIFO)
Semaphores: synchronise tasks (binary: signal/wait)
Mutexes: protect shared resources from concurrent access
Timers: callback after delay or periodically (timer task)
Task priorities: higher number = higher priority
Idle task runs at priority 0
Your tasks: 1 (low) to configMAX_PRIORITIES-1 (high)
Stack sizing: each task needs its own stack
Start with configMINIMAL_STACK_SIZE × 2
Use uxTaskGetStackHighWaterMark() to check if stack is adequate
Power Management for Battery Devices
Battery life = Battery_capacity / Average_current
Example:
2000 mAh Li-ion cell
Active: 20mA for 10ms every 10 seconds
Sleep: 5µA for the rest
Avg current = (20mA × 10ms + 5µA × 9990ms) / 10,000ms
= (0.2 mAs + 49.95 mAs) / 10,000ms
= 50.15 µA average
Battery life = 2000 mAh / 0.05015 mA ≈ 39,872 hours ≈ 4.5 years
Strategy
Savings
Notes
Deep sleep / hibernate
High (µA vs mA)
Wake on GPIO interrupt or RTC alarm. Shortest wake time for longest battery life.
Disable peripheral clocks
Moderate
Unused UART, SPI, I2C blocks burn clock power even idle
Lower clock frequency
Moderate
Dynamic power ∝ f × C × V². Minimum clock for required throughput.
Reduce supply voltage
High
Dynamic power ∝ V². 1.8V vs 3.3V saves (1.8/3.3)² ≈ 30% of dynamic power
Power gate peripherals
High
Enable pin or MOSFET switch for sensors, radios, displays — off between uses
Use DMA for I/O
Moderate
CPU sleeps while DMA transfers data — reduces active time
Debugging Tools
Tool
What it does
Cost
Notes
SWD / JTAG debugger
Program, breakpoints, register/memory inspection
$10–$500
ST-Link V2 (~$3 clone) works for STM32. CMSIS-DAP for universal ARM.
Logic analyser
Capture and decode SPI, I2C, UART, CAN, etc.
$10–$400
Cheap Cypress FX2 clones work with PulseView (open source). Saleae for professional use.
Oscilloscope
Analog waveforms, timing, noise, power rails
$100–$50,000
Rigol DS1054Z (~$350) is excellent entry-level. 4 channels, 50MHz.
Serial debug (printf via UART)
Print state, variable values, timestamps to terminal