MicroPython with Jupyter Lab
Nano 33 BLE Sense

Introduction

To use MicroPython with Arduino, Arduino Lab for MicroPython is a standard way. I found a Jupyter MicroPython Kernel for ESP8266/ESP32. So I tried to use it with Arduino Nano 33 BLE Sense.

System Configuration

Run Jupyter Lab on WSL2 on Windows 10 and use MicroPython on an Arduino Nano 33 BLE Sense connected to Windows 10.

Install the MicroPython Kernel on Jupyter to communicate with MicroPython. This kernel is written for ESP8266/ESP32, but it can also be used with MicroPython for Arduino Nano 33 BLE Sense.

The environment used this time was as follows:

I installed below softwares.

Installing MicroPython

To run MicroPython on the Arduino Nano 33 BLE Sense, installing it onto the board is required. I did it on Windows.

Details are shown here.

Using USB ports from WSL2

To use a device connected to a Windows 10 USB port from WSL2, a software called usbipd need to be used.

If you do not use WSL2, you do not need this part.

Installing usbipd

Install usbipd to Windows 10.

Get the newest msi file from here and run it to install.

Details are shown here.

Configuration

After installing usbipd, run usbipd to access USB ports from WSL2.

Open Powershell in administrator mode. Run usbipd list command with Arduino connected to you PC. For example, you will get the following result (only a portion of the result is shown). It contains some Japanese words. The “シリアル デバイス” means “serial device”.

1
2
3
4
PS C:\> usbipd list
Connected:
BUSID  VID:PID    DEVICE                                     STATE
1-2    2341:025a  USB シリアル デバイス (COM6)               Not shared

In my case, the COM6 is Arduino. In the above case, STATE is “Not shared”, so it is not shared with WSL2.

At this point, when I ran lsusb on WSL2, the result was as follows In my case.

1
2
3
4
$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
$

Next, use usbipd to bind and attach the device, so that COM6 will be available from WSL2.

First, execute the bind process. The busid is the busid shown in usbipd list. At this point, the status is updated from “Not shared” to “Shared”.

1
2
3
4
5
PS C:\> usbipd bind --busid 1-2
PS C:\> usbipd list
Connected:
BUSID  VID:PID    DEVICE                                     STATE
1-2    2341:025a  USB シリアル デバイス (COM6)               Shared

Next, perform the attach process. At this point, the status will be updated from “Shared” to “Attached”. In this state, the USB port is visible from WSL2.

1
2
3
4
5
6
7
8
PS C:\> usbipd attach --wsl --busid 1-2
usbipd: info: Using WSL distribution 'Ubuntu-24.04' to attach; the device will be available in all WSL 2 distributions.
usbipd: info: Detected networking mode 'nat'.
usbipd: info: Using IP address 172.25.128.1 to reach the host.
PS C:\> usbipd list
Connected:
BUSID  VID:PID    DEVICE                                     STATE
1-2    2341:025a  USB シリアル デバイス (COM6)               Attached

At this time, when I run lsusb on WSL2, the following appeared In my case. In the third line, you can see that the Arduino is recognized.

1
2
3
4
5
$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 2341:025a Arduino SA Board in FS mode
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
$

Finally, check the device file name.

In my case it was /dev/ttyACM0.

1
2
3
$ ls -l ttyACM0
crw-rw---- 1 root dialout 166, 0 Feb 24 08:01 ttyACM0
$

Set the access rights for the file so that the user running jupyter can access it.

Jupyter Lab

Access MicroPython on Arduino Nano 33 BLE from Jupyter Lab.

In the following, I used a Python virtual environment(venv).

Installing Jupyter Lab

To install Jupyter Lab, see here.

Installing MicroPython Kernel

To access MicroPython on Arduino from Jupyter Lab, we need to install the MicroPython Kernel in Jupyter.

Installation instructions are available at https://github.com/goatchurchprime/jupyter_micropython_kernel/.

I installed it in the following way:

1
2
(venv)$ pip install jupyter_micropython_kernel
(venv)$ python -m jupyter_micropython_kernel.install

After this, if you check the kernel, you will see that the MicroPython Kernel has been added.

1
2
3
4
(venv)$ jupyter kernelspec list
Available kernels:
  python3        /home/user/.local/share/jupyter/kernels/python3
  micropython    /home/user/.local/share/jupyter/kernels/micropython

Running Jupyter Lab

Run the Jupyter Lab.

1
(venv)$ jupyter lab

If a browser does not open, access the URL that is showen when you start Jupyter Lab.

Select MicroPython - USB, under Notebook.

You will see the regular Jupyter Lab screen.

First, you need to connect to the serial port. Run the %serialconnect command.

1
serialconnect [SERIAL PORT] [BAUDRATE]

In my case, it worked without specifying the port or communication speed.

Executes MicroPython commands. The first command displays “Hello World”, the second blinks the LED.

Others

  • If I set the LED blinking to an infinite loop, interrupts will not work and I cannot stop it from the browser.
  • For MicroPython-related documentation, see https://docs.arduino.cc/micropython/

Version

Hardware:Arduino Nano 33 BLE Sense
Software:Jupyter

Last Update

August 16, 2026

inserted by FC2 system