CircuitPython

Lately there is a lot of talk about Python and the possibility of using it in the programming of microcontrollers instead of other languages such as C or C ++, often too complex and which require a lot of effort and time for their learning. But Python is a language born to work on large machines like today’s PCs are. In this regard, CircuitPython has been developed, a particular version of Python suitable for working with small boards and chosen by Adafruit as the base platform for its products.

CircuitPython

What is CircuitPython

CircuitPython is a programming language designed to make it very easy to use boards with low-cost microcontrollers and to make it easier to learn. CircuitPython was born in 2017, starting from MicroPython, an open-source project created to make Python usable also in the programming of microcontrollers, and it is da Adafruit, who promoted it for the programming of its boards.

CircuitPython is based on Python, from which it inherits many useful features. For example, once the code is written and saved, it can be executed immediately, without the need to compile and then load it onto the card (unlike other languages like C and C ++). It also allows you to immediately get the answers to our commands, thus allowing interactive programming.

circuitpython_circuit_playground_adafruit_blinka_computer.png

Python is a rapidly expanding language, and is being taught in many schools due to its great use in the scientific and professional environment. So programming the cards with this language can be very useful to begin to become familiar with this language or to deepen its use.

CircuitPython for its part allows the use of this language on many hardware platforms thus extending the field of applicability a lot.

Single board computers (SBCs) and their sensors

CircuitPython is designed to work on microcontroller boards, or single board computers, better known as Single Board Computers (SBCs), such as the Raspberry Pi. These types of computers have now gained a large share of the market, and are widespread thanks to their great applicability to many uses and above all their low cost.

The boards on the market today are many, and each of them often has an exclusive series of peripherals. Without forgetting the countless amount of sensors. But each card and each of its peripherals requires support libraries to be able to use and integrate them correctly in their projects.

Raspberry Pi 2 - the board

Let’s think, for example, of Arduino boards and their success, due not only to the boards, but to the large amount of libraries available for the use of many peripherals and sensors. From here, Adafruit creating its own MicroPython project wanted to ensure a universal development environment for its many boards. He has thus converted or developed many libraries to work on CircuitPython, in order to provide extensive support for this language for all his boards and for an ever wider use of peripherals.

Let’s see together some boards that work correctly with CircuitPython

Adafruit Metro Series Boards

Adafruit has released a series of boards that cover the same functionality as the Arduino ones, called Metro and that also work with the Arduino IDE, but which have been designed to work with CircuitPython.

Adafruit Metro M0 Express
Adafruit Metro M0 Express

For example, the Metro M0 Express has the same format and pinout as Arduino UNO or Zero. So you can also use all the shields and other devices specifically designed to work with Arduino boards.

Adafruit Feather M0 Express

Or the Feather M0 Express suitable for taking up little space, like the corresponding Arduino Nano and Micro.

Programming with Mu Editor

As for programming in this language, a specific editor is used, the Mu Editor, a simple application that is installed on our computer. It works on both Windows, MacOS, Linux and Raspberry. This application allows us to work directly with single board cards, in real time, by connecting them to our computer via USB. Inside the Mu Editor vie there is a serial console that allows us to obtain the output responses from the cards following our commands.

CircuitPython Mu Editor

Mu Editor you will find it at the official website https://codewith.mu, where you can download it and then install it on your PC. There is also a lot of other information on the site, and tutorials to help you with programming.

Leave a Reply