Step by Step install of LVGL to esp idf in vsCode

I have searched for simple information and videos but unfortunately there is nothing available.

Can someone explain, step by step how to write a simple program to display a character and a touch box using LVGL in esp idf.

I have no idea how to install / run even the basic examples on this site as there seems to be no instructions available

Thanks !

Hi @merc07. Are you planning to run LVGL on any specific ESP32 board or display? Could you share the model with us?

My advice would be to first run an ESP-IDF hello world example on your board. You can create a hello world project with the ESP-IDF VSCode extension. Flash it and then see if logs are showing on terminal.

After that create a idf_component.yml file inside the main folder of the project with the following content:

dependencies:
  idf:
    version: ==5.4.1
  lvgl/lvgl:
    git: https://github.com/lvgl/lvgl.git
    path: .
    version: master

You can chose a specific idf and lvgl version.

Then clean and rebuild the project. LVGL should build as well and you should be able to include lvgl.h and change LVGL configurations in menuconfig.

If that works, then it’s a matter of configuring LVGL buffers and choosing the right ESP-IDF driver for your specific display. It could be SPI, RGB etc.

Please share your specific display and we can guide you to the right drivers.

Thanks for the reply, it’s a ESP32-C6-LCD-1.9 Touch.

I have been trying to find the most basic example of a line of text and a touch button for use in Arduino.

The examples that came with the device fail with many errors when compiling but to be honest these examples are very complex and wouldn’t help even if they did load.

LVGL is nothing to install, is source code in project… Try use platformio better for start. You place in ini file and all is downloaded into project for you.

@merc07 are you planning to use ESP-IDF or Arduino framework? At first you said you needed IDF help hence my instructions.

From what I have researched your board uses an SPI display with ST7789 driver. IDF supports that kind of display out of the box. Here you can find some references to that driver:

https://docs.espressif.com/projects/esp-idf/en/v5.1/esp32s3/api-reference/peripherals/lcd.html

Search for ST7789.

I also know that Waveshare usually uses LVGL v8.4.0 for their examples. That should be ok and waveshare examples usually work out of the box. Unless you wanted LVGL v9. in that case you have to do some modifications to their examples

But again if you can at least run ESP-IDF hello world example on your board that’s a good starting point. Then we can go from there on how to enable LVGL component.

But if you wanted Arduino framework maybe @fbiego could have some advice.

if you are struggling with ESP-IDF basic hello world, maybe you are better off asking on their specific forum: Bot Challenge

Thanks all…Yes the display is the ST7789 and the touch is CST816.
I can write to the display now no problem but have no idea about the touch - now I have been told it is only compatible with LVGL, not the standard CST816 libraries in Arduino hence there are no simple examples available.

I have had the helloworld example working at one point using ESP-IDF through code but that was a right mess, code kept asking to set everything up each time.
Arduinio and LVGL just never worked - maybe as you say, the wrong version ?

I’ll have a look at just ESP-IDF or Platformio over the w/e and start again

Tried Platformio but it won’t even allow me to run the arduino framework for this board, its not supported and most likely never will be…
I think there are mods to get it going, i’ll have to continue googling…

Require A3 simply add Arduino 3 , PIO have only A2 in packs, but no problem use external. For example

platform = https://github.com/pioarduino/platform-espressif32/releases/download/51.03.05/platform-espressif32.zip
;https://github.com/pioarduino/platform-espressif32/releases/download/stable/platform-espressif32.zip
framework = arduino

Thanks, I have seen that, does it have to been changed for every new project ?
I have added it but it just crashes out each time when trying to upload anything
edit, changes I found were slightly different to yours, may be able to upload now…

Show complete platformio.ini in your project folder .
And afte ini edit save it and wait for all download is completed, based on internet speed minutest or hour…

Guessing the libraries are different to that in arduino ?
It needs this…#include <Arduino_GFX_Library.h>
Then when trying to upload the hello world example that came with the board, every line is an error.

Honestly don’t know where to go from here if a simple hello world won’t even run using the arduino frame work - is it not compatible with normal arduino then ?

Why you not shown your setup and loop code ? Arduino isnt plug and play…

It’s the hello world example that came with the board.
It works using ardunio but not in platformio/ardunio

/*******************************************************************************

  • Start of Arduino_GFX setting
  • Arduino_GFX try to find the settings depends on selected board in Arduino IDE
  • Or you can define the display dev kit not in the board list
  • Defalult pin list for non display dev kit:
  • Arduino Nano, Micro and more: CS: 9, DC: 8, RST: 7, BL: 6, SCK: 13, MOSI: 11, MISO: 12
  • ESP32 various dev board : CS: 5, DC: 27, RST: 33, BL: 22, SCK: 18, MOSI: 23, MISO: nil
  • ESP32-C3 various dev board : CS: 7, DC: 2, RST: 1, BL: 3, SCK: 4, MOSI: 6, MISO: nil
  • ESP32-S2 various dev board : CS: 34, DC: 38, RST: 33, BL: 21, SCK: 36, MOSI: 35, MISO: nil
  • ESP32-S3 various dev board : CS: 40, DC: 41, RST: 42, BL: 48, SCK: 36, MOSI: 35, MISO: nil
  • ESP8266 various dev board : CS: 15, DC: 4, RST: 2, BL: 5, SCK: 14, MOSI: 13, MISO: 12
  • Raspberry Pi Pico dev board : CS: 17, DC: 27, RST: 26, BL: 28, SCK: 18, MOSI: 19, MISO: 16
  • RTL8720 BW16 old patch core : CS: 18, DC: 17, RST: 2, BL: 23, SCK: 19, MOSI: 21, MISO: 20
  • RTL8720_BW16 Official core : CS: 9, DC: 8, RST: 6, BL: 3, SCK: 10, MOSI: 12, MISO: 11
  • RTL8722 dev board : CS: 18, DC: 17, RST: 22, BL: 23, SCK: 13, MOSI: 11, MISO: 12
  • RTL8722_mini dev board : CS: 12, DC: 14, RST: 15, BL: 13, SCK: 11, MOSI: 9, MISO: 10
  • Seeeduino XIAO dev board : CS: 3, DC: 2, RST: 1, BL: 0, SCK: 8, MOSI: 10, MISO: 9
  • Teensy 4.1 dev board : CS: 39, DC: 41, RST: 40, BL: 22, SCK: 13, MOSI: 11, MISO: 12
    ******************************************************************************/
    #include <Arduino_GFX_Library.h>

#define GFX_BL 15 // default backlight pin, you may replace DF_GFX_BL to actual backlight pin

Arduino_DataBus bus = new Arduino_HWSPI(6 / DC /, 7 / CS /, 5 / SCK /, 4 / MOSI */);
Arduino_GFX gfx = new Arduino_ST7789(bus, 14 / RST */,0 /rotation/,0/IPS屏/,170/w/,320/h/,35/起始列偏移(左边)/,0/起始行偏移(上边)/,35/结束列偏移(右边)/,0/结束行偏移(下边)/);

void setup(void)
{
Serial.begin(115200);
// Serial.setDebugOutput(true);
// while(!Serial);
Serial.println(“Arduino_GFX Hello World example”);

#ifdef GFX_EXTRA_PRE_INIT
GFX_EXTRA_PRE_INIT();
#endif

// Init Display
if (!gfx->begin())
{
Serial.println(“gfx->begin() failed!”);
}
gfx->fillScreen(BLACK);

#ifdef GFX_BL
pinMode(GFX_BL, OUTPUT);
digitalWrite(GFX_BL, LOW);
#endif

gfx->setCursor(10, 10);
gfx->setTextColor(RED);
gfx->println(“Hello World!”);
printf(“w:%d,h:%d\n”,gfx->width(),gfx->height());
delay(5000); // 5 seconds
}

void loop()
{
gfx->setCursor(random(gfx->width()), random(gfx->height()));
gfx->setTextColor(random(0xffff), random(0xffff));
gfx->setTextSize(random(6) /* x scale /, random(6) / y scale /, random(2) / pixel_margin */);
gfx->println(“Hello World!”);

delay(1000); // 1 second
}

ini file ?

Plus maybe good for you is understand what is Arduino_GFX

I have no idea what is supposed to be in the ini file, just what gets put automatically, googling shows many people with the same issues.

What else do I need in there ?..

Sorry, but you still dont show relevant info then last message for you :slight_smile:
Creating projects based on arduino or IDF result to many combination of versions. Exactly your Hello world start with
A. Arduino pack v 2.0.11 - 3.x latest
B. pioarduino mix this with IDF vesion 4.x-5.y
C. arduinoGFX versions

This basic project result into around 100 combinations and only 20% create working code. After you add here LVGL combinations get 1000 and …

Start learn how make systems work or pay somebody who knows

You kindly showed me the initial file, that’s what I was using ?

Like everyone else, think I’ll give up, there is just no information.
I was told to use platformio, it’s easy you say, but where are we supposed to start ?
Where are the examples.

Again Lvgl - no information, no simple examples it’s ridiculous.

I have been programming c++ for 35 years, I know what I’m doing when it comes to that.

Nothing works, platformio is defunct, probably can’t run anything from Arduino V2 onwards

Lvgl it’s the same like we are all supposed to understand - again, no examples and it doesn’t even work with Arduino?

‘Start learn how make systems work or pay somebody who knows’
That’s why I came here for help to start me off, but even this forum wants to sell a course to me now ?

Then ok one more free course. Is irelevant how much years anybody programming in any language on windows target. Work with bare metal is total different.

  1. step is read MCU base docu + all used peripherals docu as LCD TOUCH …
  2. step if you choice Arduino as OS , create empty project
  3. step choice and add lcd controll library or write own drivers same for touch
  4. debug and do LCD working init and set color
  5. here maybe you can start place own code Hello world

Maybe try use this GitHub - Graunephar/Esp32-C6-blink-in-pure-Arduino-framework-with-PlatformIO: Esp32 C6 on-board RGB LED example in Arduino and PlatformIO

and continue from step 3

I had tried several libraries for the Touch chip in Arduino and a simple sketch for testing but could not get it working.

I then contacted waveshare who told me the touch panel will only work under LVGL - which doesn’t seem to work under Arduino hence why waveshare had no touch examples I guess.
I tried v8xx and v9xx as mentioned above.
They claim it’s fully compatible with esp and Arduino…

I’ll try the last examples you mentioned, just need to get something working in platformio before I try LVGL again.