# Embedded Systems and Microcontrollers — Arduino & Embedded C

Source: https://www.geekswithgeeks.com/en/arduino-embedded-c/mcu-basics

> A computer on one chip, dedicated to one job.

## Microcontroller, microprocessor or single-board computer?

An **embedded system** is a computer built into a product to do a specific job: a thermostat, a washing-machine controller, a fitness tracker. Most are built around a **microcontroller (MCU)**: one chip containing a CPU core, flash memory for the program, a small amount of RAM, and peripherals such as GPIO pins, timers, an analog-to-digital converter (ADC) and serial interfaces. There is usually no operating system: your program starts at power-on and runs forever. A **microprocessor** (as in a PC) needs external RAM and storage, and a **single-board computer** such as a Raspberry Pi runs a full OS like Linux. SBCs are great for cameras, displays and networking-heavy work; MCUs win on low power, instant start-up, low cost and precise, predictable timing.

## From idea to running firmware

A microcontroller runs one program directly on its hardware; Arduino wraps it in friendly tools and libraries.

![Three ideas: microcontrollers versus computers, the Arduino ecosystem, the sketch and its build/upload flow.](assets/figures/arduino-embedded-c/section-1-map.svg) — Figure 1.1 — Microcontroller, toolchain and the sketch lifecycle.

## Comparing the options

Typical characteristics (exact figures vary by model; check the datasheet).

```text
Arduino Uno R3 (ATmega328P MCU)
  clock 16 MHz | flash 32 KB | SRAM 2 KB | EEPROM 1 KB | 5 V logic
  no OS, boots instantly, very predictable timing

ESP32 family (MCU with Wi-Fi/Bluetooth)
  dual- or single-core depending on model | hundreds of KB SRAM | 3.3 V logic
  usually runs FreeRTOS underneath the Arduino layer

Raspberry Pi (single-board computer)
  multi-core application processor | GBs of RAM | runs Linux
  boots in seconds, needs clean shutdown, timing less deterministic
```

## A Swiss Army knife versus a toolbox

A microcontroller is like a Swiss Army knife: small, self-contained and ready instantly. A single-board computer is a full toolbox: far more capable, but heavier and slower to open.

**Quiz:** Which feature is typical of a microcontroller such as the ATmega328P?

- [ ] It requires an external hard drive to boot
- [ ] Gigabytes of RAM and a Linux operating system
- [x] CPU, flash, RAM and peripherals on a single chip, running one program without an OS
- [ ] It cannot read input pins directly

*Answer:* CPU, flash, RAM and peripherals on a single chip, running one program without an OS. MCUs integrate everything needed for a dedicated control task on one chip.
