Best driver for ili9341 display

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
User avatar
russ_h
Posts: 27
Joined: Thu Oct 03, 2019 2:26 am

Re: Best driver for ili9341 display

Post by russ_h » Sat Dec 12, 2020 6:23 am

I modified the devbis st7789_mpy driver to run the ILI9342C display in the M5Stack Core. Like the st7789 driver, it writes directly to the display and is not framebuffer based. The driver is largely untested but it works. I'll be working with it this weekend.

https://github.com/russhughes/ili9342c_mpy

User avatar
Klaas
Posts: 3
Joined: Tue Dec 15, 2020 11:23 am

Re: Best driver for ili9341 display

Post by Klaas » Tue Dec 15, 2020 11:26 am

Hi Russ,
Was there a reason to embed it into micropython and not make it a native module?

User avatar
russ_h
Posts: 27
Joined: Thu Oct 03, 2019 2:26 am

Re: Best driver for ili9341 display

Post by russ_h » Tue Dec 15, 2020 8:01 pm

I tried writing a native module a while ago and I was not able to make it work. Time constraints caused me to switch back to an embedded driver. I'm working on a series of IoT classes and in my case having all the important modules embedded keeps them from going missing due to error or malicious intent.

https://youtu.be/0uWsjKQmCpU
Last edited by russ_h on Fri Dec 18, 2020 2:02 am, edited 1 time in total.

User avatar
Klaas
Posts: 3
Joined: Tue Dec 15, 2020 11:23 am

Re: Best driver for ili9341 display

Post by Klaas » Wed Dec 16, 2020 3:08 pm

Looks awesome! I experimented with native modules and controlling hardware from them seems to be an issue. That is solved if you're inside a build for a certain chip (e.g. esp32). So in that sense embedding makes more sense. Did you have a look at the loboris esp32 version? https://github.com/loboris/MicroPython_ ... _LoBo/wiki I was tiring to isolate some of the embedded modules into native modules but without success because I cannot get to the hardware. Would be nice if there was a proper makefile by port.

Divergentti
Posts: 47
Joined: Fri Sep 04, 2020 9:27 am
Location: Hanko, Finland
Contact:

Re: Best driver for ili9341 display

Post by Divergentti » Wed Jan 13, 2021 2:01 pm

I got ILI9341 and touchscreen working.

This is very very first draft, started yesterday https://github.com/divergentti/airquali ... en/main.py

At this moment MH-Z19 CO2 NDIR is updated asynchronously in the backgroud, PMS7003 particle sensor and BME280 will be added later (whenever Post of Finland find those China parcels) and adjusting WiFi and ASYNC_MQTT shall be there after a few changes.

Next challenge will be keyboard, orientation etc. and perhaps adding scandinavian äöå characters to it. And I have to figure out is it easiest to create and destroy an usermenu objects so that I can have multiple menus in the screen.

User avatar
Mike Teachman
Posts: 97
Joined: Mon Jun 13, 2016 3:19 pm
Location: Victoria, BC, Canada

Re: Best driver for ili9341 display

Post by Mike Teachman » Wed Jan 13, 2021 5:37 pm

Hi @Divergentti

you might be able to scrape some code and ideas from my air quality project? Similar project - ILI9341 display, particulate sensor, MQTT, uasyncio.
Here are some links:
Github: https://github.com/miketeachman/micropy ... reet-sense
Hackaday project: https://hackaday.io/project/162059-street-sense
In the news: https://www.cbc.ca/news/canada/british- ... -1.5396494

I'll keep an eye on your project as well.

Mike

Divergentti
Posts: 47
Joined: Fri Sep 04, 2020 9:27 am
Location: Hanko, Finland
Contact:

Re: Best driver for ili9341 display

Post by Divergentti » Thu Jan 14, 2021 7:44 am

Mike Teachman wrote:
Wed Jan 13, 2021 5:37 pm
Hi @Divergentti

you might be able to scrape some code and ideas from my air quality project? Similar project - ILI9341 display, particulate sensor, MQTT, uasyncio.
Here are some links:
Github: https://github.com/miketeachman/micropy ... reet-sense
Hackaday project: https://hackaday.io/project/162059-street-sense
In the news: https://www.cbc.ca/news/canada/british- ... -1.5396494

I'll keep an eye on your project as well.

Mike
Wow! Learning curve will be much smoother with excellent examples like yours. Thank you very much!

rahmed
Posts: 9
Joined: Sun Jan 03, 2021 10:15 am

Re: Best driver for ili9341 display

Post by rahmed » Thu Jan 14, 2021 7:41 pm

russ_h wrote:
Sat Dec 12, 2020 6:23 am
I modified the devbis st7789_mpy driver to run the ILI9342C display in the M5Stack Core. Like the st7789 driver, it writes directly to the display and is not framebuffer based. The driver is largely untested but it works. I'll be working with it this weekend.

https://github.com/russhughes/ili9342c_mpy
@russ_h,
First of all thanks for sharing the driver details. If I download your complied firmware to esp32 MCU I am able to import ili9342c and able to setup the SPI without any error, I don't have the display yet but I will order over the weekend.
If I download the source files from github and try to built firmware with the following command
make BOARD=GENERIC PYTHON2=python USER_C_MODULES=../../../ili9342c_mpy/ all
it commence with the following message
Including User C Module from ../../../ili9342c_mpy//src
Building with ESP IDF v3
GEN build-GENERIC/sdkconfig.h
and I also get the complier message
CC ../../../ili9342c_mpy/src/ili9342c.c
and at the end I have a successful complication but after downloading to esp32 MCU I am get import Error for ili9342c
Can be please be kind enough to let me know how did you compile your Firmware and what I need to do different or what I am doing wrong?
Thanks in advance for your support
Kind Regards
Rizwan

User avatar
russ_h
Posts: 27
Joined: Thu Oct 03, 2019 2:26 am

Re: Best driver for ili9341 display

Post by russ_h » Fri Jan 15, 2021 1:47 am

I pushed an incomplete repo and broke the build. It should build correctly if you pull or download a new copy.

Russ

User avatar
tve
Posts: 216
Joined: Wed Jan 01, 2020 10:12 pm
Location: Santa Barbara, CA
Contact:

Re: Best driver for ili9341 display

Post by tve » Fri Jan 15, 2021 5:27 am

A design point I've been successful with for UI-type of use-cases is to use a "GS4" (4-bit) framebuffer and then do a color table lookup when sending the FB to the display. I use about 11 colors for the UI inspired by the google material design color picker, which leaves a couple more colors for arbitrary use (i.e. "I don't know yet"). The GS4 FB has the advantage that it doesn't absolutely require SPIRAM and it's faster than RBG565. The function to send the FB to the display expands 2 rows at a time to rgb565 and then performs one SPI transaction. Sending the 240x320 FB that way takes <100ms in "pure" python using the viper code emitter. This could be sped-up by writing that part in C and in particular by using direct calls to esp-idf to queue the SPI transactions (the MP SPI drivers sucks performance-wise), but when I got below 100ms I reached the "fast enough for me" state. None of this is useful if you want to display pictures, though. The same driver adapted to an ili9486 320x480 4" display takes ~150-170ms to send the FB.

I'm weary of display drivers that send commands directly to the display 'cause the MicroPython esp32 SPI driver is so slow and blocking. If you start rendering fonts the number of individual commands can escalate real quick resulting in slow incremental display updates.

Post Reply