Brussels / 4 & 5 February 2017


Scientific MicroPython for Microcontrollers and IoT

IoT programming with Python

MicroPython is a FOSS implementation of Python 3 optimised to run on a microcontroller with MHz and tens or hundreds of Kbytes of RAM. I will present MicroPython in terms of hardware and software, including some boards with network access, like WiFi, Bluetooth and LoRa. But even with these hardware constraints, scientific MicroPython is already available and practical, to be shown from the perspective of users and developers.

MicroPython is a implementation of Python 3 optimised to run on a microcontroller, created in 2013 by the Physicist Damien P. George. The MicroPython boards runs MicroPython on the bare metal and gives a low-level Python operating system running interactive prompt or scripts.

The MicroPython boards currently use 32 bit microcontrollers clocked at MHz and with RAM limited to tens or hundreds of Kbytes. These are the microcontroller boards with official MicroPython support currently in the beginning 2017 : Pyboard, Pyboard Lite, WiPy 1/2, ESP8266, BBC Micro:bit, LoPy, SiPy, FiPy. They cost between USD3-40, are very small and light, about some to tens of mm in each dimension and about 5-10 g, have low power consumption, so MicroPython boards are affordable and can be embedded in almost anything, almost anywhere.

MicroPython boards have many electronic interfaces : digital input/output (GPIO) ports, analog inputs (via Analog Digital Converter), analog outputs (via Digital to Analog Converter), wireless (WiFi, Bluetooth, LoRa), etc. So MicroPython on these boards can be used to control all kinds of electronic projects.

In terms of hardware, 2016 was the year of MicroPython, as new boards compatible with MicroPython arrived : ESP8266 boards (there are more than 10 types, with WiFi), BBC Micro:bit (with Bluetooth LE, free distributed to 1 million British students of 11-12 year-old), LoPy (with LoRa, WiFi, Bluetooth LE), SiPy (with Sigfox, WiFi, Bluetooth LE). Even a 5 network board was announced for April 2017 delivery, FiPy with LoRa, Sigfox, cellular LTE-CATM1/M2(NBIoT), WiFi, Bluetooth LE.

In terms of software, MicroPython allows microcontroller programming directly with Python 3, which is easier and more productive than programming with Arduino IDE, C/C++, etc. And MicroPython is well suited for Internet programming, so MicroPython boards are a natural choice for IoT (Internet of Things), for example running a simple web server to show a sensor output (text and graphics), sending sensor data to IoT cloud, etc. This fact is very important as today there are some billions of IoT devices worldwide, and in 2020 some tens of billions are expected.

Even with RAM constraints (tens to hundreds of Kbytes), scientific MicroPython is not only possible, but already available and practical to use, with MicroPython modules capable of numerical calculations, FFT (Fast Fourier Transform), calculations with uncertainties, etc. I will list the scientific MicroPython modules which are available, as well as show how to port Python 3 modules to MicroPython, squeezing the source code in tens of Kbytes.

Some hints will be given to the FOSS community to be open minded about MicroPython : be aware that MicroPython exists, MicroPython is a better programming option than Arduino in many ways, MicroPython boards are available and affordable, porting more Python 3 scientific modules to MicroPython, MicroPython combines well with IoT.


Roberto Colistete Jr