Contents

Interfacing GY-21P + BMP280 SI7021 Atmospheric Humidity Temperature Sensor with Arduino

GY-21P Module Features

The GY-21P module consists of two sensors, BMP280 and SI7021, which include pressure, temperature and humidity sensors. The communication protocol of this module is I2C.

This module is capable of measuring air pressure from 30,000Pa to 110,000Pa, measuring humidity from 0 to 100%, measuring altitude from 0 to 30,000 feet and measuring temperature from -40 to +85 degrees Celsius.

You can download the datasheet of this module here.

GY-21P Module Pinout

This sensor has 4 pins:

  •  VIN: Module power supply – 3.3 V
  •  GND: Ground
  •  SLC: I2C Clock
  •  SDA: I2C data

You can see pinout of this module in the image below.

Required Materials

Hardware Components

Arduino UNO R3 × 1
GY-21P SI7021 + BMP280 Module × 1
Male Female Jumper Wire × 1

Software Apps

Arduino IDE

Interfacing GY-21P Module with Arduino

Step 1: Circuit

The following circuit shows how you should connect Arduino to GY-21P module. Connect wires accordingly.

Step 2: Code

Tip

If you need more help with installing a library on Arduino, read this tutorial: How to Install an Arduino Library

Upload the following code to your Arduino
/*
  on Sep 21, 2020
  by MohammedDamirchi
  
Home
*/ #include <Adafruit_Sensor.h> #include "Adafruit_Si7021.h" #include <Adafruit_BMP280.h> Adafruit_BMP280 bme; // I2C Adafruit_Si7021 sensor = Adafruit_Si7021(); void setup() { Serial.begin(9600); bme.begin(); sensor.begin(); } void loop() { Serial.print("Temperature(bme): "); Serial.print(bme.readTemperature()); Serial.print(" *C\t"); Serial.print("Pressure: "); Serial.print(bme.readPressure()*0.00750062); Serial.print(" mmHg\t"); Serial.print("Approx altitude: "); Serial.print(bme.readAltitude(1013.25)); // this should be adjusted to your local forcase Serial.print(" m\t"); Serial.print("Humidity: "); Serial.print(sensor.readHumidity(), 2); Serial.print("\tTemperature(Si7021): "); Serial.println(sensor.readTemperature(), 2); delay(50); }
After running the code, you will see the following image in the serial output.
Liked What You See?​
Get Updates And Learn From The Best​

Leave a Reply

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