DIY Projects

uPiCraft, a MicroPython IDE dedicated to the development of IoT based on ESP8266, ESP32, microbit, pyBoard

9 upicraft blink example 1
Best deal at:
CHF 12.61

In the previous two articles (unpacking the Wemos LoLin32 Lite under MicroPython and reinstalling the MicroPython firmware), we briefly discovered the MicroPython firmware pre-installed on the Wemos LoLin32 Lite. MicroPython is a port of the Python language adapted to micro-controllers. We have an interpreter (REPL and WebREPL from a browser) as well as a file system that can manage scripts. The command interpreter REPL (or WebREPL) is perfect to do tests, take control of the environment and do maintenance operations (WiFi configuration, script management, stop a script …) but it’s far from ‘an editor.
Fortunately, the Dfrobot team has developed a simple and very effective small code editor (IDE). It can even install the MicroPython firmware as soon as you plug in a new development board. It supports boards based on ESP32, ESP8266, Pyboard, WyPi and Micro: bit of the BBC. We will discover all of this now

Install uPyCraft on Windows

At the moment the uPyCraft IDE is only available for Windows. I tested it on a Windows 10 64-bit without any crashes. The versions for macOS and Linux are announced but the link is not yet active. The source code is unfortunately not available for download, so we can not adapt and compile the code for other platforms. The uPiCraft download page is here. uPiCraft comes as an executable that requires no installation. It is very convenient to carry on a USB key.

Some documentation translated into English (the rest is in Chinese) is accessible from the help menu or directly on this web page. Fortunately, Google translate can come to our rescue!

Install the MicroPython firmware on an ESP8266 or ESP32

If you have not yet tested the firmware MicroPython, it may be the moment. Get an ESP8266 or ESP32 board. Here I used a Wemos d1 mini. Plug the board into a USB port and launch uPiCraft. In the Tools menu, open the Serial submenu and select the COM port to which the board is connected. uPiCraft is able to install firmware on ES8266, ESP32-based boards as well as on BBC microbit boards.

There are two methods to install the firmware. The first is to connect to the board by clicking on the connection icon (be careful, the icon is reversed).

If the firmware is not detected, a window opens and offers to install it. The second method is to call the Burn Firmware installation utility from the Tools menu.

Several options are available:

We finish by launching the installation of the firmware.

Features offered by uPiCraft

uPiCraft behind its simple interface provides all the features we already know about the command line tools rshel (presented in this tutorial) or ampy of Adafruit. The huge advantage of uPiCraft is to be able to develop directly on the board. You can at any time upload (Download) or upload and execute (Download And Run) the script. We also have access to the file system. You can navigate the folder tree and perform

The Workspace

We have a workspace that allows us to manage projects.

File menu

File menu options are very classic. In addition to the functions of creation, opening and saving of files, one also finds the menu Examples which groups the examples by categories. Some examples are simple shortcuts that show the example that uses the desired function. The flush Directory option refreshes folders and files in the side navigation bar. This is useful when manually adding or moving files into the workspace. This is also the only time we have at the moment to organize the files in the workspace. You have to go through the Windows file manager to manually move the files into the project folders.

Edit Menu

uPiCraft is a simple editor but has a syntax check (Check Syntax option).

Tools menu

If you want to get started in the development of connected objects in MicroPython, you must absolutely test uPiCraft. The code editor is able to check the syntax and indicate the lines concerned in case of error. The communication with the board is totally transparent. You can start or stop a script at any time (with the F5 key). The boot script is very easy to modify. Finally uPiCraft offers some libraries that lack the firmware (temperature measurements ds18b20, HT1632, MLX90614, OLED screen SSD1306, MQTT …). There are also some examples to take in hand the language. It is accessed from the File menu. The list of examples is changed according to the development board selected in the Tools -> Board menu.

Icon bar and context menu

Finally, we have a menu bar that includes some commands:

Finally, we have a contextual menu to perform the operations on the files. It is opened by right clicking on a file. The menu allows you to:

Note. The menu opens on all files but in fact, the menu options are valid only on the files of the connected device.

Note on handling files

As we have just seen, the new scripts are saved in the workspace. To send them on the board, you can proceed in 3 ways:

A small example to finish

Nothing better than a small example to conclude this article. Go to the File menu and in the Basic examples, open the Blynk script. Change the pin. Here, I connected the LED on pin D4 which corresponds to the GPIO2. If necessary, here is the spindle location of the ESP8266. Unlike ESP8266 programming in C++ with the Arduino IDE, there is no pin boardping. For example, you should indicate 2 instead of D4.

#hardware platform: FireBeetle-ESP8266

import time
from machine import Pin

while True:

Make sure you are connected to the ESP8266 and press F5 to upload and start the script. The LED should start flashing immediately. To interrupt the script, place the cursor in the console at the bottom of the screen and press CTRL + C.

If the LED remains on, execute the following commands

>>> from machine import Pin
>>> led=Pin(2,Pin.OUT)
>>> led.value(0)

That’s it, I hope you’ll want to try MicroPython now. It is an extremely powerful language and quite simple to handle. In the next tutorial we will see how to manage the WiFi connection.


Click to rate this post!
[Total: 0 Average: 0]
Exit mobile version