KevsRobots Learning Platform
16% Percent Complete
By Kevin McAleer, 7 Minutes
If youâre coming from Arduinoâs C++ world, you might wonder why youâd switch to MicroPython. The answer isnât âalways use Pythonâ - itâs about picking the right tool for your project.
MicroPython brings Pythonâs simplicity to microcontrollers like the Arduino Nano ESP32, Raspberry Pi Pico W, and Pico 2W. You get rapid development, interactive debugging, and readable code without sacrificing too much performance.
Hereâs the core philosophical shift:
Arduino C++: Compile code on your computer, upload binary to board, hope it works, repeat.
MicroPython: Upload code as text files, run instantly, test in real-time with REPL, fix bugs on the fly.
That REPL (Read-Eval-Print Loop) is a game changer. You can type commands directly to your microcontroller and see instant results - like having a conversation with your hardware.
Choose MicroPython when:
Example perfect projects:
Choose Arduino C++ when:
Example perfect projects:
Letâs be honest: MicroPython is slower than C++. But hereâs the secret - for most projects, you wonât notice.
Speed comparison:
Where youâll notice the difference:
For reading a temperature sensor every second and sending it over WiFi? MicroPython wins on development time.
Letâs see what the same simple program looks like:
Arduino C++:
// Blink built-in LED
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}
MicroPython:
# Blink built-in LED
from machine import Pin
import time
led = Pin(25, Pin.OUT) # Pin 25 on Pico
while True:
led.on()
time.sleep(1)
led.off()
time.sleep(1)
Notice:
setup() and loop() - just regular Python codeled.on() vs digitalWrite)This course focuses on three excellent MicroPython-compatible boards:
Arduino Nano ESP32
Raspberry Pi Pico W
Raspberry Pi Pico 2W
All three run MicroPython beautifully and share similar APIs.
What About CircuitPython?
You might have heard of CircuitPython - another Python implementation for microcontrollers. Hereâs what you need to know:
What is CircuitPython?
- A beginner-friendly fork of MicroPython created by Adafruit
- Designed specifically for education and maker projects
- Focuses on simplicity and ease of use over raw performance
Key Differences:
- File system: CircuitPython shows up as a USB drive (drag-and-drop code!)
- File names: Uses
code.pyinstead ofmain.py- Libraries: Pre-installed libraries for Adafruit hardware
- Development: Optimized for beginners, simpler workflow
- Hardware: Best support for Adafruit boards, good on Pico too
Pros of CircuitPython:
- â Easier for absolute beginners (drag-and-drop files)
- â Excellent hardware abstraction
- â Great documentation and community support
- â Pre-built libraries for common sensors
Cons of CircuitPython:
- â Slower than MicroPython (prioritizes ease over speed)
- â Larger memory footprint
- â Less flexible for advanced use cases
- â Smaller device support (focused on specific boards)
Which Should You Learn?
- MicroPython: More versatile, works on more boards, better performance
- CircuitPython: Easier onboarding, better for teaching kids, excellent for Adafruit hardware
The good news: theyâre ~95% compatible. Learn one, and you mostly know the other!
This course focuses on MicroPython because it works on Arduino Nano ESP32, all Raspberry Pi Pico variants, and gives you more flexibility. But everything you learn applies to CircuitPython too!
Ask yourself these questions:
1. Do I need to finish this project quickly?
2. Will I need to debug complex behavior?
3. Am I doing time-critical operations under 1ms?
4. Will this run on battery for months?
5. Am I more comfortable with Python or C++?
This course will teach you:
By the end, youâll be able to translate any Arduino project into MicroPython and know when each approach is best.
Exercise 1: Evaluate Your Next Project
Think of a project you want to build. Answer these questions:
Based on your answers, which language would you choose?
Exercise 2: Explore the REPL
If you have a Pico, Pico 2W, or Nano ESP32 with MicroPython installed:
print("Hello from MicroPython!") and press Enter1 + 1 and see the instant resultThis is the REPL in action - something you canât do with Arduino C++!
Exercise 3: Compare Code
Look at an Arduino sketch youâve written before. Identify:
{}?setup() do? What does loop() do?In the next lessons, youâll learn how to convert each of these to MicroPython.
You can use the arrows â â on your keyboard to navigate between lessons.
Comments