Arduino Interface with ST7735 TFT and DHT22 sensor

This post shows how to interface Arduino UNO board with DHT22 digital humidity and temperature sensor.
The Arduino reads temperature (in °C) & humidity (in rH%) values from the DHT22 sensor and print their values on ST7735 TFT display.
The ST7735 TFT used in this project is a color display which has a resolution of 128×160 pixel and it communicates with the master device using SPI (Serial Peripheral Interface) protocol.

To see how to interface Arduino with ST7735 TFT display, visit the following post:
Arduino ST7735 1.8″ TFT display example

And for interfacing Arduino with DHT22 sensor, see the post below:
Arduino with DHT22 sensor and LCD

Hardware Required:

  • Arduino board
  • ST7735S (ST7735R) TFT screen
  • DHT22 (AM2302, RHT03 …) humidity and temperature sensor   —->   datasheet
  • 5 x 1k ohm resistor
  • 4.7k ohm resistor
  • Breadboard
  • Jumper wires

Arduino with ST7735S TFT and DHT22 humidity and temperature sensor

Interfacing Arduino with ST7735 TFT and DHT22 sensor circuit:
Project circuit diagram is shown below.

The DHT22 sensor has 4 pins (from left to right):
VCC: connected to Arduino 5V pin,
Data pin: connected to Arduino analog pin 0 (A0),
Not connected pin,
GND: connected to Arduino GND pin.

A pull-up resistor of 4.7k ohm is required because the DHT22 sensor output is open drain.

Arduino ST7735 TFT DHT22 AM2302 sensor color TFT display

The ST7735S shown in project circuit diagram has 8 pins: (from right to left): RST (reset), CE (chip enable), DC (or D/C: data/command), DIN (data in), CLK (clock), VCC (5V or 3.3V), BL (back light) and Gnd (ground).

Normally the ST7735 display works with 3.3V only, but many boards of this display have a built-in 3.3V regulator (AMS1117 3V3) like the one shown in the circuit diagram. This regulator supplies the display controller with 3.3V from 5V source.

All Arduino UNO board output pins are 5V, connecting a 5V pin directly to the ST7735 display board may damage its controller circuit. To avoid that, I connected each control line of the display to the Arduino board through 1k ohm resistor.

So, the ST7735 display is connected to the Arduino board as follows (each one through 1k resistor):
RST pin is connected to Arduino digital pin 8,
CS pin is connected to Arduino digital pin 9,
D/C pin is connected to Arduino digital pin 10,
DIN pin is connected to Arduino digital pin 11,
CLK pin is connected to Arduino digital pin 13.

Arduino with ST7735 display and DHT22 sensor code:
The following Arduino code requires 3 libraries from Adafruit Industries:
The first library is a driver for the ST7735 TFT display, download link is below:
Adafruit ST7735 display library

The 2nd library is Adafruit graphics library which can be downloaded from the following link
Adafruit graphics library             —->  direct link

The third one is for the DHT22 sensor:
Adafruit DHT library                  —->   direct link

After the download, go to Arduino IDE —> Sketch —> Include Library —> Add .ZIP Library … and browse for the .zip file (previously downloaded).
The same thing for the other library files.

The previous 3 libraries are included in the main code as follows:

The ST7735 TFT display is connected to Arduino hardware SPI module pins (clock and data), the other pins which are: RST (reset), CS (chip select) and DC (data/command) are defined as shown below:

The definition of DHT22 data pin and the initialization of the DHT library:

Rest of code is described through comments.

Full Arduino code:


Discover more from Simple Circuit

Subscribe to get the latest posts sent to your email.

1 thought on “Arduino Interface with ST7735 TFT and DHT22 sensor”

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top