Tasmota

The Guition ESP32-S3-4848S040 was added to the Tasmota supported hardware thanks to the cooperation documented in the following discussion: https://github.com/arendst/Tasmota/discussions/20527

Install esptool

On Linux, this is easy:

michiel@Delphinus:~> pip install esptool
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: esptool in ./.local/lib/python3.6/site-packages (3.3.3)
michiel@Delphinus:~> 

Download the firmware

Tasmota uses a specific firmware for the first time installation. After that, it can be upgraded Over The Air (OTA) in the web-UI of the Tasmota device.

So, initially, we need to download this firmware here: tasmota32s3-qio_opi.factory.bin.

Once that is installed, we update to tasmota32s3-qio_opi.bin.

First time flashing Tasmota

Just plug a (data) USB cable from your computer into the display. In the following, I used an other firmware, but the process is the same. It is important to select a firmware for the S3 version of the ESP32.

I told esptool to use a baudrate of 460800 to speed things up a little with -b 460800.

Flashing Tasmota with the esptool via the USB cable works good - on Linux there is no need to specify the USB port:

michiel@Delphinus:~/.local/bin> esptool.py -b 460800 write_flash 0 ~/Downloads/tasmota32s3.factory.bin 
esptool.py v3.3.3
Found 2 serial ports
Serial port /dev/ttyUSB0
Connecting....
Detecting chip type... ESP32-S3
Chip is ESP32-S3 (revision v0.2)
Features: WiFi, BLE
Crystal is 40MHz
MAC: dc:da:0c:18:ef:54
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Flash will be erased from 0x00000000 to 0x002a8fff...
Compressed 2786432 bytes to 1714063...
Wrote 2786432 bytes (1714063 compressed) at 0x00000000 in 39.7 seconds (effective 561.9 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
michiel@Delphinus:~/.local/bin> 

This firmware allows us to initialize the module with the WiFi parameters and also allows us to replace the firmware from within the Tasmota web-interface.

So, use your mobile phone, set its WiFi to the Tasmota, and enter your house WiFi parameters. The new IP address will be shown on the mobile phone. From now on, you can access the Tasmota UI on your PC in a browser at the given IP address.

Firmware update

Now we need the correct firmware to get the display working. The Tasmota UI allows updating in the “Firmware Upgrade” menu. So, I replaced the initially flashed binary by: https://github.com/Jason2866/Tasmota-specials/blob/firmware/firmware/tasmota32/other/tasmota32s3-qio_opi.bin - this firmware is regularly updated.

This firmware contains PSRAM + LVGL + HASPmota, but (according to one of the online remarks:) not the “scripter” - what is that?.

This firmware contains all functions we need, but the display is not yet working. For that we need more actions.

Display configuration

Also see https://github.com/arendst/Tasmota/discussions/20527: “…used the config from ameeuw https://github.com/arendst/Tasmota/files/14019279/ESP32S3-4848S040.autoconf.zip” You need to remove the .zip ending of the file name, then upload it via File Manager in the Tasmota UI menu “Tools”. Then restart. Explanation: The intention with autoconf is not that you unpack it, but simply place it in the file system. In this case, you should first rename it from ESP32S3-4848S040.autoconf.zip to ESP32S3-4848S040.autoconf, as an autoconfig setup is simply a zip archive which was not compressed but stored directly. When uploading manually, instead of the standard web UI dialog, you may need to indicate that the new autoconf should be used by deleting the “hidden” file .autoconf (full file name).

Latest info: Use this template, i left option a3 from template, it has to be set separately:

{"NAME":"ESP32S3-4848S040","GPIO":[1,226,225,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,640,0,0,0,0,0,0,0,992,0,224,672,6720,0,0,608,0,704,736],"FLAG":0,"BASE":1}

With the “Option A 3”:

{"NAME":"ESP32S3-4848S040","GPIO":[1,226,225,0,6210,0,0,0,0,0,0,0,0,0,0,0,0,0,0,640,0,0,0,0,0,0,0,992,0,224,672,6720,0,0,608,0,704,736],"FLAG":0,"BASE":1}

After installation/configuration, go to the “Configure Template” menu, and change (any unused pin, like) GPIO04 to “Option A”, number 3.

Boot

00:00:00.001 HDW: ESP32-S3 v0.2 (PSRAM)
00:00:00.051 UFS: FlashFS mounted with 12580 kB free
00:00:00.066 CFG: Loaded from File, Count 5
00:00:00.073 QPC: Count 1
00:00:00.131 BRY: Berry initialized, RAM used 6009 bytes
00:00:00.168 Project tasmota - Tasmota Version 13.4.0.3(9c34707-lvgl-haspmota)-2_0_14(2024-03-19T21:44:36)
00:00:00.498 LVG: Could not start Universal Display
00:00:00.499 BRY: failed to run compiled code 'value_error' - native constructor cannot return NULL
00:00:01.804 WIF: Connecting to AP1 FRITZ!Box 7530 AA in mode 11n as tasmota-18EF54-3924...
00:00:03.141 WIF: Connected
00:00:03.395 HTP: Web server active on tasmota-18EF54-3924 with IP address 10.0.3.182
20:32:42.371 RSL: INFO1 = {"Info1":{"Module":"ESP32S3","Version":"13.4.0.3(9c34707-lvgl-haspmota)","FallbackTopic":"cmnd/DVES_18EF54_fb/","GroupTopic":"cmnd/tasmotas/"}}
20:32:42.382 RSL: INFO2 = {"Info2":{"WebServerMode":"Admin","Hostname":"tasmota-18EF54-3924","IPAddress":"10.0.3.182","IP6Global":"2a02:578:859f:1800:deda:cff:fe18:ef54","IP6Local":"fe80::deda:cff:fe18:ef54%st1"}}
20:32:42.404 RSL: INFO3 = {"Info3":{"RestartReason":"Software reset CPU","BootCount":2}}
20:32:44.892 QPC: Reset
20:32:46.890 RSL: STATE = {"Time":"2024-03-21T20:32:46","Uptime":"0T00:00:09","UptimeSec":9,"Heap":213,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":0,"Berry":{"HeapUsed":6,"Objects":82},"Wifi":{"AP":1,"SSId":"FRITZ!Box 7530 AA","BSSId":"2C:91:AB:62:72:6D","Channel":6,"Mode":"11n","RSSI":50,"Signal":-75,"LinkCount":1,"Downtime":"0T00:00:04"}}

Wrong pin definition for the SD memory card

In the template configuration, GPIO41 should be spi_miso (672), not “SSPI MISO” (832). This is for the SD card.

GPIO configuration

GPIO Device
Name ESP32S3-4848S040
Based on ESP32S3 (1)
GPIO0 User
GPIO1 None or Relay 3
GPIO2 None or Relay 2
GPIO3 None
GPIO4 Option A 3
GPIO5 None
GPIO6 None
GPIO7 None
GPIO8 None
GPIO9 None
GPIO10 None
GPIO11 None
GPIO12 None
GPIO13 None
GPIO14 None
GPIO15 None
GPIO16 None
GPIO17 None
GPIO18 None
GPIO19 I2C SDA 1
GPIO20 None
GPIO21 None
GPIO33 None
GPIO34 None
GPIO35 None
GPIO36 None
GPIO37 None
GPIO38 Backlight
GPIO39 None
GPIO40 Relay 1
GPIO41 SPI MISO 1
GPIO42 SDCard CS
GPIO43 None
GPIO44 None
GPIO45 I2C SCL 1
GPIO46 None
GPIO47 SPI MOSI 1
GPIO48 SPI CLK 1

3 relays or 1 relay

The module exists in a version with 3 relays and in a version with 1 relay.

GPIO Device
GPIO1 Relay 3
GPIO2 Relay 2
GPIO40 Relay 1

For the 1 relay version, set the unused pins to “None”. This means that these pins become available for custom extensions. That is good, since there are no other free pins available.

Adding a SHT40 temperature sensor

The command “I2CDevices” lists the supported device identifiers. One of these is the 15, which stands for the SHT3x and SHT4x series of I²C temperature sensors. It can be connected to the I²C bus already used on the module. Tasmota recognizes the sensor automatically. Other sensors would work also, e.g. the Si7021 is device 9.

GPIO Device
GPIO19 I2C SDA
GPIO45 I2C SCL

Adding the internal ESP32 temperature sensor

Use the command:

setoption146 1

This makes it possible to use the haspmota display a temperature:

{"id": 66,"x": 8,"y": 180,"w%": 100,"obj": "label","text": "Temp","text_rule":"ESP32#Temperature","text_rule_formula":"val","text_rule_format":"ESP32 internal temperature: %2.1f °C"}

Timezone

Look up the commands here: https://tasmota.github.io/docs/Timezone-Table/ I live in Europe/Brussels zone, so for me this is:

Backlog0 Timezone 99; TimeStd 0,0,10,1,3,60; TimeDst 0,0,3,1,2,120

Copy/paste the command in the tasmota console. You can check the result with the command “Time”.

DisplayModel & display.ini

In the Tasmota menu, under Tools -> Console, you can see and change values. We note that the DisplayModel = 17.

The 17 = Universal Display Driver powered displays. The driver must be enabled by OPTION A3 on any GPIO pin.

The display can be defined in detail by a descriptor file. There are several ways to do this - we use a display.ini file present in the flash file system. This file is explained here: https://tasmota.github.io/docs/Displays/#descriptor-file.

Upload the display.ini to the file system with the meny Tools -> Manage File System.

:H,ST7701,480,480,16,RGB,18,17,16,21,38,4,5,6,7,15,8,20,3,46,9,10,11,12,13,14,0,6
:V,1,10,8,50,1,10,8,20,0
:S,2,1,1,0,40,20
:IS,48,47,39,-1
FF,5,77,01,00,00,10
C0,2,3B,00
C1,2,0D,02
C2,2,31,05
CD,1,00
B0,10,00,11,18,0E,11,06,07,08,07,22,04,12,0F,AA,31,18
B1,10,00,11,19,0E,12,07,08,08,08,22,04,11,11,A9,32,18
FF,5,77,01,00,00,11
B0,1,60
B1,1,32
B2,1,07
B3,1,80
B5,1,49
B7,1,85
B8,1,21
C1,1,78
C2,1,78
E0,3,00,1B,02
E1,B,08,A0,00,00,07,A0,00,00,00,44,44
E2,C,11,11,44,44,ED,A0,00,00,EC,A0,00,00
E3,4,00,00,11,11
E4,2,44,44
E5,10,0A,E9,D8,A0,0C,EB,D8,A0,0E,ED,D8,A0,10,EF,D8,A0
E6,4,00,00,11,11
E7,2,44,44
E8,10,09,E8,D8,A0,0B,EA,D8,A0,0D,EC,D8,A0,0F,EE,D8,A0
EB,7,02,00,E4,E4,88,00,40
EC,2,3C,00
ED,10,AB,89,76,54,02,FF,FF,FF,FF,FF,FF,20,45,67,98,BA
FF,5,77,01,00,00,13
E5,1,E4
FF,5,77,01,00,00,00
21,0
3A,1,60
11,80
29,80
20,0
:B,40,02
:UTI,GT911,I1,5d,-1,-1
RDWM 8140 4
MV 0 1
CPR 39
RTF
MV 1 1
CPR 31
RTF
MV 2 1
CPR 31
RTF
RT
:UTT
RDW 814E
MV 0 1
AND 80
CPR 80
RTF
RDWM 8150 8
WRW 814E 00
RT
:UTX
MV 0 3
RT
:UTY
MV 2 3
RT
#

Flickering

The display flickers, when it is updated.

Explantion by “qemu2015”: on RGB displays we have heavy DMA from PSRAM to display due to the lack of display RAM inside display. this DMA may not be disturbed in any way, the linked lists are started in IRQ. so disabling IRQ leads to flicker. especially writing to flash in Tasmota causes this. setting SAVEDATA to 0 completely prevents this flickering. SD card traffic however does not cause flickering at all.

In the Tasmota menu, under Tools -> Console, you can see and change values. We note that the SaveData = ON. Setting the SaveData to “OFF” completely solves the flickering issue.

But, now we are in the situation where “save parameter changes only manually, e.g. with Restart 1”. Maybe this is not so good, and we better use SaveData = 300 (which is each 5 minutes). However, another solution is described by “qemu2015”:

Reducing the RGB DMA bandwidth by reducing the display clock to 6 Mhz makes the flickering disappear.
This will only have a side effect when displaying animated pictures or so. - This reduces the framerate to about 12 Hz.
However the LCD is slow enough not to flicker with 12 Hz.
This does not affect LVGL frame-rate, in the contrary this will increase because the CPU has also more bandwidth.
Since we are not playing games, 12 Hz is fast enough.

This change is done by changing the last number on the “:H” line in the display.ini file from 14 to 6.

Backlight

Quote: “I configured GPIO38 as … The usual way is to have the backlight pin configured as “Backlight” and then use the DisplayDimmer command”

So, in Configure Template, set GPIO38 to “Backlight” and give commands:

DisplayDimmer --> default = 50
DisplayDimmer 30 --> is very dim
**DisplayDimmer 100** --> is max - makes no noise!
DisplayDimmer 50 --> little bit dimmer than 100 - makes some noise
DisplayDimmer 32 --> good for in the dark
DisplayDimmer 60 --> is as expected, but 61..66 gives dimmer display, strange.

OpenHASP

According one of the buyers of this module, flashing OpenHASP should work - and it does!

https://github.com/HASwitchPlate/openHASP

https://github.com/HASwitchPlate/openHASP/issues/603

This page https://nightly.openhasp.com/ contains a binary for “Guition ESP32-S3-4848S040”.

I tested this: it works.

This is my first experiment “pages.jsonl” file:

{"page":0,"id":1,"obj":"btn","action":{"down": "page prev"},"x":0,"y":416,"w":158,"h":64,"bg_color":"#2C3E50","text":"\uE141","text_color":"#FFFFFF","radius":0,"border_side":0,"text_font":48}
{"page":0,"id":2,"obj":"btn","action":{"down": "page back"},"x":160,"y":416,"w":160,"h":64,"bg_color":"#2C3E50","text":"\uE2DC","text_color":"#FFFFFF","radius":0,"border_side":0,"text_font":48}
{"page":0,"id":3,"obj":"btn","action":{"down": "page next"},"x":322,"y":416,"w":158,"h":64,"bg_color":"#2C3E50","text":"\uE142","text_color":"#FFFFFF","radius":0,"border_side":0,"text_font":48}

{"page":0,"id":4,"obj":"label","x":175,"y":5,"h":30,"w":45,"text":"00.0","align":2,"bg_color":"#2C3E50","text_font":24}
{"page":0,"id":5,"obj":"label","x":220,"y":5,"h":30,"w":45,"text":"°C","align":0,"bg_color":"#2C3E50","text_font":24}
{"page":0,"id":6,"obj":"label","x":3,"y":5,"h":30,"w":62,"text":"00:00","align":0,"bg_color":"#2C3E50","text_font":24}


{"page":1,"id":13,"obj":"gauge","x":96,"y":92,"min":10,"max":26,"w":296,"h":296, "label_count":9, "line_count":17, "val":21, "critical_value":30}
{"page":1,"id":0,"prev":6}
{"page":6,"id":0,"next":1}
{"page": 6,"id": 60,"x": 10,"y": 0,"w": 480,"obj": "label","text": "Hostname: %hostname%"}
{"page": 6,"id": 61,"x": 10,"y": 40,"w": 480,"obj": "label","text": "IP: %ip%"}

More explanation at: https://community.home-assistant.io/t/planning-and-setup-esp32-s3-4848s040-480-480-ips-touchscreen/715781/2?u=sushibomba.

Home-Assistant

https://community.home-assistant.io/t/esp32-s3-arduino-lvgl-wifi-bluetooth-development-board-4-0-480-480-smart-display-4-0-inch-lcd-tft-module-capacitive-touch/689726/15

Others

https://cicciocb.com/forum/viewtopic.php?t=1069&start=10

Comments: