Friday, February 23, 2024

MicroPython: The Python For MCUs

Priya Ravindran

- Advertisement -

The power of Python is well-known and widely accepted. Easy to learn and systematic to script, the effortless way to express complex behaviour is what makes this language tick. Here we explore the adaptation of this popular language to a popular branch of electronics, the embedded systems. Presented below is the software review for MicroPython.

Introducing MicroPython

The Pyboard
The Pyboard

Whether it is to make a light emitting diode (LED) blink, read voltages, make motors and servos move, communicate wirelessly or control robots, MicroPython comes to one’s aid. The software is built to exploit the powers of Python programming to create efficient embedded systems. A brainchild of Damien George and funded by a Kickstarter campaign, this is a selected sub-set and a lean implementation of Python 3.x, optimised to run on microcontrollers (MCUs) and in constrained environments.

With full Python programming language at your disposal, you can write functions and classes, make lists and dictionaries, do string processing, read and write files, and have more sophisticated features such as generators, closures, list comprehension and exception handling. The possibilities for programming are endless!

- Advertisement -

Stretch to accommodate

To extend the capabilities of the MCU-MicroPython combination, exclusive drivers in pure Python have been implemented. Creating an Internet of Things (IoT) application is easy, thanks to CC3000 Wi-Fi module. If the Ethernet is the protocol supported, use WIZ820io module, and low-power implementation is not far with support for nRF24L01+ wireless module. The serial peripheral interface (SPI) port of the MCU board can be exploited to include the above modules.

Getting better by the day

What started off as a project to develop faster and better embedded systems was continuously developed to include support for the latest trends. George, the developer, has joined hands with Paul Sokolovsky and Viktoriya for a second MicroPython Kickstarter campaign that intends to run MicroPython like clockwork on ESP8266, a compact and little system-on-chip (SoC) having built-in Wi-Fi and some nice general-purpose input/output (GPIO).

In another collaboration with Nicholas Tollervey and Python Software Foundation, and help from volunteers, running MicroPython on BBC micro:bit is being targeted. This being the official way of running Python on micro:bit, it has grown to a well-constructed teaching tool with a child-friendly set of modules for doing things like making animations and playing music.
The developer also highlights a latest attempt at taking MicroPython to Space as one of his most exciting happenings. In coordination with European Space Agency, the project involves continuous monitoring and development to make MicroPython more deterministic, robust and efficient, to port it to scalable processor architecture (SPARC) and evaluate its use in Space based applications.

Interestingly, some of the development work coming out of this project is already available in the official repository, providing a stepping-stone for use in critical systems and industrial settings.



Electronics News

Truly Innovative Tech

MOst Popular Videos

Electronics Components