MicroPython is a version of the Python programming language suitable for microcontrollers.
Note that there is a TinyURL link to this page as: https://tinyurl.com/mpy-rsrcsContent unavailable! (broken link)https://service.robots.org.nz/wiki/images/out.png
Also, there is a link from the MicroPython home pageContent unavailable! (broken link)https://service.robots.org.nz/wiki/images/out.png that provides an invitation to the MicroPython Discord server.
Getting Started#
MicroPython is a version of the Python programming language designed for use on microcontrollers like the ESP32, STM32, RP2040, etc. Installation instructions are available from the Quick Reference page for each microcontroller (sidebar links from the DocumentationContent unavailable! (broken link)https://service.robots.org.nz/wiki/images/out.png page), which is generally: downloading the distribution file and installing it over a USB connection.
Note that MicroPython on a microcontroller has what's effectively its own tiny file system (as a "Pyboard"), and there's not really much in the way of standardisation of how things are installed there. So if a library or function isn't defined in MicroPython itself (or, e.g., in Pimoroni's distribution of it), you can simply install the necessary files on your microcontroller, perhaps in its own or a 'lib' directory, and just be sure to manage your imports so your main.py can see the necessary files. It's not a lot more complicated than that.
I'd also recommend rshellContent unavailable! (broken link)https://service.robots.org.nz/wiki/images/out.png, which provides a command line into /pyboard where you can use commands like cp (copy), df (get filesystem info), rm (delete files), rsync (synchronise with a local directory), and edit (with vim being the default editor, but changeable). repl provides access to the Python REPL so you can execute your code. Highly recommended. The `rsync` feature alone is worth it, e.g., you can sync your installation with a local directory that can be maintained on github.
The following MicroPython distributions include "baked-in" support for many Pimoroni products:
- Pimoroni MicroPython distribution for RP2040Content unavailable! (broken link)https://service.robots.org.nz/wiki/images/out.png
- Pimoroni MicroPython distribution for RP2350Content unavailable! (broken link)https://service.robots.org.nz/wiki/images/out.png
See also: Pyboard
MicroPython Language Documentation / General#
- MicroPython home pageContent unavailable! (broken link)https://service.robots.org.nz/wiki/images/out.png
- MicroPython documentation pageContent unavailable! (broken link)https://service.robots.org.nz/wiki/images/out.png
- Language ReferenceContent unavailable! (broken link)https://service.robots.org.nz/wiki/images/out.png
- Libraries ReferenceContent unavailable! (broken link)https://service.robots.org.nz/wiki/images/out.png
- Awesome MicroPythonContent unavailable! (broken link)https://service.robots.org.nz/wiki/images/out.png, a curated list of MicroPython libraries, frameworks, software and resources
Tutorials#
[unvetted]
- MicroPython tutorialsContent unavailable! (broken link)https://service.robots.org.nz/wiki/images/out.png from micropython.org
- MicroPython: An Intro to Programming Hardware in PythonContent unavailable! (broken link)https://service.robots.org.nz/wiki/images/out.png from RealPython
- Introduction: Get Started with MicroPythonContent unavailable! (broken link)https://service.robots.org.nz/wiki/images/out.png
- MicroPython tutorial for ESP32Content unavailable! (broken link)https://service.robots.org.nz/wiki/images/out.png
Libraries & Resources#
- micropython-libContent unavailable! (broken link)https://service.robots.org.nz/wiki/images/out.png, a repository of packages designed to be useful for writing MicroPython applications
- OpenMV MicroPython librariesContent unavailable! (broken link)https://service.robots.org.nz/wiki/images/out.png
- FuPy: MicroPython for FPGAsContent unavailable! (broken link)https://service.robots.org.nz/wiki/images/out.png
Tools, Hardware#
- rshellContent unavailable! (broken link)https://service.robots.org.nz/wiki/images/out.png, the Remote MicroPython shell
- mpbuildContent unavailable! (broken link)https://service.robots.org.nz/wiki/images/out.png builds MicroPython firmware in containers so you don't need to install any compiler toolchains or development tools
- Redirect stdout to StringIO works in Python3, how in MicroPython?Content unavailable! (broken link)https://service.robots.org.nz/wiki/images/out.png
- MicroPython ICM20948 DriverContent unavailable! (broken link)https://service.robots.org.nz/wiki/images/out.png
- Zumo adapter for MicroPython Pyboard by MCHobbyContent unavailable! (broken link)https://service.robots.org.nz/wiki/images/out.png
- Exploring ESP-NOW in MicroPython: A Learner’s GuideContent unavailable! (broken link)https://service.robots.org.nz/wiki/images/out.png
- Quick Reference for the PyboardContent unavailable! (broken link)https://service.robots.org.nz/wiki/images/out.png
Installing MicroPython on Linux#
To install MicroPython on Linux, where normally one would use Python (CPython) you need to install the machine library. This can be accomplished via:
sudo apt install micropython