Microcontrollers 101 in 2026: what they are, the ideas you meet first, and which board to start with
What a microcontroller is and how it differs from a Raspberry Pi, the handful of ideas every beginner runs into (pull-ups, PWM, interrupts, 3.3 V versus 5 V), six boards on sale today side by side, the toolchains in plain words, and a first sketch that teaches five of those ideas with one button.
A microcontroller is a whole computer on one chip, cheap enough to put inside a toaster. This is the beginner’s tour: what it is, the ideas you meet in the first week, which board to buy in 2026, what to write the code with, and one sketch that puts five of those ideas to work with a pushbutton and the LED already on the board.
A computer on one chip
The chip on an Arduino Uno R3, the ATmega328P, holds everything a computer needs:
- a CPU, here an 8-bit one at 16 MHz;
- flash for your program (32 KB), which survives power-off;
- RAM for your variables (2 KB, which is not a typo);
- peripherals: input and output pins, an analog-to-digital converter, timers and serial ports, in the same piece of silicon.
There is no operating system. A moment after power-up your program is running, and it is the only thing on the chip.
A Raspberry Pi 5 is a different animal: a full computer that usually runs Raspberry Pi OS, which is based on Debian Linux. The operating system juggles many programs and decides when each one gets the processor, which is great for a web server and bad for a motor that must be switched at exactly the right moment. On a microcontroller only your code runs, plus the few interrupts it (or the Arduino core) sets up, so its timing is predictable. That is what “real-time” means here.
One exception: on ESP32 chips, Espressif’s framework includes FreeRTOS, a small real-time kernel that lets several tasks share the processor, and the Arduino core for ESP32 is built on it. It is still nothing like Linux, and your code is still in charge.
Rule of thumb: a screen, a database or a big Python library means a Raspberry Pi. Reading sensors, driving motors and LEDs, or starting instantly means a microcontroller. Plenty of good projects use one of each.
The ideas you meet first
GPIO. General-purpose input/output: a pin you drive HIGH or LOW, or read. Everything starts here.
Pull-ups. An input with nothing connected “floats” and reads noise. A pull-up resistor holds it HIGH until something, such as a button, pulls it to ground. pinMode(pin, INPUT_PULLUP) turns on one built into the chip (20 to 50 kΩ on the ATmega328P), so you rarely need a real one. The catch: a pressed button now reads LOW, which surprises everyone once.
ADC. The analog-to-digital converter turns a voltage into a number. On an Uno R3, analogRead() gives 0 to 1023 for 0 to 5 V on pins A0 to A5, about 4.9 mV a step. The Uno R4 starts at the same 10 bits and can go to 14; the Pico 2 has three 12-bit inputs.
PWM. Pins are digital: on or off. Pulse-width modulation switches a pin fast and varies how long it stays on, which an LED or a motor averages into “half bright” or “half speed”. analogWrite(pin, 0..255) does it in hardware, but only on some pins: on the Uno R3 and R4, pins 3, 5, 6, 9, 10 and 11 (marked ~). Pin 13, where the onboard LED lives, is not one of them.
Timers. Hardware counters that tick by themselves. The ATmega328P has three (two 8-bit, one 16-bit). They make the PWM, and on an Uno one of them counts the milliseconds millis() returns. Timing with millis() instead of delay() is the most useful habit on this list; the sketch below shows why.
Interrupts. A pin or timer event that pauses your code, runs a short function and carries on. On the Uno R3 and R4, attachInterrupt() works on pins 2 and 3; on the Nano ESP32, on every digital pin. Keep those functions tiny. For a button pressed by a human, checking the pin in loop() is fast enough and easier to get right.
UART, I2C and SPI, the three ways chips talk:
- UART (serial): transmit and receive wires, both ends agreeing on a speed.
Serial.print()reaches your computer this way. - I2C: two wires (SDA and SCL) shared by many devices, each with an address. Sensors and small displays love it. On the Uno it is A4 and A5.
- SPI: four wires plus a chip-select per device, and much faster. SD cards, bigger displays, radio modules.
3.3 V versus 5 V. The Uno R3 and R4 run their pins at 5 V; ESP32 boards and the Pico 2 at 3.3 V. Mixing them hurts in two ways:
- 5 V into a 3.3 V chip can kill it. The ESP32-C6 datasheet allows at most 0.3 V above its 3.3 V supply on an input, and Arduino’s Nano ESP32 documentation says 5 V will damage that board. The RP2350 on a Pico 2 is more forgiving (its digital pins tolerate up to 5.5 V while it is powered), but its analog pins (GP26 to GP28) are not, and its outputs are still 3.3 V. Do not build a habit on the exception.
- 3.3 V into a 5 V chip is marginal. At 5 V, the ATmega328P needs at least 3.0 V to be sure of a HIGH. 3.3 V is legal, with 0.3 V to spare.
The fix is cheap: a level-shifter board, or for one 5 V signal into a 3.3 V input, a voltage divider (10 kΩ and 20 kΩ turn 5 V into 3.33 V).
Current per pin. A pin is not a power supply. Arduino rates the Uno R3 at 20 mA per pin (the chip’s absolute maximum is 40 mA per pin, and 200 mA through its VCC and GND pins), and the Uno R4 at just 8 mA. With a red LED that drops about 2 V, a 220 Ω resistor on 5 V passes (5 − 2) / 220 ≈ 14 mA: fine on an R3, too much for an R4, where 470 Ω (about 6 mA) is the better choice. Motors, relays and LED strips never go on a pin directly: use a transistor or MOSFET, with a flyback diode across anything that has a coil.
Which board to start with
Six boards on sale today, checked on 27 November 2026 on the makers’ own pages:
| Board | Chip | Clock | Flash / RAM | Logic | Wireless | Price |
|---|---|---|---|---|---|---|
| Arduino Uno R3 | ATmega328P (8-bit AVR) | 16 MHz | 32 KB / 2 KB | 5 V | none | $27.60 ($19.32 that day) |
| Arduino Uno R4 Minima | Renesas RA4M1 (Arm Cortex-M4) | 48 MHz | 256 KB / 32 KB | 5 V | none | $20.00 ($14.00 that day) |
| Arduino Uno R4 WiFi | RA4M1, plus an ESP32-S3 for the radio | 48 MHz | 256 KB / 32 KB | 5 V | Wi-Fi, Bluetooth | $27.50 ($20.62 that day) |
| Arduino Nano ESP32 | ESP32-S3 (u-blox NORA-W106) | up to 240 MHz | 16 MB / 512 KB, plus 8 MB PSRAM | 3.3 V | Wi-Fi 4, Bluetooth 5 (LE) | $18.30 ($12.81 that day) |
| Seeed Studio XIAO ESP32C6 | ESP32-C6 (RISC-V) | 160 MHz, plus a 20 MHz low-power core | 4 MB / 512 KB | 3.3 V | Wi-Fi 6, Bluetooth 5 (LE), Zigbee, Thread | $5.20 |
| Raspberry Pi Pico 2 | RP2350 (two Arm Cortex-M33 or two RISC-V cores, your choice) | 150 MHz | 4 MB / 520 KB | 3.3 V | none (the Pico 2 W has Wi-Fi and Bluetooth 5.2) | from $5 |
Arduino prices are from its US store before tax: the list price, then the price on the day, when most boards were 30% off (the R4 WiFi 25%). The European store showed the same discounts in euros with VAT (Uno R4 Minima €22.00, €15.37 on the day). Seeed’s price is from seeedstudio.com; Raspberry Pi’s page says “available now from $5”. Prices change, so check before you order. No link here earns the site anything.
The advice, for a first board:
- Uno R4 Minima to follow the mountain of Uno tutorials with 5 V parts. It costs less than the R3 and has eight times the flash and sixteen times the RAM. Two catches: the 8 mA pin limit, and code that pokes the ATmega328P’s registers directly will not run, because it is a different chip. The R4 WiFi adds a radio and an LED matrix.
- Uno R3 if your book or kit is written for it, or you want 5 V pins rated at 20 mA rather than 8.
- Nano ESP32 or XIAO ESP32C6 when the project needs Wi-Fi. Both are 3.3 V; the C6 also has a radio for Thread and Zigbee.
- Pico 2 for the most chip for the money, or to start in Python.
The software
Arduino IDE 2 (2.3.11, released 12 November 2026) is the easy start: free, open source, with a Boards Manager for each board family and a Serial Monitor. Underneath it runs arduino-cli, the tool that compiled the sketch below. The Uno R4 needs the “Arduino UNO R4 Boards” package, other ESP32 boards use Espressif’s core (4.0.0, 19 November) and the Pico 2 uses Earle Philhower’s community core (6.4.0). The price of simplicity is control: the IDE hides how your code is built.
PlatformIO (Core 6.2.0) is a VS Code extension plus a command-line tool. Each project’s platformio.ini pins the platform and library versions, so what builds today builds next year. The Uno, the Uno R4 and ESP32 boards work out of the box. Two caveats: its ESP32 platform (8.0.0, October 2026) ships Arduino core 3.3.12, a step behind Espressif’s own, and its official Raspberry Pi platform lists only RP2040 boards, so the Pico 2 needs Maximilian Gerhardt’s community fork. More setup than the IDE; much better for anything big.
MicroPython and CircuitPython put a Python interpreter on the chip: type a line and it runs, save a file and it runs, nothing to compile. MicroPython 1.29.0 has builds for the Pico 2, the Nano ESP32 and generic ESP32-C6 boards. CircuitPython, Adafruit’s version based on MicroPython, is at 10.3.2 and supports all three boards too. On a chip with native USB, like the Pico 2’s, the board shows up as a drive called CIRCUITPY and you edit code.py on it; the ESP32-C6 has no native USB, so on the XIAO you load code over Wi-Fi with CircuitPython’s Web Workflow. Neither project lists a build for the Uno R3 or R4. Python is slower than compiled C++, and tight timing is harder, but nothing beats it for trying things out.
ESP-IDF and the Pico SDK are the chip makers’ own C toolkits, for when the Arduino layer gets in the way. ESP-IDF (v6.1.1) gives you the whole chip, FreeRTOS included, through the idf.py tool. The Pico SDK (2.3.1) is C and C++ with CMake, and Raspberry Pi’s official VS Code extension helps create and build projects. Expect to read documentation; that is the point.
A first project: one button, one LED, five ideas
You need an Uno (R3 or R4), a pushbutton and two jumper wires. Connect the button between pin 2 and GND; with a four-legged tactile switch, use a meter’s continuity mode to find two legs that connect only while it is pressed. No resistor: the sketch turns on the internal pull-up.
Each press steps the onboard LED through off, on, blink and fade. Along the way: a pull-up input, debouncing, timing with millis() and no delay(), software PWM, and serial output.
first_steps.ino
// first_steps.ino: one button cycles the onboard LED through off, on, blink and fade, without delay().
// Wiring: a pushbutton between pin 2 and GND. Nothing else; the LED is the one on the board.
// Serial Monitor at 115200 baud shows every change. geekcowboy.net, 2026. MIT licence.
const uint8_t BUTTON_PIN = 2; // the internal pull-up holds it HIGH, the button pulls it LOW
const uint8_t LED_PIN = LED_BUILTIN; // pin 13 on an Uno: not a PWM pin, so the fade is done in software
const uint32_t DEBOUNCE_MS = 30; // the pin must hold still this long before a change counts
const uint32_t CYCLE_MS = 2000; // one blink (1 s on, 1 s off) or one breath (up for 1 s, down for 1 s)
const char *const MODES[] = {"off", "on", "blink", "fade"};
uint8_t mode = 0; // which of MODES is showing
int reading = HIGH; // the pin as last read, bounces and all
int buttonState = HIGH; // the pin after debouncing
uint32_t lastChange = 0; // millis() when the reading last changed
uint32_t cycleStart = 0; // millis() when the current blink or breath began
void setup() {
pinMode(BUTTON_PIN, INPUT_PULLUP);
pinMode(LED_PIN, OUTPUT);
Serial.begin(115200);
Serial.println(F("first_steps: press the button"));
}
// True once per press: the pin went LOW and then stayed LOW for DEBOUNCE_MS.
bool buttonPressed(uint32_t now) {
int r = digitalRead(BUTTON_PIN);
if (r != reading) { // a press, a release or a bounce: start waiting again
reading = r;
lastChange = now;
}
if (reading != buttonState && now - lastChange >= DEBOUNCE_MS) {
buttonState = reading;
return buttonState == LOW;
}
return false;
}
void loop() {
// millis() goes back to 0 after about 49.7 days. "now - earlier" is still right across that, because
// unsigned subtraction wraps too; "earlier + interval" is not, so this sketch never adds to a time to compare.
uint32_t now = millis();
if (buttonPressed(now)) {
mode = (mode + 1) % 4;
cycleStart = now;
Serial.print(F("mode: "));
Serial.println(MODES[mode]);
}
while (now - cycleStart >= CYCLE_MS) cycleStart += CYCLE_MS; // whole cycles only: no drift
uint32_t t = now - cycleStart; // 0 to CYCLE_MS - 1
bool on = false;
if (mode == 1) on = true;
if (mode == 2) on = t < CYCLE_MS / 2;
if (mode == 3) {
uint32_t level = (t < CYCLE_MS / 2 ? t : CYCLE_MS - t) / 4; // brightness 0 to 250 (of 256) and back
on = ((micros() >> 3) & 255) < level; // a counter that steps every 8 us and repeats every 2 ms
}
digitalWrite(LED_PIN, on ? HIGH : LOW);
}
Upload it, open the Serial Monitor at 115200 baud and press the button four times:
first_steps: press the button
mode: on
mode: blink
mode: fade
mode: off
What it is doing
Debouncing. A mechanical contact does not close cleanly: it bounces for a few milliseconds, and a fast loop sees every bounce as a press. buttonPressed() restarts a 30 ms wait at each change of the pin and only believes the pin once it has held still for the whole wait. A real press counts once; a blip shorter than 30 ms never counts.
No delay(). delay(1000) stops the chip for a second, blind to the button. Here loop() never waits: each pass asks “how long since the cycle started?” with now - cycleStart, so the button, the blink and the fade all get their turn. Add a sensor or a second LED and it simply gets its own “since when” variable.
The millis() wrap. millis() is a 32-bit count, so after 2³² ms, about 49.7 days, it goes back to 0. A test like millis() >= start + 1000 breaks then, because start + 1000 wraps first. Subtraction does not: if start is 4,294,967,000 and millis() has wrapped round to 704, then 704 − 4,294,967,000 in 32-bit unsigned arithmetic is exactly 1000. Write every time comparison as “now minus then” and the wrap stops mattering. (uint32_t is the same type as unsigned long on an Uno; it just says the size out loud.)
Software PWM. Pin 13 has no hardware PWM, so the fade does it by hand. micros() counts in 4 µs steps on a 16 MHz board; shifted right by 3 and masked with & 255, it becomes a counter that steps every 8 µs and starts again every 2 ms, about 490 times a second. The LED is on while that counter is below the brightness level, which rises and falls over two seconds. It only works because loop() never waits: add a delay() and the fade turns into a flicker. For a smooth hardware fade, put an LED and a 470 Ω resistor on pin 9 and use analogWrite(9, level).
Serial output. Printing every change of state is the cheapest debugger there is. F("...") keeps the text in flash, which matters when the chip has 2 KB of RAM.
How this was tested
The sketch compiles for an Arduino Uno with arduino-cli; it has not been run on a real board. A small C++ program runs it unchanged on a computer, on top of a fake Arduino: a clock that wraps at 32 bits like the Uno’s, a scripted button with bouncing contacts, and a recorder on the LED pin. It checks the mode order, that a press counts exactly 30 ms after the last bounce and that shorter blips never count, and that debouncing, blinking and fading all keep exact time while millis() wraps to 0. To make sure the test can fail, nine bugs were planted in copies of the sketch, among them the start + interval comparison, a debounce that does not restart on each bounce and an inverted PWM comparison. It caught all nine.
If you try it on a real board and something does not behave as described, the About page says where to write.
Sources
- Arduino store, read on 27 November 2026: Uno R3, Uno R4 Minima, Uno R4 WiFi, Nano ESP32 (US prices); Uno R4 Minima on the European store (euro price, specifications)
- Arduino documentation, technical specifications for the Uno R3, Uno R4 Minima, Uno R4 WiFi and Nano ESP32, and the cheat sheets for the Uno R4 Minima and Nano ESP32
- Arduino language reference: analogWrite(), analogRead(), attachInterrupt(), millis(), micros(), Wire, PROGMEM and F() (read from their source, arduino/reference-en); and the AVR core’s wiring.c (millis() runs off Timer0)
- Microchip, ATmega48A/PA/88A/PA/168A/PA/328/P datasheet (timers, pull-up resistance, input levels, current limits)
- Espressif, ESP32-C6 datasheet v1.6 (input voltage limits) and ESP-IDF FreeRTOS overview
- Seeed Studio, XIAO ESP32C6, read on 27 November 2026
- Raspberry Pi, Pico 2 product page, Pico 2 W announcement, Pico 2 datasheet, RP2350 datasheet, Pico-series documentation and Raspberry Pi OS
- Software releases on GitHub, read on 27 November 2026: Arduino IDE, arduino-esp32, arduino-pico, PlatformIO Core, PlatformIO Espressif 32, PlatformIO Raspberry Pi and the community fork, ESP-IDF, Pico SDK, Pico VS Code extension, CircuitPython
- MicroPython downloads, CircuitPython downloads and CircuitPython’s XIAO ESP32C6 page (no native USB), read on 27 November 2026