How to configure ST7789 (240x240 display) in Tasmota GUI?

2,519 views
Skip to first unread message

Peggy Schafer

unread,
Dec 26, 2022, 8:09:22 PM12/26/22
to TasmotaUsers
I've flashed an ESP8266 with Tasmota-display.bin.  This is Tasmota 12.3.1.  The display module has these relavent pins:  SCK, SDA, RES, and DC.  The other module pins being GND, VCC and BLK (I presume back-light).

The Tasmota GUI module parameters setup screen only shows 2 control lines for the ST7789, those being ST7789 CS and ST7789 DC.  Since I see "DC" in both the GUI and the board that I can tie those together (I have that connected to GPIO-5).  I don't know what the GUI identifier "ST7789 CS" should be connected to, so I'm guessing it's the "RES" pin on the display module.  I have that connected to GPIO-4.

At this point I don't know how to assign the SCL and SDA on the module to the GUI line assignment list.  I presume I have to resort to the SPI-CLK line in the GUI (connected to GPIO-14) and that SPI MOSI is connected to the module line SDA (using GPIO 13 for that).

I haven't yet tried to have tasmota send anything to the display yet, that's a whole other mountain to climb but I want to know if I've got the wires connected correctly and more importantly correctly set up in the Tasmota Web GUI setup.

To summarize (in the GUI):

D2 GPIO4 ST7789 CS
D1 GPIO5 ST7789 DC
D6 GPIO12 SPI MISO
D7 GPIO13 SPI MOSI
D5 GPIO14 SPI CLK

Is this correct?

Peggy Schafer

unread,
Dec 26, 2022, 8:18:47 PM12/26/22
to TasmotaUsers
Bit of an edit here.  I don't have anything connected to D6 (GPIO6), so here's a revised list:

D2 GPIO4 ST7789 CS
D1 GPIO5 ST7789 DC
D7 GPIO13 SPI MOSI
D5 GPIO14 SPI CLK

But actually I can't seem to clear this line:

D6 GPIO12 SPI MISO

When I set GPIO12 to "none" and save it, the device restarts and when I look at the config, GPIO12 is back to SPI MISO.  So I don't know what that's all about or if it's a problem here.

Peggy Schafer

unread,
Dec 26, 2022, 9:03:42 PM12/26/22
to TasmotaUsers
During bootup I see this (serial port monitor):

 SPI: Hardware using GPIO14(CLK), GPIO13(MOSI) and GPIO12(MISO)
 DSP: ST7789

Entering various commands in the web GUI console seems to indicate that it knows the specs and parameters for this display:

 CMD: displaymodel
 RSL: RESULT = {"DisplayModel":12}

Display width and height are correct.

However, setting displaymode to 0 and having it display text is not working, I'm not seeing anything.  

The boot info seems to indicate that it's using GPIO12 (D6) as "MISO" but I have nothing connected to that pin.  Not sure what's going on here.

Philip Knowles

unread,
Dec 27, 2022, 2:18:20 AM12/27/22
to Peggy Schafer, TasmotaUsers
Do you have a template set? If you do deactivate it and work solely on the module configuration page.


From: sonof...@googlegroups.com <sonof...@googlegroups.com> on behalf of Peggy Schafer <peggyg...@gmail.com>
Sent: Tuesday, December 27, 2022 2:03:42 AM
To: TasmotaUsers <sonof...@googlegroups.com>
Subject: Re: How to configure ST7789 (240x240 display) in Tasmota GUI?
 
--
You received this message because you are subscribed to the Google Groups "TasmotaUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/sonoffusers/0f6c244e-29b7-4064-b666-ae9d58c94268n%40googlegroups.com.

Philip Knowles

unread,
Dec 27, 2022, 4:06:46 AM12/27/22
to Peggy Schafer, TasmotaUsers

You are better sticking to the dedicated SPI pins as below

D5

GPIO14

OK

OK

SPI (SCLK)

D6

GPIO12

OK

OK

SPI (MISO)

D7

GPIO13

OK

OK

SPI (MOSI)

D8

GPIO15

pulled to GND

OK

SPI (CS)

 

 

From the Displays page it’s worth trying these

 

The ST7789 is connected via 4 Wire software SPI (

ST7789_CS – GPIO15 – CS (not on your board)

SSPI_SCLK – GPIO14 - SCK

SSPI_MOSI – GPIO13 - SDA

ST7789_DC – GPIO5 – DC

OLEDRESET – GPIO4 - RES

BkLight – GPI00 - BLK )

 

GPIO0 is just a suggestion.

 

 

Sent from Mail for Windows

--

You received this message because you are subscribed to the Google Groups "TasmotaUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.

Peggy Schafer

unread,
Dec 27, 2022, 10:27:23 AM12/27/22
to TasmotaUsers
I have

GPIO 14 connected to SCK (defined as SPI CLK in template)
GPIO 13 to SDA (defined as SPI MOSI in template)
GPIO 2 to DC (defined as ST7789 DC in template)

Beyond that, I'm stumped.  I've defined GPIO 5 as ST7798 CS and have connected it to RES.  I've also just grounded and then released RES manually.

I'm not sure if I'm supposed to define SPI MISO in the template (on GPIO 12) but naturally there would be nothing to connect it to.

There are some ST7789-based display screens that have (or don't have) I/O pins labelled as CS and/or RES. I don't know if there are boards that have both.

It seems that the Tasmota driver for the ST7789 anticipates the presence of the CS control line (because ST7789 CS shows up in the device list in the template GUI), but not the RES control line. From what little I can find, the RES control line is a RESET line and "this signal will reset the device and it must be applied to properly initialize the chip. Signal is active low." I take it that this line must go low and then high for the display to be initialized. If this needs to happen periodically depending on what you're doing with the display, I don't know.

The CS (Chip Select) line seems to have a different functionality and purpose. This line is active low.  Using ST7789 CS to control the RES line probably won't work, looking at the driver would tell us.

Also, and maybe I'm wrong about this, but Tasmota seems to also want to define the MISO signal line when working with SPI in general or the ST7789 in particular, but there is nothing to connect that line to. I assume it's not needed in this case?

And finally, would issuing the command "displaymode 1" on the console interface be a quick way to very display functionality?  I believe it's supposed to display the date and time on the display.

I don't know if this helps or not:

Philip Knowles

unread,
Dec 27, 2022, 10:51:23 AM12/27/22
to Peggy Schafer, TasmotaUsers

Not all boards have CS – if yours doesn’t you can ignore it.

 

The OLEDReset allocation deals with Res.

 

It worries me when you talk about a template – if a template is active changes made in module configuration don’t take place.

 

The issue may be that DisplayModel 12 no longer appears in the Commands list so you may need to use an older version (or the Universal Display Driver) – which need the display.ini creating)

Peggy Schafer

unread,
Dec 27, 2022, 11:53:17 AM12/27/22
to TasmotaUsers
Yea, I've never been completely clear on the differences between configuring the Template vs configuring the Module, and how to know or insure which one (the template or the module) the device is following.

Philip Knowles

unread,
Dec 27, 2022, 12:09:23 PM12/27/22
to Peggy Schafer, TasmotaUsers

If you are never going to change it use a Template otherwise configure in Configure Module - once you have a Template Activated changes in Configure Module are ignored. It doesn’t help that the check box to Activate a Template is in Other...

Peggy Schafer

unread,
Dec 27, 2022, 10:05:37 PM12/27/22
to TasmotaUsers
The default for tasmota when you flash it seems to be to not activate the template.  So no, the template is not active. 

I don't see an OLEDreset in the list, but I do see Display rst.  I'm using that, but it does not seem to work.  I've seen another guide say to use "display rst or Output hi".

I2CScan from the console just gives me RESULT = {"Command":"Error"}

But then I realize that this is what I see during boot:

SPI: Hardware using GPIO14(CLK), GPIO13(MOSI) and GPIO12(MISO)

So I guess this ST7789 display module is using SPI?

I've just come across this:


Which I will look at.  I've flashed this lolin nodemcu with an arduino sketch that will drive this display and show the data from a BME 280.  I got the display working but it wasn't reading the sensor, but at least I know that the lolin was able to put text on the display.  The pin config that was being used was:

DC - D3 (gpio 0) ST7789 DC
RES - D4 (GPIO 2) Display rst (but I will try output hi)
SDA - D7 (GPIO 13) SPI MOSI
SCK - D5 (GPIO 14) SPI CLK

I note that even though I did not define it, this showed up by itself in the list:

D6 GPIO12 - SPI MISO

And initially I did not define ST7789 CS, but then I did assign it to D8 but that didn't seem to change anything. 

I thought that as a test, sending the console command "displaymode 1" would force tasmota to display date and time, but I got nothing by doing that.  Somewhere else I read that "displaymode 4" would force tasmota to display something, but when I try that - the lolin reboots !

Peggy Schafer

unread,
Dec 27, 2022, 10:25:08 PM12/27/22
to TasmotaUsers
Something I didn't mention, I have a DHT11 on D1, and it does work and data is displayed on tasmota web gui.   I don't see it being detected during bootup, not sure if it's supposed to be listed or not. 

I changed the fake ST789 CS config from D8 (gpio15) to gpio4, but still when I issue the command "displaymode 4" - the module crashes and reboots. 

Every time the lolin is rebooted I transiently see what was on the display when text was last sent to it from the arduino sketch.  That text hasn't cleared, but it's only visible transiently during tasmota re-booting.

Peggy Schafer

unread,
Dec 27, 2022, 10:37:15 PM12/27/22
to TasmotaUsers
Reading the link I posted about hacking the display board - it seems that on these boards the CS line is tied low and not brought out to a header pin.  What the guy did is cut traces to isolate the backlight pin  and use that pin to bring out the CS line.  He tied the backlight line to Vcc so that it's always on.   I wonder if having the CS on this display board always active if that interferes with tasmota SPI driver code?   Why else would the ESP be crashing when I issue the command "displaymode 4" but not "displaymode 1" ?

Philip Knowles

unread,
Dec 27, 2022, 11:18:50 PM12/27/22
to Peggy Schafer, TasmotaUsers
You have flashed with sonoff-display.bin?
Sent: Wednesday, December 28, 2022 3:37:15 AM
To: TasmotaUsers <sonof...@googlegroups.com>

Peggy Schafer

unread,
Dec 27, 2022, 11:25:29 PM12/27/22
to TasmotaUsers
Yes I have flashed with display drivers.  I don't think that the ST7789 would show up in the module config list without it.

Peggy Schafer

unread,
Dec 28, 2022, 9:47:06 AM12/28/22
to TasmotaUsers
The tasmota notes for the Display section mention this:

The ST7789 is connected via 4 Wire software SPI ((ST7789_CS), SSPI_SCLK, SSPI_MOSI, ST7789_DC, OLEDRESET, Backlight )

Based on how that's written, the CS assignment is optional?

But I do note the presence of "oledreset" - not "display rst".  But I don't see oledreset in the option list in the GUI module config.

Again from the displays DOCS I see, under the Displaytext command, these miscellaneous commands:

o = switch display off
O = switch display on

But I'm not sure how to use them or even if I have to.

There is also a "dimmer" parameter, but I don't know if it's relavent here.

Here's the output from the display command:

CMD: display
RSL: RESULT = {"Display":{"Model":12,"Type":0,"Width":240,"Height":240,"Mode":2,"Dimmer":10,"Size":1,"Font":1,"Rotate":0,"Invert":0,"Refresh":2,"Cols":[16,8],"Rows":2}}


Philip Knowles

unread,
Dec 28, 2022, 12:09:58 PM12/28/22
to Peggy Schafer, TasmotaUsers

At least it appears to be seeing the module. Yes CS is only needed on displays with CS.

 

The driver recommends using hardware SPI to work more quickly

 

One of the issues with Tasmota is undocumented changes (well they are documented but sometimes not where they are needed).

 

Dimmer is almost certainly the brightness (currently 10%).

 

In terms of oledreset it seem to have been replaced by displayrst

 

Components - Tasmota

 

 

 

Sent from Mail for Windows

 

From: Peggy Schafer
Sent: 28 December 2022 14:47
To: TasmotaUsers
Subject: Re: How to configure ST7789 (240x240 display) in Tasmota GUI?

 

The tasmota notes for the Display section mention this:

 

The ST7789 is connected via 4 Wire software SPI ((ST7789_CS), SSPI_SCLK, SSPI_MOSI, ST7789_DC, OLEDRESET, Backlight )

 

Based on how that's written, the CS assignment is optional?

 

But I do note the presence of "oledreset" - not "display rst".  But I don't see oledreset in the option list in the GUI module config.

Again from the displays DOCS I see, under the Displaytext command, these miscellaneous commands:

o = switch display off
O = switch display on

But I'm not sure how to use them or even if I have to.

 

There is also a "dimmer" parameter, but I don't know if it's relavent here.

Here's the output from the display command:

CMD: display
RSL: RESULT = {"Display":{"Model":12,"Type":0,"Width":240,"Height":240,"Mode":2,"Dimmer":10,"Size":1,"Font":1,"Rotate":0,"Invert":0,"Refresh":2,"Cols":[16,8],"Rows":2}}

 

On Tuesday, December 27, 2022 at 11:25:29 PM UTC-5 Peggy Schafer wrote:

Yes I have flashed with display drivers.  I don't think that the ST7789 would show up in the module config list without it.

 

 

On Tuesday, December 27, 2022 at 11:18:50 PM UTC-5 knowles...@gmail.com wrote:

You have flashed with sonoff-display.bin?

Peggy Schafer

unread,
Dec 29, 2022, 11:28:09 AM12/29/22
to TasmotaUsers
When the device is reset, I see transiently for about a second the screen comes on and it looks like a static display of random grey noise on the screen.

And I can confirm that regardless if the POWER state is ON or OFF, it has no effect on whether or not I can get anything to show up on the display. I've set dimmer to 100, I have the backlight tied to vcc. I've issued the commands "displaymode 1" and "displaymode 2" but still I get nothing displayed.

As I currently have the device configured, here is the result of the GPIO command, if this helps:

RESULT = {"GPIO0":{"6144":"ST7789 DC"},"GPIO1":{"0":"None"},"GPIO2":{"544":"LedLink"},"GPIO3":{"0":"None"},"GPIO4":{"0":"None"},"GPIO5":{"1184":"DHT11"},"GPIO9":{"0":"None"},"GPIO10":{"0":"None"},"GPIO12":{"672":"SPI MISO"},"GPIO13":{"704":"SPI MOSI"},"GPIO14":{"736":"SPI CLK"},"GPIO15":{"6112":"ST7789 CS"},"GPIO16":{"1024":"Display Rst"},"GPIO17":{"0":"None"}}

Here is the result of the display command:

RESULT = {"Display":{"Model":12,"Type":0,"Width":240,"Height":240,"Mode":2,"Dimmer":100,"Size":1,"Font":1,"Rotate":0,"Invert":0,"Refresh":2,"Cols":[16,8],"Rows":2}}

Unless someone reading this has first hand experience and has seen Tasmota work correctly with these particular display modules, I must conclude that tasmota's driver implimentation for this display module is not functional.


Philip Knowles

unread,
Dec 29, 2022, 12:33:36 PM12/29/22
to Peggy Schafer, TasmotaUsers

I used one a few years ago without any issues – but there have been several versions since then

Sometime back I suggested that you use these pinouts for hardware SPI – they were the ones I used to set one up.

The ST7789 is connected via 4 Wire software SPI (

ST7789_CS – GPIO15 – CS (not on your board) you should not assign this because your board hasn’t got it – Tasmota may be waiting for a response that it never gets.

SSPI_SCLK – GPIO14 – SCK – the same

SSPI_MOSI – GPIO13 – SDA – the same

ST7789_DC – GPIO5 – DC – you have used GPIO0 and have this configured as DHT11

OLEDRESET – GPIO4 – RES – you have GPIO16 – might not be a good pin to use.

BkLight – GPI00 - BLK )

You also have GPIO12 set as MISO

When you are troubleshooting make sure that you only set the pins that are needed, only have the device that you are trying to sort out attached and try to use the default pins. Once you know it works you can try alternate pins.

 

Sent from Mail for Windows

 

From: Peggy Schafer
Sent: 29 December 2022 16:28
To: TasmotaUsers
Subject: Re: How to configure ST7789 (240x240 display) in Tasmota GUI?

 

When the device is reset, I see transiently for about a second the screen comes on and it looks like a static display of random grey noise on the screen.

 

 

--

You received this message because you are subscribed to the Google Groups "TasmotaUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.

Peggy Schafer

unread,
Dec 29, 2022, 9:29:24 PM12/29/22
to TasmotaUsers

I've followed the wiring diagram given here:


This is an arduino sketch.  The pinout is:

SCL pin is connected to D5 (ESP8266EX GPIO14) board label is actually SCK
SDA pin is connected to D7 (ESP8266EX GPIO13)
RES pin is connected to D2 (ESP8266EX GPIO4)
DC pin is connected to D1 (ESP8266EX GPIO5)

So I've changed how I did wire it earlier to follow this sketch for this experiment.  They say " If the display module has a CS pin (Chip Select) then it should be connected to NodeMCU pin D8 (GPIO15)" but the display doesn't have CS.  The code seems to require that CS is defined:

Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST)

I've copied the code from that URL directly into arduino IDE, the only mod I made was to add this bit:

static const uint8_t D0   = 16;
static const uint8_t D1   = 5;
static const uint8_t D2   = 4;
static const uint8_t D3   = 0;
static const uint8_t D4   = 2;
static const uint8_t D5   = 14;
static const uint8_t D6   = 12;
static const uint8_t D7   = 13;
static const uint8_t D8   = 15;

I've found that I frequently have to add that for the nodemcu code that I've been compiling.

I compiled and uploaded that code to the nodemcu, and it ran fine, the display worked and displayed the various text and graphics.  The DHT11 is still connected to D1. 

I will go back and re-flash tasmota and try again using the above wiring, then I will try what you suggested in your last post.



Peggy Schafer

unread,
Dec 29, 2022, 9:34:13 PM12/29/22
to TasmotaUsers

Just an additional note:

I'm using the benzino77 tasmocompiler on gitpod to create a tasmota binary for an old lolin nodemcu.

I've selected the ESP8266 Wemos/nodemcu board,  Under features the defaults are selected (Timers, Rules, Web interface, SD card/littleFS)

I've added Distance Sensors, Displays (I2c/SPI), Temp/hum sensors

I haven't edited or changed or created any files (such as user_config_override.h or platformio_override.ini).

Philip Knowles

unread,
Dec 29, 2022, 9:58:41 PM12/29/22
to Peggy Schafer, TasmotaUsers
That's fair enough but, for testing purposes, you would be better to use Firmware Upgrade to load a known working, pre-compiled tasmota-display.bin from the ota server. You have too many variables any one of them may interfere with the operation of the display. The display bin includes the DHT driver so, once the display is working, you can add the sensor.
Sent: Friday, December 30, 2022 2:34:13 AM
To: TasmotaUsers <sonof...@googlegroups.com>

Subject: Re: How to configure ST7789 (240x240 display) in Tasmota GUI?
--
You received this message because you are subscribed to the Google Groups "TasmotaUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.

Peggy Schafer

unread,
Dec 30, 2022, 12:22:21 AM12/30/22
to TasmotaUsers
I've downloaded and flashed the pre-compiled tasmota-display.bin (version 12.1.1 if I recall) and - same result.

Then I went back and flashed tasmota-display.bin verion 9.4.0.

AND IT WORKS.  sort of.

I can put text on the screen (displaytext what-ever). Toggling the front-page power switch does turn the display on and off. What-ever text I had on the screen will come back when I go from off to on.

I note that the parameter "Display RST" is abscent, seemingly replaced by "OLED Reset". I have that on GPIO4.

I have not defined Backlight.  I have not defined the CS line (ST7789_CS).

displaymode 1 (display date and time) does nothing. gives me a blank screen. Using the command displaytext in this mode does nothing.

But displaymode 0 then using displaytext does put text on the screen, and displaysize does increase text size.

Now, why doesn't displaymode 1 work? It just clears the screen. The device is contacting ntp server, it has the correct date and time.



Philip Knowles

unread,
Dec 30, 2022, 4:07:49 AM12/30/22
to Peggy Schafer, TasmotaUsers

I suspect that with later versions you need to specifically compile with USE_DISPLAY_ST7789 (and USE_SPI) or use the Universal Display Driver (and put the parameters in Rule 3 as described on the Displays page).

Tasmota/ST7789_display.ini at development · arendst/Tasmota (github.com)

 

Does anything appear in console when you type DisplayMode 1?

 

 

USE_DISPLAY_ST7789

Sent from Mail for Windows

 

From: Peggy Schafer
Sent: 30 December 2022 05:22
To: TasmotaUsers
Subject: Re: How to configure ST7789 (240x240 display) in Tasmota GUI?

 

I've downloaded and flashed the pre-compiled tasmota-display.bin (version 12.1.1 if I recall) and - same result.

--

You received this message because you are subscribed to the Google Groups "TasmotaUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.

Peggy Schafer

unread,
Dec 30, 2022, 9:39:58 AM12/30/22
to TasmotaUsers
CMD: displaymode 0
15:35:13.772 RSL: RESULT = {"DisplayMode":0}
15:35:21.464 CMD: displaytext asdf
15:35:21.615 RSL: RESULT = {"DisplayText":"asdf"}
15:35:28.818 CMD: displaymode 1
15:35:30.209 RSL: RESULT = {"DisplayMode":1}

no error messages or messages of any sort when I give a "displaymode 1" or "displaymode 2" command.

Displaytext commands do work, but only if I'm in "displaymode 0". 

Note that if I'm in displaymode 1 or 2, and if I give displaytext commands, there is also no messages of any sort (error, etc).

Philip Knowles

unread,
Dec 30, 2022, 10:06:00 AM12/30/22
to Peggy Schafer, TasmotaUsers

It sounds like some parameters aren’t right in the set up. I think it’s worth trying the Universal Display.

 

Sent from Mail for Windows

 

From: Peggy Schafer
Sent: 30 December 2022 14:40
To: TasmotaUsers
Subject: Re: How to configure ST7789 (240x240 display) in Tasmota GUI?

 

CMD: displaymode 0

--

You received this message because you are subscribed to the Google Groups "TasmotaUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages