The sketch can be found at my GitHub page here.
The Si7021 device is one of Silicon Labs’ latest generation I2C relative humidity and temperature sensors. This device combines fully factory-calibrated humidity and temperature sensor elements with an analog to digital converter, signal processing and an I2C host interface. The device is tiny, especially when compared to the standard DHT11 or DHT22 normally used with the Arduino for humidity sensing. The device needs a maximum of 3 volts to power it and so cannot be directly connected to an Arduino.
The breakout board that I purchased had a 3.3 volt regulator to power the Si7021, but I suspect that there was no level shifting for the I2C connections so I used a level shifter for SDA and SCL just in case.
I found a library here and the humidity and temperature can be easily read with a single command. I decided to use an OLED to display both humidity and temperature.
Take great care when connecting the OLED as reversing the power connections will burn it out. Connect Vcc to Arduino 5 volts, Gnd to Arduino Gnd. Connect SDA to Arduino pin A4 and SCL to Arduino A5. The Si7021 board has four connections, connect Vcc to Arduino 5volts and Gnd to Arduino Gnd. I used a Logic Level converter like this one on eBay here.
Although the Si7021 is more expensive than the DHT11 and DHT22 it is far superior. It is smaller, easier to us and very fast and will certainly be my choice for Humidity sensor in the future.