ESP32 S2 with ST7789 – Screen

These looked like the answer to upgrading many ESP8266 projects: more power, more IO and a colour display onboard.

Having used a variety of displays from OLED ST7789 to ILI9341, there is often an application where having a small display onboard would have saved a lot of soldering and headaches.

At the moment there appears to be little information about for the ESP32 S2 chips with the screen.

Addendum: This article describes using the Adafruit 7789 graphics libraries. Refer also to my article describing the S2 chip with TFT_eSPI library!


In fact, setting up as an S2 was straightforward, and worked well except for the screen. Many hours were lost trying to get this screen going in the Arduino environment. Finally, the key was to directly turn on the Backlight LED!
This is found as GPIO33

 pinMode(33, OUTPUT);   
 digitalWrite(33, HIGH); // Turn on LED
Gets MQTT data from Solar inverter..
..draws graphs from Solar dB.

In a nutshell, for anyone in this situation:

#include <adafruit_gfx.h>    // Core graphics library
#include <adafruit_st7789.h> // Hardware-specific library for ST7789
#include <spi.h>

// Screen setup
#define TFT_CS         34
#define TFT_RST        38 
#define TFT_DC         37   
#define TFT_MOSI       35  // Data out
#define TFT_SCLK       36  // Clock out
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST);

void setup() {

// Do wifi stuff here
  pinMode(33, OUTPUT);   
  digitalWrite(33, HIGH); // Turn on LED
  tft.init(135, 240);  
  tft.setRotation(3);

 tft.fillScreen(ST77XX_BLACK);
  tft.setTextWrap(true);
  tft.setTextSize(3);
  tft.setCursor(0, 0);
  tft.setTextColor(ST77XX_YELLOW);
  tft.print("ESP32 Demo");
  tft.setCursor(0, 30);
  tft.setTextColor(ST77XX_GREEN);
  tft.setTextSize(2);
  tft.print("Version number");
  tft.setCursor(0, 55);
  tft.setTextColor(ST77XX_WHITE);
  tft.print("wifi info");
}

void loop() {
// Great program goes here...
delay(2);
}

Update:

I have been in contact with Al from IOTXPLAIN (https://www.iotxplain.com.au/), who has been working with these chips and brazenly cleared the Micropython path! Take look at Al’s detailed xplanation of installing and operating CircuitPython for an NTP clock display.


Leave a comment

Your email address will not be published.