Electronics for Building Things · Lesson 13 · The Microcontroller

Anatomy of a Microcontroller

What's actually on your board — and why the ESP32 is the home-automation brain.

You've been driving pins since Lesson 1 without a clear picture of the thing behind them. This lesson gives you that picture: what a microcontroller board is, what each pin can do, and how the Arduino and ESP32 differ — so you can pick the right board and the right pin for a job.

The one win You can look at your board, name its main parts, and know what a given pin is capable of (and which pins to avoid).

A computer shrunk onto a chip

A microcontroller is a whole small computer on one chip: a processor (runs your code), memory (holds the program and variables), and built-in peripherals (the hardware that does timing, analog reading, PWM, and communication). It's an integrated circuit — Lesson 12's ideas apply directly.

The board (Arduino, ESP32 dev board) wraps that chip with the support it needs: a voltage regulator (clean power, from Lesson 4), a USB connection (to upload code and power it), and the chip's pins broken out to a row of labeled headers you can wire to.

GPIO: the pins you program

Most pins are GPIO — General-Purpose Input/Output. Each can be a digital output (drive HIGH/LOW) or input (read HIGH/LOW). Many pins have extra talents layered on:

Arduino Uno vs ESP32

Arduino UnoESP32
Logic voltage5V3.3V (not 5V-tolerant)
Usable GPIO~20~25
PWM pins6 specific pinsAlmost any pin
Analog inputs6 (10-bit)Many (12-bit)
WirelessNone built inWi-Fi + Bluetooth
Processor1 core, 8-bit2 cores, 32-bit, faster

For your mission, the deciding row is Wi-Fi: it's what lets a gadget report to or be controlled from your phone or home server (SparkFun: ESP32 Thing Hookup Guide).

Two pin cautions The ESP32 runs at 3.3V and its pins are not 5V-tolerant (the trap from Lesson 4). Also, a few GPIO are input-only or have special roles at boot — always glance at a pinout diagram for your exact board before choosing a pin.
Rule of thumb Keep a pinout diagram for your board handy (printed or bookmarked). It tells you which pins do PWM, analog, I²C/SPI, and which to avoid. It's the single most useful reference for wiring.

Check yourself

Read this next (primary source) SparkFun — ESP32 Thing Hookup Guide, and grab a pinout diagram for your specific ESP32 board.
I'm your teacher — ask me anything. Tell me which exact board you have and I'll help you read its pinout and pick safe pins for your project.

See also: Glossary · Signals & buses · Rules of thumb