There are a lot of temperature and humidity sensors available in market. Some of them are known for their performance and other for the cheap price. DHT family is the widely used temperature and humidity monitoring sensor till now. But we can use a better option from Silabs which gives a better price to performance ratio. The size of sensor and compatibility with microcontrollers matters a lot. That’s why I am introducing a new I2C based sensor, this is Si7021. A 6-pin small sensor which can work on a 3.3v logic level.

Originally the sensor is made by Silabs and you may get one using the SMT assembly service from SEEED Fusion. Seeed fusion is provides SMT and PCBA services at a very reasonable prices. I got this free PCBA service from SEEED fusion under the ignite your passion Grove sensor competition.

SI7021 Sensor:

The Si7021 I2C Humidity and Temperature Sensor is a monolithic CMOS IC integrating humidity and temperature sensor elements, an analog-to-digital converter, signal processing, calibration data, and an I2C Interface.

The patented use of industry-standard, low-K polymeric dielectrics for sensing humidity enables the construction of low-power, monolithic CMOS Sensor ICs with low drift and hysteresis, and excellent long-term stability. The humidity and temperature sensors are factory-calibrated and the calibration data is stored in the on-chip non-volatile memory. This ensures that the sensors are fully interchangeable, with no recalibration or software changes required.

Features:

  • Precision Relative Humidity Sensor (± 3% RH (max), 0–80% RH )
  • High Accuracy Temperature Sensor ( ±0.4 °C (max), –10 to 85 °C)
  • 0 to 100% RH operating range
  • Up to –40 to +125 °C operating range
  • Wide operating voltage (1.9 to 3.6 V)
  • Low Power Consumption (150 µA active current)
  • I2C Interface
  • Integrated on-chip heater

Components required:

1) Si7021 module from SEEED Studio

2) Arduino NANO/ UNO

3) OLED screen

4) Battery and connection wires

Circuit Diagram:

The sensor comes with a 6-pin interface, in which only 4 pins are used other two are not connected. They are just to give stability to the soldering joints. In this 2 pins are for the power +VCC and GND and other two are for the digital data transfer. These Serial data and serial clock pins are pulled up using 10k resistors.

The circuit with the Arduino is also given here, the connection of screen, sensor and microcontroller are very simple. Both the screen and sensor works on I2C interface with different address. The SSH1306 OLED display is using 0X3C and SI7021 is using 0x40. At a time one address can be given to one I2C device. The circuit works on 5volts but the SI7021 sensor is supplied by onboard 3.3v Arduino regulator.

PCB designs and details:

Here I made this PCB for the Grove sensor competition and this design with Si7021 temperature and humidity monitoring got selected. I made this PCB in Altium designer and exported the Gerber, BOM and CPL files for the assembly. Download all the required files from here.

I am using Red colour for this PCB and here I have 2 PCBA modules. Grove sensor has a dimension of 20x20mm and one dedicated Grove connector. If you want to know more about the Seeed fusion PCBA service then visit the website from here.

Code for Temp/Humidity:

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define si7021 0x40
#define OLED_RESET 1
Adafruit_SSD1306 display(128, 64, &Wire, OLED_RESET);

bool WireEnd() {
  unsigned char err;
  err = Wire.endTransmission();
  if( err ) {
    Serial.print("Error: ");
    Serial.println(err);
  }
  return err;
}

void setup() {
  bool err;
  unsigned int data;
  Serial.begin(115200);
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  display.clearDisplay();
  delay(1000);
  Wire.begin();


  // Reset chip
  Serial.println("Starting up SI7021 sensor...");
  Wire.beginTransmission(si7021);
    Wire.write(0xFE);
  WireEnd();
  delay(100);

  // Get serial
  Serial.print("Serial ID: ");
 Wire.beginTransmission(si7021);
...
Read more »