Arduino weather station with ST7735 color TFT display

This post shows how to build weather station using Arduino UNO board and BME280 barometric pressure, temperature and humidity sensor.
The Arduino reads temperature & humidity & pressure values from the BME280 sensor and print them (respectively in °C & RH% & hPa) on ST7735 color TFT display.

The BME280 is a digital barometric pressure, temperature and relative humidity sensor from Bosch Sensortec. In this project the BME280 sensor is used in I2C mode.
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 to see how to interface Arduino with BME280 sensor for the first time, take a look at this post:
Arduino with BME280 pressure, temperature and humidity sensor

Hardware Required:

  • Arduino uno board
  • ST7735S (ST7735R) TFT display
  • BME280 sensor module (with built-in 3.3V regulator and level shifter)   —->  BME280 datasheet
  • 5 x 1k ohm resistor
  • Breadboard
  • Jumper wires

Arduino weather station BME280 sensor ST7735S TFT

Arduino weather station circuit:
The image below shows project circuit diagram.

Hint:
The BME280 chip works with maximum voltage of 3.6V (supply voltage range is from 1.71 to 3.6V) which means we’ve to use a 3V3 voltage regulator to supply it from a 5V source.
Also, if we’re working with a 5V system (development board, microcontroller …) like the Arduino UNO board (ATmega328P microcontroller), we’ve to use a voltage level shifter (level converter) which converts the 3.3V (comes from the BME280 chip) into 5V (goes to the ATmega328P) and vice versa. This level shifter is for the I2C bus lines (clock and data).
The BME280 module shown in project circuit diagram has a built-in 3.3V regulator and level shifter.

BME280 Arduino ST7735 color TFT display circuit

Generally, the BME280 module has at least 4 pins because it can work in SPI mode or I2C mode. For the I2C mode we need 4 pins: VCC, GND, SDA and SCL where:
GND (ground) is connected to Arduino GND pin,
VCC is the supply pin which is connected to Arduino 5V pin,
SDA is I2C bus serial data line, connected to Arduino analog pin 4 (A4),
SCL is I2C bus serial clock line, connected to Arduino analog pin 5 (A5).

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 weather station 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 3rd one is for the BME280 sensor:
Adafruit BME280 Library            —->  direct link

You may need to install the Adafruit Unified Sensor library if it’s not already installed, download link is below:
Adafruit Unified Sensor 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:

As any other I2C device, the BME280 sensor has an I2C slave address which may be 0x76 or 0x77. This address depends on the connection of the SDO pin (used for SPI mode as serial data out or MISO), if the SDO pin is connected (directly or through resistor) to VCC (3.3V) the address will be 0x77, and if it’s connected to GND the address will be 0x76.

The default I2C address of the BME280 library is defined as 0x77 and my device I2C address is 0x76.
In the code, the definition of BME280 sensor I2C slave address and the initialization of its library are as shown below:

The initialization of the BME280 sensor is done using the function begin() which returns 1 if OK and 0 if error. In the code the initialization with the previously defined address is as shown below:

Reading the values of temperature, humidity and pressure:

Note that the BME280 sensor library returns the value of the pressure in Pa unit and to convert it to hPa we’ve to divide it by 100.

1 bar = 10000 Pa = 100 hPa. ( 1 hPa = 100 Pa = 1 millibar)
Pa: Pascal
hPa: hectoPascal

Temperature and pressure values are displayed on the ST7735 TFT display.
If there is a problem with the BME280 sensor (for example wrong device address) the screen will display Connection Error.

Full Arduino Code:

The following video shows a simple circuit of the project:

8 thoughts on “Arduino weather station with ST7735 color TFT display”

  1. I built this project and got it up and running! My problem is that the on display text is backwards. The only change I made were to the pins CS, RST, and DC. If I didn’t I just get a white screen. Any ideas or suggestions? below is the code I used:

    #define TFT_RST 9 // TFT RST pin is connected to arduino pin 8
    #define TFT_CS 10 // TFT CS pin is connected to arduino pin 9
    #define TFT_DC 8 // TFT DC pin is connected to arduino pin 10

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