Value Your Project: Use Graphic Display!
by Fernando Koyanagi in Circuits > Microcontrollers
24898 Views, 3 Favorites, 0 Comments
Value Your Project: Use Graphic Display!


In our video today, I'm going to show you the 1.8-inch TFT display. This is a 128-by-160 graphic display. It is larger than what comes in the ESP32 LoRa, and I will also show its use in the traditional ESP32. We will then have the assembly and source code to use this display with these two models of microcontrollers, using an example made by Adafruit. I specifically find display to be a very important feature, as it gives you feedback from your circuit.
Demonstration

Resources Used

• ESP32-WROOM
• ESP32 LoRa
• Display TFT Lcd 1.8 ''
• Protoboard
• Jumpers
Assembly

TFT 1.8 '' Pinout Display

ESP-WROOM32 Mounting With TFT Display 1.8 ''

ESP-WROOM32 Connection Table and TFT1.8 '' Display

ESP32 LoRa Mount With TFT Display 1.8 ''

ESP32 LoRa Connection Table and TFT1.8 '' Display

Installing Libraries - Arduino IDE


Download the two ZIP files by accessing the links below:
Adafruit GFX Library: https://github.com/adafruit/Adafruit-GFX-Library
Adafruit ST7735 Library: https://github.com/adafruit/Adafruit-ST7735-Library
1. With the Arduino IDE open, click Sketch -> Add Library -> Add Library .ZIP
2. Browse for the downloaded file, select and click Open
3. Do this for both downloaded libraries
Code
ESP-WROOM Code 32
Declarations and variables
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library for ST7735 #include <SPI.h> // These pins will also work for the 1.8" TFT shield //ESP32-WROOM #define TFT_DC 12 //A0 #define TFT_CS 13 //CS #define TFT_MOSI 14 //SDA #define TFT_CLK 27 //SCK #define TFT_RST 0 #define TFT_MISO 0 Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST);
ESP32 LoRa code
Declarations and variables
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library for ST7735 #include <SPI.h> #define TFT_DC 17 //A0 #define TFT_CS 21 //CS #define TFT_MOSI 2 //SDA #define TFT_CLK 23 //SCK #define TFT_RST 0 #define TFT_MISO 0 Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST);
ESP32 Code

Note
• The graphics code used is an example developed by the manufacturer Adafruit: https://github.com/adafruit/Adafruit-ST7735-Library/blob/master/examples/graphicstest/graphicstest.ino
• However, the pins declared in the code have been changed to work with the ESP32 previously shown.
• The purpose of this lesson is to only teach communication between the display and the ESP32.
Build Settings


The build configurations are shown in the images below. The boards are ESP32 Dev Module and Heltec_WIFI_LoRa_32