John L Errington MSc

Experiments with an Arduino microcontroller

Using an ESP-WROOM-32 Devkit or NodeMCU with a KMR-1.8 SPI display

Adding the 1.8 inch TFT display

The next stage was to attach the ST7735S based 1.8inch 128*160 px TFT display.

KMR-1.8 SPI display

KMR-1.8 SPI displayThis display has 16 pins and an SD card holder on the rear.
(I'm not using that)

There seem to be many versions of this board, denoted (partly) by the colour of the tab on the screen protector.
Power connections:
The display works fine with Vcc and LED+ connected to the 3.3V regulated supply from the ESP32 board. The LED- and GND are common.
SD card:
SPI interface connections SD_CS, MOSI, MISO, SCK.
Display:
SPI interface uses RESET, A0 (RS), SDA (MOSI), SCL, CS

Connections MUST be as shown in the table below.

 

Display Pin label   Connects to
(on NODE)
Connects to
(on ESP32)
LED- common to GND    
LED+ Backlight +3.3, Vin or PWM 3V3, EXT5V or PWM
SD_CS SD card    
MOSI SD Card    
MISO SD Card    
SCK SD Card    
CS Chip Select D8 GPIO 5
SCL SClock D5 GPIO 18
SDA MOSI D7 GPIO 23
A0 Register Select D3 GPIO 2
RESET   D4 GPIO 4
NC      
NC      
NC      
Vcc   +3.3 or Vin 3V3 or EXT5V
GND   GND GND

 

Connecting and using the KMR-1.8 SPI display

I needed to install this library from Bodmer; then edit the User_Setup.h file ( in sketchbook/libraries/TFT_ESPI ) to match my display and the connections used.
This User_Setup.h works fine for the ESP32; except that in the UTFT_DEMO_FAST Example the final screen (orange rectangle on blue background) no text was displayed.
Also RLE_font test displayed only limited fonts until I discovered I needed to edit user_Setup.h again to enable (#define) extra fonts.

Running directly from the GPIO32 pin (pin 7) the display LED draws 11mA.
Adding a series 100 ohm resistor as shown drops the consumption to 4mA.

 

I wrote a sketch to demonstrate the following:

  • functions that print data to the screen, and ..
  • control the size colour and background;
  • Configure a digital output and write a value to it;
  • Configure a digital output for pwm and ..
  • write values to control the screen brightness.
  • Configure an analog input and ..
  • read a value to be displayed
  • document the functions that manage text data on screen

  You can get the sketch here  

 

 

If you are using a NodeMCU

you will need to make changes to the original UserSetup.h file as follows:

define the right driver and type of display

#define ST7735_DRIVER // Define additional parameters below for this display

// For ST7735 ONLY, define the type of display eg

#define ST7735_REDTAB

// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP8266 SETUP ######

// For NodeMCU - use pin numbers in the form PIN_Dx where Dx is the NodeMCU pin designation
#define TFT_CS PIN_D8 // Chip select control pin D8
#define TFT_DC PIN_D3 // Data Command control pin
#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)

Testing the ESP32 DEVKIT

The Examples folder had a whole lot of new examples: I tried the Time and WiFI scan examples, they worked fine. The WiFi access point example let me turn an LED on & off, controlled remotely from a browser on my tablet; also I was able to add a switch to turn the AP on or off so I could use it to test a nodeMCU set up to connect to it.

 

Next project: using the ESP32 Devkit with the KMR-1.8 SPI display to show my internet connectivity