Skip to main content

0.1. Setting up MicroPython

A board does not run MicroPython out of the box. Unlike Arduino, where you compile your code on the computer and send the finished program to the board, MicroPython is an interpreter that lives on the board itself. So before writing any code, you put MicroPython onto the board once, and from then on you send it .py files to run.

This page takes you from a board fresh out of the box to a board running your code. You only have to do it once.

By the end of this page you will have:

  • The driver your computer needs to see the board
  • Thonny installed, ready to write and run code
  • MicroPython firmware on the board
  • The Soldered drivers copied onto the board, ready for the Qwiic modules
ℹ️
Work through the steps in order, because each one depends on the one before it.

1. Install the USB driver

The NULA Mini talks to your computer through an onboard CH340 chip, and neither Windows nor macOS ships a driver for it. Without the driver the board gets power but never appears as a port, so nothing later on this page will work.

CH340 drivers

Installing the driver on Windows, macOS and Linux, and what to do when the board still is not detected.

Once installed, plug the board in and confirm it appears:

SystemWhat to look for
WindowsA COM port in Device Manager under Ports (COM & LPT)
macOSA device named /dev/cu.wchusbserial...
LinuxA device named /dev/ttyUSB0
ℹ️
Note the port name down, because the steps below ask for it.

2. Install Thonny

Thonny is a small Python editor built for exactly this job. It can flash MicroPython onto the board, edit files directly on it, and give you a live prompt to talk to it, all without a command line.

Download Thonny

Free Python editor for beginners, available for Windows, macOS and Linux.

ℹ️
If you would rather work from a terminal, everything on this page can be done with esptool and mpremote instead. Those commands are given alongside each step.

3. Put MicroPython on the board

The NULA Mini is an ESP32-C6 board, so it runs the ESP32_GENERIC_C6 build of MicroPython.

Using Thonny

  1. Connect the board over USB-C.
  2. Open Tools → Options → Interpreter.
  3. Set the interpreter to MicroPython (ESP32).
  4. Choose your board's port from the port dropdown.
  5. Click Install or update MicroPython at the bottom of the dialog.
  6. In the window that opens, pick the ESP32-C6 target and the latest version offered, then click Install.

Thonny downloads the firmware and flashes it for you. When it finishes, close the dialog.

Using the command line

Download the latest stable .bin first:

MicroPython firmware for ESP32-C6

Official download page. Take the latest stable build, not a nightly.

pip install esptool
python -m esptool --chip esp32c6 --port COM5 erase_flash
python -m esptool --chip esp32c6 --port COM5 --baud 460800 write_flash 0 ESP32_GENERIC_C6-<version>.bin

Replace COM5 with your port, and <version> with the filename you downloaded.

ℹ️
Erasing first is not strictly required, but it clears out anything left over and avoids a class of confusing failures. If flashing fails partway, try again with a slower baud rate such as 115200.

4. Say hello

With MicroPython installed, the board gives you a live prompt called the REPL: you type a line, the board runs it immediately and prints the answer. It is the quickest way to confirm everything is working.

In Thonny, look at the Shell panel at the bottom. You should see something like MicroPython v1.x.x on ... followed by >>>. Type:

print("Hello from the NULA Mini!")

Press Enter. The board prints it straight back.

ℹ️
If the Shell is empty, click the Stop/Restart button in Thonny's toolbar to reconnect. If it still shows nothing, the wrong port is selected in Tools → Options → Interpreter.

The REPL runs at 115200 baud, which is the default in Thonny and in mpremote, so there is nothing to configure.


5. Copy the Soldered drivers onto the board

Eight of the examples in this kit use the three Qwiic modules: the 16x2 LCD, the ultrasonic distance sensor and the SHTC3 temperature and humidity sensor. Each one needs a driver, and in MicroPython a driver is simply a .py file that has to live on the board.

The drivers are in the lib folder of the examples repository:

DriverUsed byProvides
lib/LCD.py4.1, 4.2, 7.1, 7.7LCD_I2C, the 16x2 Qwiic display
lib/SHTC3.py5.1, 7.1SHTC3, the temperature and humidity sensor
lib/UltrasonicSensor.py3.1, 3.2, 7.3UltrasonicSensor, the distance sensor
lib/Qwiic.pythe three drivers aboveshared Qwiic helper they all build on

MicroPython looks for imported modules in a folder called lib on the board, so the whole folder goes across as-is.

Using Thonny

  1. Open View → Files if the Files panel is not already showing. It has two halves: your computer on top, the board underneath.
  2. In the top half, navigate to the lib folder of the examples repository.
  3. Right-click the lib folder and choose Upload to /.

Using the command line

pip install mpremote
mpremote connect auto fs cp -r lib :
ℹ️
Nothing else needs installing. The urequests and ntptime modules that the Wi-Fi examples use are already built into the firmware.

Sections 1, 2 and 6 use nothing but built-in modules, so if you want to start immediately you can come back to this step when you reach section 3.


6. Run an example

Open any example .py file in Thonny and press Run (the green play button). The code runs on the board and its output appears in the Shell.

From the command line:

mpremote connect auto run 1_Basic_Skills/1.1_Hello_World/1.1_Hello_World.py

To make a program start by itself whenever the board powers up, which is useful once a project is finished and you want it running without a computer attached, copy it onto the board named main.py:

mpremote connect auto fs cp 1_Basic_Skills/1.2_LED_blinking/1.2_LED_blinking.py :main.py
ℹ️
A program saved as main.py starts every time the board is powered. To stop it and get the prompt back, press Ctrl+C in the Shell.

If something is not working

SymptomCause
No port to choose anywhereThe CH340 driver is missing. Go back to step 1.
ImportError: no module named 'LCD'The lib folder has not been copied to the board, or it landed somewhere other than /lib. See step 5.
The Shell shows nothing, or nothing but noiseThe wrong port is selected, or another program is holding it open. Close any other serial monitor.
Code runs but the board seems to ignore editsYou edited the copy on your computer and ran the copy on the board, or the other way round. Check the title bar in Thonny to see which file is open.

Next

You are set up. On to the first example.

1.1. Hello World

Print your first message from the board to your computer.