Python Programming Help

 The jokers say that after a day of work at the computer the typical programmer goes home, sits down at his PC, and thus rests. But the truth is actually much worse than this joke: many of us, when we come home from work, devote the remaining time before sleep... Programming microcontrollers. 🙂 The average person can't understand it, but Arduino, Teensy or ESP is really a very good hobby. Their only drawback is the need to program at a fairly low level, if not in Assembler, then in Arduino C or Lua. But now Python is on the list of microcontroller programming languages. To be more precise, MicroPython. In this article I will try to demonstrate its capabilities as much as possible.


Where did it all start?

It all started with a campaign on Kickstarter. Damien George, a developer from England, designed a microcontroller board specifically for Python. And the campaign took off. It was initially announced at £15,000, but it raised six and a half times that amount - £97,803.


How is this fee any better?

The author of the project cited a number of advantages of his platform compared to the Raspberry Pi and Arduino:

Power - the MP is more powerful compared to the Arduino microcontroller, with 32-bit ARM processors like the STM32F405 (168 MHz Cortex-M4, 1 Mbyte of flash memory, 192 Kbytes of RAM) used here.

Ease of use - the MicroPython language is based on Python, but somewhat simplified, so that commands to control sensors and motors can be written literally in a few lines.

No compiler - to run a program on the MicroPython platform, there is no need to install any additional software on the computer. The board is detected by the PC as a usual USB memory stick - you just need to put a text file with the code on it and reload it, and the program will immediately start executing. For convenience, it is still possible to install a terminal emulator on the PC, which allows you to enter elements of the code from the computer directly on the platform. If you use it you don't even have to reboot the board to check the program. Every line will be immediately executed by the microcontroller.

Low cost - Compared to the Raspberry Pi the PyBoard platform is a bit cheaper and therefore more accessible.

Open platform - just like the Arduino, the PyBoard is an open platform, all schematics will be publicly available, which means that you can design and build a similar board yourself, depending on your needs.

And what, just an official board?

No. For all its merits, the PyBoard (as the MicroPython developer board is called) is quite expensive. But thanks to the open platform, it's already possible to run MicroPython built specifically for it on many popular boards. At the moment there are versions available:

for BBC micro:bit - a British development, positioned as the official textbook for computer science classes;

Circuit Playground Express, a development of the well-known company Adafruit. It is a board that includes LEDs, sensors, pins and buttons. It is programmed by default with Microsoft MakeCode for Adafruit. It is a block-based (Scratch-like) "code" editor;

The ESP8266/ESP32 is one of the most popular boards for IoT development. It could be programmed in Arduino C and Lua. And today we will try to install MicroPython on it.

ESP8266 board

The ESP8266 board


Getting ready to go to coding help

Before you can write programs, you need to configure the board, install the firmware on it, and install the necessary programs on your computer.