This is the Silicon Labs Si7021 i2C Humidity / Temperature Sensor. Si7021 is a monolithic CMOS IC that integrates humidity / temperature sensor elements this device has an analog to digital converter, signal processing, calibration data, and an i2C interface. Compare to Si7050/3/4/5 sensor family is identical to the i2C temperature and humidity sensor but there is no hole at the package, and only temperature sensor functionality is supported. The Si7021 offers an accurate, low power, factory calibrated digital solutions for measuring humidity, best usage for application ranging from HVAC/R, asset tracking to home appliances, automotive, industrial automations, home & building automatons. Etc.
Required Components
- Arduino Microcontroller, NodeMCU, Teensy Board, TeensyDuino, ESP8266 12, 12E, ESP8266 NodeMCU, ESPDuino, ATMEGA328 16/12, ATMEGA32u4 16/8/ MHz, ESP8266, ATMEGA250 16 MHz, ATSAM3x8E, ATSAM21D, ATTINY85 16/8 MHz (Note: The Diagram below is using NANO. (please refer to the respective pin-outs)
- Si7021, Si7013, Si705X, Si7034 Sensor / Module
- Capacitors (See the diagram below for soldering manually)
- Resistors (See the diagram below for soldering manually)
- Jumper Wires / DuPont Wires
- Prototyping PCB board (for soldering manually)
Wiring Guide
Source Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
/*If you want to use code library for Si7021 you can download it below together with ESP8266 sample code */ #include <Wire.h> const int ADDR =0x40; //i2C Address int twire1, twire2; // variable used for temperature int hwire1, hwire2, hwire3, hwire4; // Variable used for humidity double tempwire, temphumidwire, tempout, humidout1, humidout2; void setup() { Serial.begin(9600); Serial.println("14CORE | Si7021 Humidity & Temperature Test Code"); Serial.println("Starting...."); Serial.pirntln("------------------------------------------------"); delay(1000); Wire.begin(); delay(100); Wire.beginTransmission(ADDR); Wire.endTransmission(); pinMode(13,OUTPUT); // Led output which is connected to your board } void loop() { /*initiating temperature measurement */ Wire.beginTransmission(ADDR); Wire.write(0xE3); //Wire address 0xE3 Wire.endTransmission(); Serial.print("Temperature"); Serial.print("\t\t"); Serial.println("Humidity"); digitalWrite(13,HIGH); // Reading temperature Wire.requestFrom(ADDR,2); if(Wire.available()<=2); { twire1 = Wire.read(); //Get raw data twire2 = Wire.read(); //Get raw data twire1 = twire1<<8; tempout = twire1+twire2; } /**Calculate and display temperature**/ tempwire=(175.72*X_out)/65536; //calculating the raw data deviced by 65536 tempwire = tempwire -46.85; //calculate tempwire data - 46.85 Serial.print(tempwire); // set to print output to serial Serial.print("C"); Serial.print("\t\t"); Wire.beginTransmission(ADDR); //initiating the humidity measurement Wire.write(0xE5); //Wire address 0xE5 Wire.endTransmission(); // Reading raw data relative humidity Wire.requestFrom(ADDR,2); if(Wire.available()<=2); { hwire1 = Wire.read(); hwire3 = hwire1 /100; hwire1 = hwire1 % 100; hwire2 = Wire.read(); humidout1 = hwire3 * 25600; humidout2 = hwire1 * 256 + hwire2; } // Set to print data to serial humidout1 = (125 * humidout1) / 65536; humidout2 = (125 * humidout2) / 65536; temphumidwire = humidout1 + humidout2; temphumidwire = temphumidwire - 6; Serial.print(Y); Serial.println("%"); digitalWrite(13,LOW); delay(1000); } |
i2C Address Finder / Scanner
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
#include <Wire.h> void setup() { Serial.begin(9600); Serial.println("14CORE | i2C SCANNER"); Serial.println("Starting...."); Serial.pirntln("----------------------------------------------"); delay(1000); Wire.begin(); while (!Serial); // Scan i2C Address Serial.println("Initializing I2C Scanner"); delay(1000); } void loop() { byte error, address; int indevice; Serial.println("14CORE | Scanning please wait..."); indevice = 0; for(address = 1; address < 127; address++ ) { Wire.beginTransmission(address); error = Wire.endTransmission(); if (error == 0) { Serial.print("14CORE | I2C device found at address 0x"); if (address<16) Serial.print("0"); Serial.println(address,HEX); indevice++; } else if (error==4) { Serial.println("14CORE | Unknow error at address 0x"); if (address<16) Serial.print("0"); Serial.println(address,HEX); } } if (indevice == 0) Serial.println("14CORE | No I2C devices found\n"); else Serial.println("14CORE | Scanning Done\n"); delay(5000); // wait 5 seconds for next scan } |
Downloads
- Download Si7021 Code Library | Zip
- Download Si7021 ESP8266 Code Library | Zip
- Download Si7021 Datasheet | Pdf
- Download Si7013 / Si705X / Si7034 Datasheet | Pdf