2021-07-01 12:05:02 +02:00
# ST7789 TFT IPS Color display 240x240pxwith ESP32 boards
This usermod allow to use 240x240 display to display following:
2021-08-28 21:59:52 +02:00
* current date and time;
2021-07-01 12:05:02 +02:00
* Network SSID;
* IP address;
2021-08-28 21:59:52 +02:00
* WiFi signal strength;
2021-07-01 12:05:02 +02:00
* Brightness;
* Chosen effect;
* Chosen palette;
2021-08-28 21:59:52 +02:00
* effect speed and intensity;
2021-07-01 12:05:02 +02:00
* Estimated current in mA;
## Hardware
***
2021-12-26 11:06:20 +01:00
![Hardware ](images/ST7789_Guide.jpg )
2021-07-01 12:05:02 +02:00
## Library used
[Bodmer/TFT_eSPI ](https://github.com/Bodmer/TFT_eSPI )
## Setup
***
### Platformio.ini changes
In the `platformio.ini` file, uncomment the `TFT_eSPI` line within the [common] section, under `lib_deps` :
```ini
# platformio.ini
...
[common]
...
lib_deps =
...
#For use of the TTGO T-Display ESP32 Module with integrated TFT display uncomment the following line
#TFT_eSPI
...
```
Also, while in the `platformio.ini` file, you must change the environment setup to build for just the esp32dev platform as follows:
Add lines to section:
```ini
default_envs = esp32dev
build_flags = ${common.build_flags_esp32}
-D USERMOD_ST7789_DISPLAY
2021-08-28 21:59:52 +02:00
-DUSER_SETUP_LOADED=1
-DST7789_DRIVER=1
-DTFT_WIDTH=240
-DTFT_HEIGHT=240
-DCGRAM_OFFSET=1
-DTFT_MOSI=21
-DTFT_SCLK=22
-DTFT_DC=27
-DTFT_RST=26
-DTFT_BL=14
-DLOAD_GLCD=1
;optional for WROVER
;-DCONFIG_SPIRAM_SUPPORT=1
2021-07-01 12:05:02 +02:00
```
Save the `platformio.ini` file. Once this is saved, the required library files should be automatically downloaded for modifications in a later step.
### TFT_eSPI Library Adjustments
2021-08-28 21:59:52 +02:00
If you are not using PlatformIO you need to modify a file in the `TFT_eSPI` library. If you followed the directions to modify and save the `platformio.ini` file above, the `Setup24_ST7789.h` file can be found in the `/.pio/libdeps/esp32dev/TFT_eSPI/User_Setups/` folder.
2021-07-01 12:05:02 +02:00
2021-08-28 21:59:52 +02:00
Edit `Setup_ST7789.h` file and uncomment nad changep GPIO pin numbers in lines containing `TFT_MOSI` , `TFT_SCLK` , `TFT_RST` , `TFT_DC` .
2021-07-01 12:05:02 +02:00
2021-08-28 21:59:52 +02:00
Modify the `User_Setup_Select.h` by uncommentig the line containing `#include <User_Setups/Setup24_ST7789.h>` and commenting out line containing `#include <User_Setup.h>` .
2021-07-01 12:05:02 +02:00
2021-08-28 21:59:52 +02:00
If your display includes backlight enable pin, #define TFT_BL with backlight enable GPIO number.