SENIOR TRACK
Understanding Software, IDEs and MicroPython
Big idea: You write instructions in a human-readable language. That text must be translated into the binary patterns the ESP32 can execute. An IDE is the workshop where you write and translate. MicroPython is Python stripped down to fit inside a microcontroller — same grammar, far fewer resources.
1. Why Computers Can’t Read English
The ESP32 understands exactly one thing: binary patterns — sequences of 1s and 0s that switch its transistors ON and OFF. It has no concept of the word “if”, the symbol =, or the phrase print("hello").
So if you want the ESP32 to do something, you need a translator between your language and its language.
There are two main strategies for that translation, and the difference matters for how you write code on E-32.
Strategy 1 — Compilation
A compiler takes your entire source file and translates it, in one go, into machine code — a complete program the processor can run directly, with no further translation at runtime.
Think of it like translating a whole book before publishing it. The reader gets a finished book and can read it at full speed. But if you change one sentence, the whole book must be re-translated before the reader can see the change.
Compiled languages (C, C++, Rust) are fast and efficient. Traditional Arduino programming uses this model.
Strategy 2 — Interpretation
An interpreter does not produce a finished machine-code file. Instead, it reads your source code line by line, works out what each line means, and performs that action on the hardware immediately.
Think of a live interpreter at a meeting. They hear one sentence, translate it, and the audience reacts — then the next sentence. It is slower per sentence, but you can change what you say while you are speaking.
MicroPython uses an interpreter. When E-32 runs your code, a small interpreter stored on the ESP32 reads your Python line by line and carries out each instruction in turn.
| Compiler | Interpreter | |
|---|---|---|
| Translation | Whole program, before running | One line at a time, while running |
| Speed | Very fast execution | Slower execution |
| Change a line? | Re-translate everything | Just change the line and run |
| Lives on the device? | The compiled machine code | The interpreter + your source code |
| Used by E-32? | No | Yes — MicroPython |
Why interpretation suits robotics teaching: you can test a single line, see the result immediately, change it, and test again — without waiting for a full compile. That feedback loop is exactly what you want while learning.
2. What Is an IDE?
Writing code in a plain text editor is possible, but painful. You get no error checking, no way to upload to the board, and no easy way to see what the ESP32 is printing back.
An IDE (Integrated Development Environment) is a single application that combines the tools you need:
a code editor with syntax highlighting and error detection
a translator interface — for MicroPython, the connection that sends your code to the interpreter
a debugger to pause execution and inspect values
a terminal or console to see output from the device
project management so you can keep multiple files organised
The word integrated is the point. Without an IDE you would juggle a text editor, a separate upload tool, a terminal window, and a manual. An IDE puts them in one place so you can focus on the problem, not the plumbing.
3. VS Code — Your Workshop
Visual Studio Code (VS Code) is a free, cross-platform IDE made by Microsoft. It is not only for Python — it supports hundreds of languages through extensions, which are add-on packages that teach VS Code about a specific language or device.
For E-32 work, VS Code gives you:
a familiar file explorer and editor
syntax highlighting for MicroPython
an integrated terminal
the ability to install extensions that talk directly to the ESP32 over USB
The ESP32 workflow inside VS Code generally looks like this:
Flash the MicroPython firmware onto the ESP32 (a one-time setup step, done with a tool such as
esptool).Connect to the board’s serial port from VS Code.
Write your MicroPython file in the editor.
Upload the file to the ESP32 — either to run it immediately or to save it as the program that runs on every boot.
Watch the output in the terminal as the ESP32 prints sensor readings or errors.
You do not need to memorise the setup steps. We will do them together on the machine. What matters now is the shape of the workflow: write → send → watch → change → send again.
4. MicroPython — Python That Fits on a Chip
MicroPython is Python. The syntax is the same: if, while, for, functions, classes, indentation. If you have written Python on a laptop, most of it will look familiar.
But MicroPython is a lean reimplementation built for microcontrollers, and the constraints change how you write it.
The constraint that shapes everything: memory
Standard Python runs on machines with gigabytes of RAM. MicroPython runs on devices with as little as 16 KB to 512 KB of RAM. The ESP32 has about 520 KB — generous by microcontroller standards, tiny by laptop standards.
That single fact cascades into several practical differences.
Difference 1 — Memory management
Standard Python (CPython) uses reference counting to free memory the moment an object is no longer used. MicroPython uses garbage collection instead: memory is reclaimed in batches when the runtime decides it is needed.
For you, this means two things:
You cannot assume memory is freed the instant you delete something.
Very memory-hungry patterns (creating huge lists, building enormous strings) will fail on E-32 in ways they would not fail on a laptop.
Difference 2 — Fewer libraries
Many of Python’s standard libraries are simply too large, or irrelevant, for a microcontroller. MicroPython provides specialised libraries for hardware instead — pins, sensors, motors, timing — but not the full desktop library set.
You will not have numpy, pandas, or requests. You will have direct control of GPIO pins.
Difference 3 — Speed
Interpreted code is slower than compiled code, and MicroPython’s interpreter is optimised for size as much as speed. For reading a sensor or blinking an LED, it is more than fast enough. For heavy number-crunching, it is not the right tool.
Difference 4 — No operating system
On a laptop, Python runs on top of Windows or macOS. On E-32, MicroPython runs directly on the hardware. There is no desktop, no file manager, no background processes. Your code is the only thing running.
This is why the same Python syntax feels different on a microcontroller: you are closer to the metal.
5. What This Means for Your Code
| On a laptop | On E-32 with MicroPython |
|---|---|
| Lots of RAM — don’t think about it | ~520 KB — think about it constantly |
| Full standard library | Hardware-focused subset |
| Operating system handles files and devices | You handle pins and sensors directly |
| Run, stop, edit, run again | Upload, watch, edit, upload again |
| Garbage collection is a detail | Garbage collection is a design constraint |
The core skill you are building is economy: doing what you need with the least memory and the fewest moving parts. That is not a limitation of the course — it is the central skill of embedded programming.
6. Quick Check
What is the fundamental difference between a compiler and an interpreter?
Why does MicroPython use an interpreter rather than compiling to machine code?
What does the “I” in IDE stand for, and what tools does it integrate?
What is the role of an extension in VS Code?
Name two ways MicroPython differs from standard Python because of memory constraints.
Why does the absence of an operating system change how you think about your code?
Key Terms
| Term | Meaning |
|---|---|
| Source code | The human-readable text you write |
| Machine code | Binary instructions the processor executes directly |
| Compiler | Translates an entire program into machine code before it runs |
| Interpreter | Reads and executes source code line by line at runtime |
| IDE | Integrated Development Environment — editor, translator, debugger and terminal in one application |
| VS Code | A free, extensible IDE used to write and upload MicroPython |
| Extension | An add-on that teaches VS Code about a language or device |
| Firmware | The MicroPython system itself, stored on the ESP32 |
| MicroPython | A lean Python implementation for microcontrollers |
| Garbage collection | Automatic memory reclamation used by MicroPython |
| REPL | An interactive prompt where you can type and run MicroPython one line at a time |