PROVIDER - a compact Python 3 runtime for microcontrollers

MicroPython

MicroPython was crowdfunded in 2013 to bring Python 3 syntax and a REPL into microcontrollers with around 256KB of RAM, covering more than 10 families including ESP32 and RP2040; it turns hardware debugging interactive, at the cost of speed, memory limits and port differences.

Programming Languages & Frameworks United Kingdom 2026.11.19
4pts

Detailed Notes

Pros 5 items

Started in 2013 by Damien George through crowdfunding, aiming to fit full Python 3 syntax into microcontrollers with about 256KB of RAM
Ships an interactive REPL: connect over serial, run code line by line and change 1 line without reflashing firmware
Official ports cover more than 10 MCU families including ESP32, RP2040, STM32, nRF and MIMXRT
Uses a compact mark-and-sweep garbage collector with frozen bytecode, leaving about 64KB of usable heap on small ports
The `machine` module exposes GPIO, I2C, SPI, PWM, ADC and timers with a nearly identical API across chips

Cons 4 items

Speed and memory efficiency trail C noticeably, so heavy algorithms and large buffers need redesign
Hardware support is limited to implemented modules; unusual peripherals often require a custom C module and firmware rebuild
Port progress differs, so the same API can behave differently depending on the chip
Mature debugging and profiling tooling is missing, leaving REPL prints as the main diagnostic

Service Overview

MicroPython was started in 2013 by Damien George through a crowdfunding campaign to put full Python 3 syntax on microcontrollers. It is not an interpreter running on Linux but a small runtime written for bare metal: it carries its own garbage collector, frozen bytecode and hardware abstraction layer and boots on chips with tens to hundreds of kilobytes of RAM.

For the languages and frameworks category it changes how hardware work feels: opening a serial REPL lets you probe pins and read sensors line by line instead of compiling and flashing after every edit.

Key Strengths

  • Interactive loop: verify pin behaviour in the REPL and cut the debug cycle from minutes to seconds
  • Real Python syntax: functions, classes, exceptions, generators and slicing all work, so Python skills transfer directly
  • Consistent hardware layer: machine.Pin, machine.I2C and machine.PWM behave similarly across more than 10 MCU families
  • Simple firmware model: a single .uf2 or .bin file dropped onto a drive or flashed with one command
  • Escape hatch to C: performance-critical parts can be written as C modules and frozen into the firmware

Product Ecosystem

Ports and boards

Official ports for ESP32 series, RP2040 (Pico), STM32, nRF52, MIMXRT and ESP8266; the pyboard is the reference board.

Tooling

mpremote, esptool, the Thonny IDE and rshell handle flashing, file sync and REPL access.

Libraries

Built-in machine, network and bluetooth modules, with community libraries copied onto the device as .py files.

Limitations

  • Performance and memory are constrained: interpretation plus GC pauses force hard real-time loops into C
  • Peripheral coverage is partial: niche sensors, CAN and USB Host often require a custom firmware build
  • Port behaviour varies between chips and release versions
  • Debugging is limited to prints and the REPL, with no breakpoints or profilers

Use Cases

  • IoT prototypes and teaching (★★★★★): wire, script and connect to Wi-Fi in one sitting
  • Sensor logging with upload (★★★★): network and JSON handling are far easier than in C
  • Hardware bring-up (★★★★): REPL probing of pins and timing
  • Hard real-time and production firmware (★★): use C, C++ or Rust on bare metal

Pricing

Item Price Notes
MicroPython firmware $0 Open source under MIT, free to flash and redistribute
Development boards Per model ESP32 and Pico boards span a wide range
Commercial support Contract Some vendors offer custom firmware and support

Software costs nothing; budget hardware and learning time, and check boot time and memory before volume production.

FAQ

  • How does it relate to CircuitPython? CircuitPython is Adafruit's fork focused on education and plug-and-play behaviour; MicroPython stays closer to a general embedded runtime.
  • Can you use the standard library? Only the trimmed ports: os, time, json and socket have subsets, while numpy and requests are unavailable and need replacements.
  • How much slower is it? Typically an order of magnitude versus C at the same clock, though I/O-bound and networked workloads narrow the gap; move hot paths into C modules. Compare Arduino and ESP-IDF under languages and frameworks.

Code Examples

Blink from the REPL

from machine import Pin
import time

led = Pin(25, Pin.OUT)          # onboard LED on RP2040 Pico
for i in range(5):
    led.toggle()
    time.sleep_ms(300)

Paste it into the REPL and it runs immediately with no compilation step.

Read an I2C sensor and publish JSON

from machine import Pin, I2C
import time, json

i2c = I2C(0, scl=Pin(5), sda=Pin(4), freq=400_000)
print("devices:", [hex(a) for a in i2c.scan()])

def read_temp(addr=0x48):
    raw = i2c.readfrom_mem(addr, 0x00, 2)
    value = ((raw[0] << 8) | raw[1]) >> 4
    return value * 0.0625

while True:
    print(json.dumps({"temp_c": read_temp()}))
    time.sleep(2)

Scan for addresses first, then read registers; this order isolates wiring problems fastest.

Community & Resources

Visit MicroPython Website → https://micropython.org/
Visit Website ↗