A new way of programming micro controllers has been born and it is through the MicroPython Programming Language. But what is MicroPython, here we expose its attractive features, as well as why it could be a new alternative for the development of your projects. A comparison is made with the well-known Arduino platform. But if you are just starting out in development is not a problem either, MicroPython may be one of the best options to start your learning.
What is MicroPython?
According to the definition of the official site, MicroPython is a small but efficient interpreter of the Python 3 Programming Language that includes a minimal subset of libraries and is also optimized to run on microcontrollers and restricted environments.
With MicroPython you have the possibility to write simpler codes, instead of using lower-level Programming Languages such as C or C ++, which is the one that Arduino uses for example.
There are some features that MicroPython has and it is what makes it unique and different from other embedded systems:
- It has an Interactive RELP (Read-Eval-Print Loop). Which is a small program that reads and interprets user commands, evaluates them, and then prints the result. This allows you to connect a card (microcontroller that supports Python) and it has to execute the code without the need to Compile or Load the program.
- Many libraries. Just as the Python Programming Language has an endless number of libraries for executing tasks, MicroPython also comes well loaded with enough packages to save work. It is possible to execute JSON data analysis from a web service, search for text in regular expressions or even raise a Socket within a network with only the functions already preloaded.
- Extensibility. For advanced MicroPython users, they can extend Python to lower-level functions such as C or C ++, being able to mix code that requires faster, lower-level execution with MicroPython, which is higher-level.
What can I do with MicroPython?
Now that you know what MicroPython is, you would be interested to know what can be done with it. Well, many things can be done with MicroPython, such as controlling card pins, flashing an LED, digital readings, generating PWM signals, controlling servo motors, analog signal readings, I2C communication, SPI, Network and WiFi connections on some cards, including MicroPython also already integrates libraries to control NeoPixel , some OLED screens, and many other things.
MicroPython can do almost anything an Arduino does. One of the differences that can be noticed is that in MicroPython the codes are not as fast, and that they could take up more memory compared to C or C ++ languages. This is particularly not so relevant when used in normal projects.
MicroPython uses much of the core of Python 3 but not in its entirety, this could be another disadvantage, and is that although all the core packages have been minimized and optimized, it has not been possible to include all of them due to the minimum memory used. What has been done is to use ultra-small versions of the libraries trying to offer the user the best experience in development when programming in it.
Which boards are compatible with MicroPython.
This is the list of cards compatible with MicroPython:
1.- pyboard. This is the first MicroPytho board. It has direct support and to use it simply connects because it is already configured directly to be used.
2.- ESP8266 Adafruit. With this card you can run various projects connected to the Internet. A special feature is that you can execute codes through Shell from a web browser.
3.- WiPy. This is another card that integrates WiFi developed by Pycom offering a friendly development environment to run MicroPython codes on it.
4.-BBC micro: bit. This card has great support for loading codes into MicroPython. It has tools to program and access all its peripherals such as LEDs, accelerometer, radio, etc.
5.- Teensy 3.X: Teensy’s 3.X series has a port that supports MicroPython. For this you have to have experience in Firmware and code compilation to get the port up and running. It is recommended to visit the forum to get an idea of how to do it.
6. ESP32: Multiple board from the ESP32 family supports micropython like: TTGO, ESP32 DEVKIT V1, TinyPICO, ESP32 PICO-KIT V4.1, ESP32 DevKitC V4, NodeMCU ESP32, HUZZAH32 FEATHER, ESP32 THING V 2 .0, SPARKFUN THING PLUS, WEMOS / LOLIN D32 V1.0.0, TTGO MINI 32 V2.0, WIDORA AIR V6.0, DSTIKE D-duino-32 XR and more.
7. STM32: multiple STM32 boards support MicroPython. to know all the boards which support it visit the official MicroPython.org page here. The official reference board for MicroPython is the pyboard which contains an STM32F405 microcontroller.
Other boards like Circuit playground express, Trinket M0 and Metro M0 express are also compatible.
You can visit the MicroPython repositories to see what other cards are supported here on GitHub.
Is Python experience required?
No experience in Python is required, something that this Programming Language has been characterized by is its simple and clean code that helps too many those who are beginning to easily understand the syntax when programming, Python could be the best option for beginners, you will surely like it.
For Python experts exploring MicroPython you will notice that it has almost the full potential of the original kernel, they will not entirely miss the powerful functions that Python normally has. And if it is of your interest they could collaborate to continue creating libraries and functions in MicroPython.