>
section 11 of 132 min read

11. Real-World Stories

A microwave oven controller (8051)

The keypad is a 3×4 matrix on P1; the 7-segment display is two digits multiplexed by P2 + decoder; the magnetron and turntable run from P3 outputs through relays and triacs; the door switch is on INT0 (P3.2). Software is a state machine: idle, time-set, cooking, paused. Timer 0 generates a 100 ms tick; each tick decrements the cook-time counter and refreshes the display; INT0 fires on door open and immediately turns off the magnetron. Total code: about 2 KB, fits comfortably in the 8051's 4 KB ROM. 45 years on, this exact pattern still ships in millions of microwaves.

A hobby drone flight controller (Cortex-M4)

STM32F4 at 168 MHz with FPU, 192 KB SRAM, 1 MB Flash. SPI to the IMU (gyroscope + accelerometer + magnetometer). UART to the GPS module. PWM outputs to four ESCs (Electronic Speed Controllers) driving the brushless motors. Radio receiver on UART or SBUS. Inside: PID control loops at 1–4 kHz, sensor fusion via complementary filter or extended Kalman filter, motor mixing matrix, telemetry. The math benefits from the FPU; the timing benefits from the deterministic NVIC; the peripherals (PWM, UART, SPI all multiple instances) come on-chip "for free."

A USB keyboard (Cortex-M0 or AVR)

A Cortex-M0 with USB peripheral and 8 KB Flash. Firmware: matrix-scan rows as outputs, columns as inputs, debounce in software (typically 5 ms), build a HID report with the currently-pressed keys, send via USB at 1000 Hz polling. About 5 KB of code. Total bill of materials: chip ($1), keycaps, switches, PCB. Tens of millions per year.

A wireless remote (nRF52)

Nordic's nRF52 is a Cortex-M4 + Bluetooth-LE radio in one chip. Used in: wireless mice, keyboards, fitness bands, smart-home buttons, asset trackers. Total chip count: one. Total firmware: typically 30–80 KB.

An IoT temperature sensor (ESP32)

ESP32 dual-core (Tensilica or RISC-V depending on variant) + Wi-Fi + Bluetooth. Reads a DHT22 or BMP280 sensor over I²C, posts to MQTT every minute, sleeps in between. Battery life: months on AA cells thanks to deep-sleep modes. This is the canonical "IoT sensor" pattern.