MicroPython

MicroPython VS Python

There are several programming languages available that are used for microcontrollers such as C++, C, and assembly language. But these programming languages required complex knowledge for building advanced level projects. Syntax of Python language is easy as compared to C. For microcontrollers Python has its version language named as MicroPython which is used for programming microcontrollers. This programming language allows its user to write easy-to-read code in a simple syntax for microcontrollers.

What is Python?

Python is a high-level programming language used by hundreds of programmers all over the world. The reason for its popularity is its wide use in the latest emerging technologies such as artificial intelligence, machine learning, and automation. It supports a large collection of open-source and standard libraries and modules that helps programmers to perform simple to complex tasks.

What is MicroPython?

MicroPython is very similar to Python, but it is considered to be a subset of Python which is used for creating embedded applications. MicroPython contains almost 80% of the standard most used libraries in Python 3 language. It allows users to create simple and easy programs for the microcontroller. MicroPython allows users to write clean and simple code for the hardware without using any complex low-level languages. There are several microcontrollers that support MicroPython such as Raspberry Pi Pico, PyBoard, PyBoard Lite, ESP32, and ESP8266.

MicroPython is fast, but it is not faster than equivalent C code. That’s because every Python command is converted and executed in C. The main advantage of MicroPython, or any high-level scripting language is the rich data processing capabilities of included and available standard libraries.

Difference Between Python and MicroPython

Python MicroPython
An object-oriented programming language normally used for creating web-based applications, and software. An open-source programming language interpreter that is used to implement Python for the development of microcontrollers.
Desktop applications, web-based applications, and websites are designed using Python 3. Embedded applications are normally built using MicroPython.
It uses large memory and hard disk space. It uses less memory.
It is designed to run on powerful processors such as desktops, laptops, and computers. It is designed to run on less powerful processors such as PyBoards, Raspberry Pi boards and ESP32.
Python programming language contains standard library modules. MicroPython contains only the subset of the Python module.
Python syntax does not require space between literal numbers and keywords. While MicroPython syntax requires spaces between literal numbers and keywords.
Python supports deleting built in types arrays. MicroPython do not support
In Python functions are objects and have defined attributes that can be accessed by function call. In MicroPython this is not possible because of microcontrollers’ little memory allocations.

Compatible Boards for MicroPython

There are several boards that are compatible with MicroPython and are mostly used by users, some of them are listed below:

  • PyBoard: First MicroPython board that provides direct configuration i.e connect and used board.
  • ESP8266: This board provides features such as execution of code through a web browser or shell, and running different projects connected to the internet.
  • ESP32: MicroPython also supported by ESp32 and its large family.
  • BBC Micro: It provides several tools that are used to program its peripherals like radio, or LEDs.
  • WiPy: This board also provides a friendly development environment for the execution of MicroPython.

Conclusion

We have discussed a brief comparison between both Python and MicroPython. Both these languages inherit the same syntax but Python is leaner towards the web and desktop-based application while MicroPython targets the embedded system and microcontrollers.

About the author

Kashif

I am an Electrical Engineer. I love to write about electronics. I am passionate about writing and sharing new ideas related to emerging technologies in the field of electronics.