Programming a microcontroller using a high level langage like Python has always been attractive to me… I love programming in Python, I’m using it on a daily basis. And since I’ve also already spent dozens and dozens of hours on configuring and programming microcontrollers in low-level C, I know how tedious and boring that can be. Of course, there’s Arduino. But I didn’t took that train.
- Adafruit CircuitPlayground Express
- Adafruit Feather M0 Express
- Adafruit Metro M0 Express
- Adafruit Gemma M0
- Adafruit Trinket M0
From a price/performance/capabilities point of view, I chose to try the Metro M0 Express as some kind of premium platform, and the Trinket M0 for basic tiny projects.
For about 10€, you’ll get a board fitted with:
- a 48MHz Cortex M0 microcontroller with 256KB Flash and 32KB of SRAM
- an RGB led
- 5x GPIO (3.3V compatible), with various features, like hardware capacitive touch.
- a reset button…
- And an onboard Python 3 interpreter!
As soon as you plug it in, it is seen as a tiny USB drive (60Ko max!), on which you’ll be able to directly edit you python script with your favorite editor. Updating the main.py python script will even automatically restart the board… It’s very easy and fun to play with!
Using putty (or any other console terminal), you can connect on the serial console created by the board, and directly interact with your script, or with the Python 3 interpreter… It’s great to debug your scripts!
To update the firmware and the included CircuitPython libraries, you just have to double press the reset button, and drag and drop the latest firmware. As always with the adafruit team, the provided documentation is rich and of very good quality…
This board seems to be an excellent choice for basic electronic projects, with a very interesting price!
Metro M0 Express
For more than twice the price of a Trinket M0, here’s what you’ll get in addition:
- plenty of USB storage space, with 2MB of flash storage.
- 25 GPIO (3.3V compatible), also with various features, like hardware capacitive touch.
- An RTC module.
I would only use this board for projects involving a lot of I/O.
Some libraries are already included with the CircuitPython firmware, whose documentation is available here.
Additional libraries are also available as a bundle, that you can decompress to a lib directory on the board’s USB storage, to import them in your script. But as the storage on the Trinket M0 is very limited, you can’t install them all for that board, and you’ll have to pick them one by one. With the Metro M0 Express, all the bundle can be decompressed to the USB storage.
Features and limitations
CircuitPython implements a subset of Python 3, but everything that makes Python fun and powerful seems to be available (lists, dicts, tuples…), and everything needed to play with low level electronic seems to be available in the provided libraries.
Since the Cortex M0 used on those boards has limited RAM resources, it seems that we’ll be limited to about ~250 lines of Python code (using various libraries), before encountering MemoryErrors. We’ll see… But for basic electronic projects, it should be more than enough?
Funny note: to save extra space on the trinket M0 storage, it is advised to use TAB indentations, instead of the commonly used SPACE indentations in your Python scripts…
Important note: be sure to properly eject the USB storage before unplugging the board, since a corrupted storage means reflashing the whole thing, and losing data/scripts!
Now, I’m back to playing with my new Python toys… Have fun! 🙂