Friday, September 02, 2022

ESP32 with 2.8 inch LCD display

I wrote recently about a little ESP32 board with a tiny LCD display from Lilygo that worked "out of the box" for me.

Another board from AliExpress, with a larger 2.8 inch display, gave me a lot of trouble before I got it going.

Described as "ESP32 Arduino LVGL WIFI&Bluetooth Development Board 2.8" 240*320 Smart Display Screen 2.8inch LCD TFT Module With Touch WROOM"

The board has an ILI9341 display board bonded to the PCB and connected via an SPI interface.

After trying all sorts of combinations of pins for the SPI interface, and having the screen remain dark, I shone a torch obliquely at the screen and found that it was working fine but without the backlight was not visible.

Switching to MicroPython makes experimenting a bit easier. I used this ili9341 python library and with the generous help of the author rdagger, figured out that the backlight is connected to GPIO pin 21.

Here's how I set it up for drawing:

from ili9341 import Display

from machine import Pin, SPI

Pin(21, Pin.OUT).on()

spi = SPI(1, baudrate=40000000, sck=Pin(14), mosi=Pin(13))

display = Display(spi, dc=Pin(2), cs=Pin(15), rst=Pin(12))

display.draw_text8x8(0, 0, 'Built-in', color565(255, 0, 255))

As mentioned in other posts, I'm currently using these things to monitor solar power generation so I can time the use of high energy appliances with the sun hitting the panels here. A device like this, that can use internet services has all sorts of applications and a larger screen could be handy.

3 comments:

Thomas Foster said...

Thanks for your post. I can't find much about this display outside of Aliexpress and various other sales listings. I can't seem to get mine into boot. Holding boot while resetting or plugging in doesn't do anything other that light up the onboard LED on the back. I checked the screen to see if it's just really dark but I don't see anything on the LCD. I also don't get any devices attaching in Windows. Any tips on what I can go to get this thing into boot?

Peter Marks said...

Hi Thomas,

My guess is that your USB cable is not fully wired. I often run in to cables that are for charging only. If it doesn't show up as a device under Windows that's a sign.
Do you have a linux machine there? Sometimes Linux sees things Windows doesn't.
Best wishes,

Peter

Thomas Foster said...

Thanks Peter. It is a fully wired USB cable. I was using it to program a Pi Pico before switching over to this display. I have a Rpi set up that I can try and test the display on and see if it recognizes it.