Introduction to Embedded Systems
What embedded systems are and how they differ from general-purpose computers
Skills taught: embedded.basics
What is an Embedded System?
An embedded system is a computer designed for a specific purpose, embedded within a larger device. Unlike a laptop that runs arbitrary software, an embedded system executes dedicated firmware — the program is fixed and runs from power-on to power-off. Examples surround you: the ABS controller in your car, the thermostat on your wall, the chip inside a smart lightbulb.
Microcontroller vs Microprocessor
- Microcontroller (MCU): CPU + RAM + Flash + peripherals on a single chip
- Microprocessor (MPU): CPU-only chip; needs external RAM, storage, and peripherals
Common Embedded Platforms
Platform CPU RAM Flash WiFi/BT Use Case
─────────────────────────────────────────────────────────────────────
Arduino Uno AVR ATmega328P 2 KB 32 KB No Learning, prototyping
ESP32-WROOM Xtensa LX6 240MHz 520 KB 4 MB WiFi+BT IoT devices
ESP8266 Xtensa L106 80MHz 80 KB 4 MB WiFi Low-cost WiFi nodes
STM32F103 ARM Cortex-M3 20 KB 64 KB No Industrial control
Raspberry Pi 4 ARM Cortex-A72 1-8 GB — WiFi+BT Edge computing, Linux
Raspberry Pi ARM Cortex-A53 512 MB — WiFi+BT Headless sensor hubs
Zero W
The Embedded Development Loop
Embedded development follows a cycle: write firmware on your PC → compile to machine code → flash (upload) to the MCU via USB/JTAG → run & observe via serial monitor or LEDs → debug and repeat. The Arduino IDE and PlatformIO handle this cycle with one-click uploads.
// The 'Hello World' of embedded: blink an LED
// Runs on Arduino Uno, Nano, Mega, ESP32, etc.
const int LED_PIN = 13; // Built-in LED on most Arduino boards
void setup() {
// Called once at power-on or reset
pinMode(LED_PIN, OUTPUT);
Serial.begin(115200);
Serial.println("Embedded system started!");
}
void loop() {
// Called repeatedly, forever
digitalWrite(LED_PIN, HIGH); // Turn LED on
Serial.println("LED ON");
delay(1000); // Wait 1 second
digitalWrite(LED_PIN, LOW); // Turn LED off
Serial.println("LED OFF");
delay(1000);
}
Tip: Arduino is the best starting point for embedded programming. For production IoT, consider the ESP32 (built-in WiFi/Bluetooth) or STM32 (more powerful peripherals). Arduino-style programming works on all three.
Warning: Never connect 5V signals to a Raspberry Pi GPIO pin — it uses 3.3V logic and 5V will permanently damage the GPIO controller. Always check your board's voltage level before wiring sensors.
Real-Time vs General-Purpose
A key concept in embedded systems is real-time operation: the system must respond to events within a guaranteed time window. A car's ABS must respond to a wheel-slip event in under 10 ms — if it misses that window, the response is useless or dangerous. General-purpose computers (Linux, Windows) have no such guarantees because the OS scheduler can preempt your code at any moment.
- Hard Real-Time
- Missing a deadline is a system failure. Used in safety-critical systems: ABS, pacemakers, flight controls.
- Soft Real-Time
- Missing a deadline degrades quality but doesn't cause failure. Example: video streaming — a late frame causes a glitch but not a crash.
Frequently Asked Questions
Can an Arduino run Linux?
No. The Arduino Uno has only 2 KB of SRAM and 32 KB of flash — far too little for Linux. Linux needs at least 4 MB RAM. Use a Raspberry Pi if you need a full OS.
What language do you use for embedded programming?
C and C++ are the standard. Arduino uses C++ with a simplified API. MicroPython brings Python to microcontrollers (ESP32, RP2040) but with a performance cost.
What is the difference between Arduino Uno and ESP32?
The ESP32 is far more powerful: 240 MHz dual-core vs 16 MHz, 520 KB RAM vs 2 KB, plus built-in WiFi and Bluetooth. ESP32 costs about the same ($3–5) but can't use all Arduino shields directly.