GUITION 4" 480x480 ESP32-S3-4848S040 Smart Display with LVGL

https://www.aliexpress.com/item/3256807420446535.html

I have been seeing these a lot of Aliexpress lately for around $27. They check all the boxes for me

  • Fast CPU
  • Lots of memory
  • Great format
  • Easy wall mount as a wall switch
  • 120v relay included
  • Does not require programming another internal device for LVGL like NSPanel

Many thanks to everybody on the ESPhome discussion board for helping me get this working. I initially tested it with the openHASP project. This works very well but you are very limited to what you can do with it.

I really like the infinite flexibility of ESPhome. I think it would be easy to build a complete automation system on the is screen without Homeassistant or anything else.

I have concentrated on building a simple light switch with it although it would be easy to build a multi page panel. I used the new LVGL library. The buttons are on a flex grid so if you remove one the other buttons float to fill in the space. This is much easier then locating the button with exact pixel location.

Over all I think this is a huge feature for ESPhome!

This GitHub folder has all the yaml files I have created for this device (and others)

(09/10/2024) - Added an example file with a boot screen, dimming the backlight at night and basic examples for local / Home Assistant control buttons. Also pulling in almost 200 colors that can be called by name!

(08/22/2024) - Remove dependencies on BETA LVGL code. LVGL is now part of ESPHome 2024.8.0!

(08/04/2024) - Updated to match the recent changes in the LVGL code

(06/17/2024) - Added it to ESPhome supported devices

(05/15/2024) - This is the code for the demo button panel above. It has been updated with the fixes from @rocob below.

12 Likes

Only for some places. It wouldnā€™t fit in half the world.

Nice though. I wonder if openhasp would work?

1 Like

This is a DIY forum and you do have to be a little bit creative to mount these. :grinning: Iā€™m in the USA and I used this box from Ali to mount it in the drywall walls we have here.

https://www.aliexpress.us/item/2251832772595217.html

Works great!

There are other types of boxes you can use in pretty much any other part of the world to get this wall mounted. Itā€™s much better then trying to make a 3d printed case for other types of ESP32 screens that have no cases included. This screen comes apart so you can screw it to the wall and the screen hides the screws!

It does work well with openHASP. I tried that first before ESPhome. I had to build my own image but it worked fine. I really like the simplicity of programing but the integration to Home assistant is messy compared to ESPhome and the ESPhome version of LVGL (newer) is much better and way more flexible. It supports FLEX grids!

This configuration is incorrect because with this you have only achieved a color depth of 4 bits for the colors red and blue. The red and blue pins must remain as originally connected (in the correct order). It is only necessary to change the MDT flag to log 0 (command 0xCD). See https://focuslcds.com/wp-content/uploads/Drivers/ST7701S.pdf on page 276 and page 73. There is one more command to be given before this command. See the patched code section below also with the pins reversed back.

Original init sequence is https://github.com/esphome/esphome/blob/1f29023c92e8fa86ba15999d65130e213de779ff/esphome/components/st7701s/init_sequences.py, command 0xCD is in line 20 and command 0x3A is in line 137.

init_sequence: 
  - 1
  #- [0x3A, 0x50] # 16 bit pixel format. (wrong)
  #- [0x3A, 0x60] # 18 bit pixel format. (this is default configuration. No need to apply)
  - [0xFF, 0x77, 0x01, 0x00, 0x00, 0x10] # CMD2_BKSEL_BK0
  - [0xCD, 0x00] # disable MDT flag
pclk_frequency: 12MHz
pclk_inverted: false
data_pins:
  red:
    - 11         # R1
    - 12         # R2
    - 13         # R3
    - 14         # R4
    - 0          # R5
  green:
    - 8          # G0
    - 20         # G1
    - 3          # G2
    - 46         # G3
    - 9          # G4
    - 10         # G5 
  blue:
    - 4          # B1
    - 5          # B2
    - 6          # B3
    - 7          # B4
    - 15         # B5
lambda: !lambda |-

I can post the full code later.

1 Like

Nice. Iā€™ll look for one that I can put in an existing light socket, rather than a square 86x86 one. Thanks for the pointer.

Thanks @rocob it taken many iterations to get the code right for this little screen. I updated the OP with your changes.

1 Like

Hereā€™s the result on mine:

2 Likes

Hi @andrew_NH , could you let me have a pic of this when itā€™s taken apart?

And Iā€™d be interested to see how do the back part is. The Ali link shows options for 1 relay it 3 relays. I am wondering how big it all is.

I assume in this day and are that it will work on 230v. Any info on this?

Thanks in advance.

Here you can find how to disassemble it and the GPIO for the relay.
The board for 1 relay and 3 relays is the same size.
I have both and they work very nicely in openhasp including relay control.

Many thanks @pepe59

@andrew_NH
Iā€™ve created a second page and Iā€™d like to use a button to go to the next page. Do you know the name of the action to call for this?

I found the answer here in the preview doc:

lvgl.page.next, lvgl.page.previous

This action changes the page to the next/previous based on the configuration (pages with their skip option enabled areā€¦skipped). Page changes will wrap around at the end.

1 Like

Or lvgl.page.show

2 Likes

This is the LVGL documentation for ESPhome.

3 Likes

More pictures here: https://github.com/HASwitchPlate/openHASP/issues/603

2 Likes

Thank you.

keep up the good work!!!
is there a way to turn off screen when there inactivity for 30 seconds and turn it back on by touching the screen?

Iā€™m forwarded the answer i received from @agillis GitHub

Yes at some point Iā€™ll start adding more features to this code. In the mean time the documentation from ESPHome has information on this subject. Check out the sections ā€œTurn off screen when idleā€ and also ā€œPrevent burn-in of LCDā€

1 Like

Good day everyone. Thank you guys for your hard work on this devices. I order one and try to programmed. One thing I donā€™t understand in the code. Fonts in original code donā€™t let me compile this to the unit:


Without this code , everything is ok, but showing only one button.

1 Like