LittlevGL with Micropython and Thonny IDE for STM32F401

Dear All,

I am totally new to Micropython.
I would like to use LittlevGL with the Thonny IDE.

The target hardware is a ST Nucleo board (STM32F401) which I can make running with Micropython and the Thonny IDE.

My problem is that I really couldn’t understand at all how to add LittlevGL to the Thonny project file system.

In short, I would need to know exactly how to be able to get the following instruction working within the Thonny IDE:

import lvgl as lv

I always get the error message: ImportError: no module named ‘lvgl’

If someone could help me with a detailed and understandable step by step instruction I would appreciate it very much.

Additionally, it would be great if someone could also tell me what I need to modify within the code to make a 2.8" display with ILI9341 driver running on the STM32F401 target system (with parallel or with SPI interface).

Thank you very much in advance!


@amirgon This is more in your league than ours.

Hi @aklein9999!
I know nothing about Thonny IDE.
I assume this is a Python editor, probably with nice integration of Debugger, Build System etc.

The important thing you need to understand is that LittlevGL and its Micropython binding are C Projects, not Python projects. Think of them as an extension to the MicroPython core libraries (lvgl is a “native” python module).

In order to make “import lvgl as lv” work, you first need to build Micropython with lvgl binding on your machine, specifically the stm32 port. I believe that Thonny will not help you with this. You need to have some understanding of C code and how to build C with GNU Make.

Micropython LittlevGL binding can work in principle with any embedded architecture and display hardware, but each architecture and hardware requires porting.
I ported (and maintaining):

  • The unix port that can be used on any Linux device with either SDL or FrameBuffer
  • ESP32 port with ILI9341

There has been attempts to port it to other architectures and hardware, but unfortunately no one has (yet) opened a pull request to add new architectures / hardware to the lv_micropython repo.

For STM32, have a look at
If you want to try porting micropython to STM32, I’ll be happy to help.

Dear Amirgon,

Thank you very much for your help.
I have some basic understanding of C, but more on an Arduino level.
How to build C with GNU make I have no experience.
I fully understand the porting issue, if you can help me to port it to STM32 it would be great.

You are saying the lvgl is a “native” python module, so I guess I need to merge it with micropython and then upload the whole thing to the target board?
If so, how is it done? I really would need a step by step instruction.

So far I do the following to upload Micropython to he STM32 board:

  1. I download the correct .dfu file for my target hardware (
  2. I convert the .dfu file into a .hex file with the DFU file manager software
  3. I upload the generated .hex file to the target hardware with the STM32 ST-Link Utility software.

At which point do I need to do what?

I am not sure if I have enough skills to do it by myself. So if it would be an option I would also pay someone to do it for me, including the STM32 porting, maybe you have an idea who could help me?

Or maybe it is less complicated than I think and you can walk me through the process?

Thank you very much!

Not exactly. You need to build Micropython with lvgl binding. The simplest way is to build lv_micopython. There is some work there to port it to STM32 and to port it to ILI9341 hardware.

No, you can’t download a compiled Micropython image. You need to build the image from sources.

I don’t know personally anyone who is ready to do it for money, but I’m sure you’ll find someone because it’s not a difficult task.
There are outsourcing websites you can try, just google it. (Personally I never tried using any outsourcing service so I cannot recommend a specific website or company)