which built for tft display ST7789

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
BartSr
Normal user
Posts: 167
Joined: 27 Sep 2019, 17:45

which built for tft display ST7789

#1 Post by BartSr » 17 Nov 2024, 20:52

Hi, I've read old threats about the use of a tft 1.54 display ST7789. These are for me a bit difficult to understand.

Is there a pre-flashed built which can be used to 'control' this tft screen?
Thanks, Bart

User avatar
Ath
Normal user
Posts: 4114
Joined: 10 Jun 2018, 12:06
Location: NL

Re: which built for tft display ST7789

#2 Post by Ath » 17 Nov 2024, 21:37

P116 that supports the ST77xx displays is included in the Display and MAX builds, and can of course be included in a user-defined build using Custom.h
/Ton (PayPal.me)

BartSr
Normal user
Posts: 167
Joined: 27 Sep 2019, 17:45

Re: which built for tft display ST7789

#3 Post by BartSr » 17 Nov 2024, 21:39

thanks Ad, just founf it in DISPLAY built.
Has MAX advantages?

User avatar
Ath
Normal user
Posts: 4114
Joined: 10 Jun 2018, 12:06
Location: NL

Re: which built for tft display ST7789

#4 Post by Ath » 17 Nov 2024, 21:42

MAX requires an ESP32 with 8 or 16 MB Flash, and includes all plugins (supported by ESP32) and has nearly all features enabled (only a few large fonts are excluded for use with the displays)
/Ton (PayPal.me)

BartSr
Normal user
Posts: 167
Joined: 27 Sep 2019, 17:45

Re: which built for tft display ST7789

#5 Post by BartSr » 20 Nov 2024, 17:50

I I used built: ESP_Easy_mega_20240822_display_ESP8266_4M1M Aug 22 2024

Display is 1.54tft-SPI-ST7789

display has next connections:
Gnd connected on esp gnd >> this is OK
Vcc 3V3 >> this is OK
SCL CLK D5 (as mentioned per spi-interface)
SDA MOSI D7 (as mentioned per spi-interface)
RST not used
DC ???
CS ???
BL backlight D4 >> this is OK

SPI has been enabled in hardware settings
As SPI needs at least 3 wires I got stuck now
Do I also have to do other settings in hardware part

and what's MISO
data from spi-interface
Note: CLK=GPIO-14 (D5), MISO=GPIO-12 (D6), MOSI=GPIO-13 (D7)
Note: Chip Select (CS) config must be done in the plugin

any help (as usual :-) )appreciated
Attachments
forum2.jpg
forum2.jpg (23.81 KiB) Viewed 3848 times
forum1.jpg
forum1.jpg (86 KiB) Viewed 3848 times

User avatar
Ath
Normal user
Posts: 4114
Joined: 10 Jun 2018, 12:06
Location: NL

Re: which built for tft display ST7789

#6 Post by Ath » 20 Nov 2024, 20:34

You also have to select an available GPIO for the CS and DC connections for the display in the Device configuration (and connect those to the display, of course).
DC = Data/Command, to select the data or command mode when controlling the display.
You can also, optionally, select a GPIO for RES (Reset) and connect that to the RST (Reset) pin of the display.

When not using the CS connection in configuration (it's optional), you must connect the display-CS pin to GND, but you won't be able to parallel-connect other SPI devices, as the display will always be selected. Best is to configure and connect CS.

The Backlight percentage can probably be lowered a bit (start with 50% and adjust as needed), to reduce display brightness and power use.

The display button should be configured and connected when configuring the Display time-out, as after this time in seconds the display will be turned off, and can be re-enabled via the button. You can also use an IR-sensor to turn the display back on when you approach the device. :idea:

MOSI = Master Out Slave In (sends the data from ESP to display, as the ESP is the SPI master, and the display is the slave)
MISO = Master In Slave Out (not used for most displays, but can be used for a Touch panel and/or SD-card reader, when mounted on the display)
Unfortunately you can't use the MISO pin for another purpose when connecting the display, it might interfere when something else is using that pin.

You have set the background color the same as the foreground color, but that'll just make the background transparent, causing previous text/images to be visible when data is drawn. 99% of the time, that's not what you'll want. (Though you could use it to put text/lines on a pre-loaded image bitmap.)
/Ton (PayPal.me)

BartSr
Normal user
Posts: 167
Joined: 27 Sep 2019, 17:45

Re: which built for tft display ST7789

#7 Post by BartSr » 21 Nov 2024, 21:00

Ton,
I updated according your advice but no luck. What might be wrong. Hereunder the settings I did.
BTW, I noticed the LED at the ESP keeps on.
Once I start the log I see something new (although for me).
The log starts with the info of all other ESP's which are online.
log.jpg
log.jpg (43.35 KiB) Viewed 3760 times
Hardwaresettings: I only activated the SPI, no more further settings
hardwaresettings.jpg
hardwaresettings.jpg (69.62 KiB) Viewed 3760 times
Then the tasks settings:
forum1.jpg
forum1.jpg (81.6 KiB) Viewed 3760 times
forum2.jpg
forum2.jpg (22.83 KiB) Viewed 3760 times
TFT reset I did not connect.

Sometimrs the ESP don't startup. It does after I disconnect the backlight. So not a big deal, this can be fixed in the rules.

I can see backlight is on but nothing to see on the display. Any suggestion?

Bart

TD-er
Core team member
Posts: 9507
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: which built for tft display ST7789

#8 Post by TD-er » 21 Nov 2024, 21:05

GPIO-2 on an ESP8266 does need to be in a specific state, or else the ESP will not boot.
That's why there is a warning symbol next to the GPIO description.

See: https://espeasy.readthedocs.io/en/lates ... on-esp8266

User avatar
Ath
Normal user
Posts: 4114
Joined: 10 Jun 2018, 12:06
Location: NL

Re: which built for tft display ST7789

#9 Post by Ath » 21 Nov 2024, 21:30

BartSr wrote: 21 Nov 2024, 21:00 Once I start the log I see something new (although for me).
The log starts with the info of all other ESP's which are online.
That's a new feature, introduced a few months ago, so you can detect from rules if a specific ESP is available in the P2P network.
BartSr wrote: 21 Nov 2024, 21:00 I can see backlight is on but nothing to see on the display. Any suggestion?
I've started an ESP8266 with exactly the display you configured, but I have my GPIOs set a bit differently. And disabled I2C (both GPIOs set to -none-) to use those pins for the display like this:
Screenshot - 21-11-2024 , 21_23_21.png
Screenshot - 21-11-2024 , 21_23_21.png (12.47 KiB) Viewed 3753 times
This works as intended.
Wiring can be a bit tricky, bad connections can easily cause it not to work at all.
/Ton (PayPal.me)

BartSr
Normal user
Posts: 167
Joined: 27 Sep 2019, 17:45

Re: which built for tft display ST7789

#10 Post by BartSr » 21 Nov 2024, 21:59

nope....
I noticed after reboot a load of 99.61 after a while it drops down to 3.53
to be sure:
- should the tekst appear on the display after a reboot without doing else?
- you wired all 8 connections of the display towards ESP?
- nothing else set in hardware others then setting the I2C to none?
- in this config the LED at ESP is off

to be sure no bad connections I pulled the esp from it's socket and used for the 8 connections new wires with dupont connectors

User avatar
Ath
Normal user
Posts: 4114
Joined: 10 Jun 2018, 12:06
Location: NL

Re: which built for tft display ST7789

#11 Post by Ath » 21 Nov 2024, 22:27

After startup the load is usually quite high for a couple of seconds (up to a minute, usually), that's normal.
Text should display on startup if the plugin is enabled. You can re-display it either by setting an Interval > 0 or sending a "taskrun,test" command (the task is named test in your screenshot)

Yes, I wired all 8 pins of the display to the ESP.
The display VCC should be connected to 3.3V, not to 5V!
I2C GPIOs have to be freed (disabled) so you can select them for use in a plugin.

The LED on many ESP8266 boards (at least the Wemos D1 mini clones) is wired to GPIO-2 (D4), but I don't have that configured, so it shouldn't light up now. You had that configured to (also) be used for the backlight, and as the plugin uses PWM to enable that backlight to 20%, the LED would also light up :)

NB: I've assumed your display is actually a ST7789 with 240x240 resolution, as you've set that in the configuration. Is that the actual chip and display resolution? Different chips and resolutions require different initialization so setting that incorrect may cause it not to work.
/Ton (PayPal.me)

BartSr
Normal user
Posts: 167
Joined: 27 Sep 2019, 17:45

Re: which built for tft display ST7789

#12 Post by BartSr » 22 Nov 2024, 00:04

thanks Ton. Yes it's ST7789.
I will order some more to exclude the possibility that J damaged thecTFT while tryjng marters

User avatar
Ath
Normal user
Posts: 4114
Joined: 10 Jun 2018, 12:06
Location: NL

Re: which built for tft display ST7789

#13 Post by Ath » 22 Nov 2024, 08:20

Hm, I've not been very careful with the displays I tested, so they seem quite robust, but it's electronics, so it can be easily damaged.
/Ton (PayPal.me)

TD-er
Core team member
Posts: 9507
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: which built for tft display ST7789

#14 Post by TD-er » 22 Nov 2024, 08:30

Also with this winter-weather we're having now, you might get more static charges on your body.
So it isn't unthinkable things may have been zapped.

BartSr
Normal user
Posts: 167
Joined: 27 Sep 2019, 17:45

Re: which built for tft display ST7789

#15 Post by BartSr » 22 Nov 2024, 15:18

continuing story...
took another nodemcu and did a fresh flash.
did all the hardware and tasksettings as adviced latest

connected the 8 wires as per photo's.

During boot of esp only a short flash on display but nothing on the display

i ordered 3 new ones. just to confirm wiring is ok I added the photo's not brilliant but fit for use I would say...
foto1.jpg
foto1.jpg (58.55 KiB) Viewed 3591 times
foto2.jpg
foto2.jpg (66.8 KiB) Viewed 3591 times
foto3.jpg
foto3.jpg (57.42 KiB) Viewed 3591 times
for info about flashed firmware
foto4.jpg
foto4.jpg (60.61 KiB) Viewed 3590 times
Last edited by BartSr on 22 Nov 2024, 15:49, edited 3 times in total.

User avatar
Ath
Normal user
Posts: 4114
Joined: 10 Jun 2018, 12:06
Location: NL

Re: which built for tft display ST7789

#16 Post by Ath » 22 Nov 2024, 15:39

The VCC connection on the ESP side, (red wire) is that on 3.3V or 5V? As it should be 3.3V. (maybe the pin next to D4?)
/Ton (PayPal.me)

BartSr
Normal user
Posts: 167
Joined: 27 Sep 2019, 17:45

Re: which built for tft display ST7789

#17 Post by BartSr » 22 Nov 2024, 15:45

on the device it says 3.3V
To be sure I redid voltage next to D4
same result

Is it normal that pin state buffer only displays built data?

BartSr
Normal user
Posts: 167
Joined: 27 Sep 2019, 17:45

Re: which built for tft display ST7789

#18 Post by BartSr » 30 Nov 2024, 21:49

UPDATE:
Today new displays arrived
Connected it same as former display : nothing differs
Now I tried just some settings.
Although the displays says ST7789 I tried ST7796
a miracle happened: the displays shows the text. but...... it's mirrored
Also the selected foreground and backgroundcolor did not match

But as the displays shows something I'm optimistic
Is there a suggestion how to proceed?

-Bart

User avatar
Ath
Normal user
Posts: 4114
Joined: 10 Jun 2018, 12:06
Location: NL

Re: which built for tft display ST7789

#19 Post by Ath » 02 Dec 2024, 22:42

Can you provide a link to the exact display(s) you ordered? Maybe there's something specific to them.

You can also try P095 (the ILI9xxx displays), as these displays all are quite closely related.
/Ton (PayPal.me)

BartSr
Normal user
Posts: 167
Joined: 27 Sep 2019, 17:45

Re: which built for tft display ST7789

#20 Post by BartSr » 02 Dec 2024, 23:00

Image
middle right is the bought on
just search on ali for st7789 and this pops up

which gpio do you advice while using esp32-wroom-1
Attachments
Screenshot_20241202_225706_AliExpress.jpg
Screenshot_20241202_225706_AliExpress.jpg (840.17 KiB) Viewed 2527 times

User avatar
Ath
Normal user
Posts: 4114
Joined: 10 Jun 2018, 12:06
Location: NL

Re: which built for tft display ST7789

#21 Post by Ath » 02 Dec 2024, 23:24

BartSr wrote: 02 Dec 2024, 23:00 middle right is the bought on
just search on ali for st7789 and this pops up
Please don't expect your search results to match mine, Aliexpress has algorithms to provide each customer the "best experience", and as that's based on our history, there's little chance we see the same.
It's also very important to select the exact desired device when ordering on Ali, and then they still manage to get the wrong stuff in your package :o

Displays with a resistive touchscreen (including a plastic pen) are mostly installed on ILI9xxx displays using TN technology, the ST77xx displays usually come with capacitive touchscreens (when they have that), and mostly use IPS displays.
BartSr wrote: 02 Dec 2024, 23:00 which gpio do you advice while using esp32-wroom-1
Just use available pins, that are conveniently placed next to each other, avoiding any pins often used for specific purposes, that can be found here
/Ton (PayPal.me)

BartSr
Normal user
Posts: 167
Joined: 27 Sep 2019, 17:45

Re: which built for tft display ST7789

#22 Post by BartSr » 03 Dec 2024, 22:33

OK, ILI9341 240x320px and rotation 270 gives a result
colors are wrong but that's not a big deal

Q: somewhere (can't recall where) it was mentioned how to put text on display via HTTP.
Any suggestion where to find some info about this?

-Bart

User avatar
Ath
Normal user
Posts: 4114
Joined: 10 Jun 2018, 12:06
Location: NL

Re: which built for tft display ST7789

#23 Post by Ath » 03 Dec 2024, 22:59

BartSr wrote: 03 Dec 2024, 22:33 OK, ILI9341 240x320px and rotation 270 gives a result
colors are wrong but that's not a big deal
That could be fixed by selecting the ILI9342 device, as that's a (M5Stack specific) controller using inverted colors.
BartSr wrote: 03 Dec 2024, 22:33 Q: somewhere (can't recall where) it was mentioned how to put text on display via HTTP.
Any suggestion where to find some info about this?
The commands are documented here: https://espeasy.readthedocs.io/en/lates ... -available
Just prefix them with "http://<esp-ip-address>/control?cmd=" to control the display from remote. You can test the commands from the Tools page, to see what arguments need to be url-encoded (the %xx values added by your browser), and you will need to wrap texts containing comma's and spaces in quotes, as documented here: https://espeasy.readthedocs.io/en/lates ... er-parsing
/Ton (PayPal.me)

BartSr
Normal user
Posts: 167
Joined: 27 Sep 2019, 17:45

Re: which built for tft display ST7789

#24 Post by BartSr » 04 Dec 2024, 12:56

Thanks Ton, this makes sense.
I am trying to sent several http commands in sequence from a domoticz script. That fails. Only first command is executed. I think there must be an commit from a http command before a second and more are accepted.
Is there a way to sent in one http command a clearscreen and then the command for sending text to all lines?

User avatar
Ath
Normal user
Posts: 4114
Joined: 10 Jun 2018, 12:06
Location: NL

Re: which built for tft display ST7789

#25 Post by Ath » 04 Dec 2024, 13:57

Each command is processed immediately when sent, commands can not be combined into a single long command-line, but have to be sent separately.
/Ton (PayPal.me)

BartSr
Normal user
Posts: 167
Joined: 27 Sep 2019, 17:45

Re: which built for tft display ST7789

#26 Post by BartSr » 04 Dec 2024, 16:14

can de http commands to control de tft screen sent from domoticz be to fast after each other and therefore esp ignores the last received command?

TD-er
Core team member
Posts: 9507
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: which built for tft display ST7789

#27 Post by TD-er » 04 Dec 2024, 16:42

That's possible.

You could also wrap more data in an 'event' command.
This way you can use multiple arguments and handle in rules what to do with them.
Or hand it over as 'asyncevent', so the commands will then be queued and dealt with later.
This way ESPEasy may be ready much more quickly as it doesn't have to do anything with the hardware yet.

User avatar
Ath
Normal user
Posts: 4114
Joined: 10 Jun 2018, 12:06
Location: NL

Re: which built for tft display ST7789

#28 Post by Ath » 04 Dec 2024, 16:49

Not sure how Domoticz sends these commands, but if they are sent in parallel, then it will fail, as the ESP handles only 1 thread, not multiple in parallel.

I've sent many commands sequentially from a python script on an RPi to an ESP TFT display (using P095), and that worked as expected (drawing a PV monitor graph), but I'm quite sure those commands are sent one after the other.
/Ton (PayPal.me)

BartSr
Normal user
Posts: 167
Joined: 27 Sep 2019, 17:45

Re: which built for tft display ST7789

#29 Post by BartSr » 04 Dec 2024, 16:58

just to show the dz (test)script
dz is acting single threaded

Code: Select all

return {

      on = {
		devices = {1665},
      },

	execute = function(dz)
	        dz.openURL({ url = "http://192.168.2.230/control?cmd=tftcmd,clear" })
	        dz.openURL({ url = "http://192.168.2.230/control?cmd=tft,txz,10,10,hello world" })
	end
}

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest