Microcontrollers for robotics: ESP32, STM32, Teensy, RP2040
Four MCU families cover 95% of hobby robotics in 2026. Pin counts, real-time support, cost, toolchain — a decision matrix and honest recommendations.
A microcontroller is the brain of every motor controller, encoder reader, and sensor hub on your robot. Four families dominate in 2026. Each has a clear sweet spot. Picking wrong costs you weeks. Here's how to pick right.
Quick decision
- Building your first robot, want WiFi/Bluetooth, want lots of tutorials → ESP32 (S3)
- Need hard real-time (motor controllers, FOC) → STM32
- Need lots of high-speed PWM channels and USB HID/audio → Teensy 4.1
- Minimum cost, PIO, dual-core for weird peripherals → RP2040/RP2350
Those aren't the only options, but 95% of 2026 hobby-robotics projects use one of these four.
ESP32 (S3)
Espressif's flagship. Dual-core Xtensa at 240 MHz, native USB, 8 MB PSRAM on the N8R8 variant, built-in Wi-Fi and Bluetooth LE. Vector instructions for small neural nets. Roughly $10 for a devkit.
- Strengths: Arduino-compatible, massive tutorial ecosystem, Wi-Fi "just works," cheap, powerful enough for on-board ML inference.
- Weaknesses: not a true hard-RT environment (Wi-Fi stack adds jitter), peripheral quality varies, some pins are strapping pins that brick your boot if mis-driven.
- Best for: first robot, any robot that benefits from wireless connectivity, TinyML on-device inference, hobby swarm projects.
In 2026, the ESP32-S3 is the version you want (not classic ESP32, not C3). See the Lesson 1 deep-dive for the specifics.
STM32
ST's Cortex-M family, from tiny M0 up to dual-core M7 monsters. Used in industry for motor controllers, quadrotor flight computers, FOC drivers, anywhere you need deterministic timing at kHz or MHz rates.
- Strengths: best-in-class peripherals (advanced timers, high-resolution ADCs, CAN, DMA everywhere), hard real-time, extensive HAL, used by every commercial robotics vendor.
- Weaknesses: toolchain is more involved (STM32CubeIDE or PlatformIO), smaller hobbyist community than ESP32, you'll write more boilerplate.
- Best for: motor controllers (ODrive and VESC are STM32-based), flight controllers, anywhere determinism matters.
Entry point in 2026: Nucleo-G431RB ($15) for learning, or the STM32H7 series (~$25) if you need performance.
Teensy 4.1
PJRC's NXP i.MX RT1062 board. ARM Cortex-M7 at 600 MHz — the fastest 8-bit-friendly MCU you can buy. Tons of I/O, built-in Ethernet, USB host, audio-class USB, micro-SD.
- Strengths: staggeringly fast, Arduino-compatible (Teensyduino), rich libraries for weird protocols (DMX, MIDI, audio), great PWM and I2S support.
- Weaknesses: expensive (~$35–40), no Wi-Fi (needs an add-on module), smaller community.
- Best for: legged robots with many simultaneous servos, audio-heavy robotics, anything where you need Ethernet + fast control.
RP2040 / RP2350
Raspberry Pi Foundation's in-house MCU. Dual Cortex-M0+ (RP2040) or dual M33 (RP2350). The star feature: PIO (Programmable I/O) — little state machines that implement arbitrary protocols in hardware.
- Strengths: absurdly cheap ($0.70 for the chip, $4 for a Pico), PIO lets you bit-bang any protocol at clean timing, dual-core, excellent C and MicroPython support.
- Weaknesses: no Wi-Fi on bare Pico (Pico W has it), fewer peripherals than STM32, floating-point math is software on RP2040 (RP2350 improves this).
- Best for: sensor hubs, custom protocols, student-budget builds, lots-of-these-running-in-parallel architectures.
Decision matrix
| Need | Pick |
|---|---|
| First robot ever | ESP32-S3 |
| Wi-Fi/BLE for remote control | ESP32-S3 or Pico W |
| Motor controller, FOC, 20 kHz loop | STM32 |
| Flight controller | STM32 |
| Neural net inference on-device | ESP32-S3 (or Jetson if larger) |
| $3 budget per board | RP2040 |
| Controlling 20 servos at 1 kHz | Teensy 4.1 |
What you don't need to think about
- Arduino Uno. 20 MHz, 2 KB RAM, 8-bit. Fine for blinking an LED, not for robots. Move on.
- Raspberry Pi as an MCU. A Pi is a computer running Linux, not an MCU. Use it as a companion board (Pi 5 for ML inference + ESP32 for motor I/O is a great combo), not the real-time controller.
- ESP8266. Cute in 2016, obsolete in 2026. Always pick ESP32 over ESP8266.
Toolchain picks
- ESP32: Arduino IDE or PlatformIO (ESP-IDF if you want the deep-end option).
- STM32: STM32CubeIDE (official) or PlatformIO + HAL (friendlier). PlatformIO recommended for hobbyists.
- Teensy: Arduino IDE + Teensyduino, period.
- RP2040: Thonny with MicroPython for quick prototypes; VS Code + pico-sdk for performance.
The gotcha that bites every beginner
Power. Hobby servos under stall can pull 2–3 amps. Motors can pull 5+. Never power them off your MCU's 5V pin — it will brown out and reset. Give them their own 5V rail, share ground with the MCU. The lesson on power and batteries covers this properly.
Exercise
Pick a project. For each of the four families, sketch which one you'd use and why. You'll quickly learn that the right answer isn't always "the fastest one" — it's often "the one with the most libraries for the specific sensor you're using." Robotics hardware is about the ecosystem, not the datasheet.
Comments
Sign in to post a comment.