Sipeed M1 MicroPython: Hello World with the uPyCraft IDE

In this tutorial we will check how to write a simple “Hello World” application using a Sipeed M1 board and MicroPython.

Introduction

In this tutorial we will check how to write a simple “Hello World” application using a Sipeed M1 board and MicroPython.

Note that the Sipeed M1 module is based on the Kendryte K210 System on Chip. You can read more about the device on this previous tutorial.

We are going to connect to the board via Serial to a computer and have access to the MicroPython prompt, where we will send a command to print a statement.

For this tutorial I’m assuming the use of uPyCraft, a MicroPython IDE. You can download uPyCraft here. The GitHub page of the project can be seen here. I’ll be using version 1.0.

Note that you should be able to use other serial tools to connect to the device. I’ve also been able to connect to the Sipeed using Putty and the Arduino IDE serial monitor. Nonetheless, with both tools, I’ve sporadically not been able access the MicroPython prompt, whereas with uPyCraft I did not run into any problems.

This tutorial was tested on Windows 8.1.

Getting started

To get started, first connect the board to a computer using a USB cable. The first time you connect the device to the computer, it should start installing the device drivers. Wait for the procedure to finish before proceeding.

For this tutorial you don’t need to have a camera or a LCD connected to the board, since we are only going to print some content on the Python prompt. Nonetheless, if you have both these peripherals connected, the Sipeed should start capturing video and displaying it on the LCD, after the device boots.

After drivers installation, open the uPyCraft IDE. Then, click on the “Tools” menu and, on the “Serial” entry, select the COM port of your device. This is shown in figure 1.

If you have doubts about which COM port corresponds to your board, the simplest way of checking is to unplug the device, check the list of available ports, then plug it back and check which one was added.

Selecting the Sipeed board COM port on the uPyCraft IDE.
Figure 1 – Selecting the Sipeed COM port.

Then click on the “Connect” button, on the right side of the IDE, as shown in figure 2.

Establishing the connection to the Sipeed board with uPyCraft.
Figure 2 – Connecting to the board via serial.

After this, the serial connection to device should be established and we should get access to the MicroPython prompt, as shown in figure 3. Note that an error message will get printed, but it can be ignored.

MicroPython prompt available at the bottom of the uPyCraft IDE.
Figure 3 – The MicroPython prompt.

After this point we should be able to run MicroPython commands in the prompt. To print a “Hello World” message, simply type the command below and press the Enter key of your keyboard:

print("Hello World")

A “Hello World” message should get printed, as shown in figure 4.

Output of the "Hello World" program.
Figure 4 – Output of the program.

Leave a Reply

Discover more from techtutorialsx

Subscribe now to keep reading and get access to the full archive.

Continue reading