Skip to content

Temperature and humidity measurement with SI7021 I2C sensor

Daniel Berenguer edited this page Sep 18, 2015 · 7 revisions

SI7021 sensor

SI7021 is an I2C temperature and (relative) humidity sensor made by Silicon Labs. This sensor has a wide operating voltage (1.9 to 3.6 V), is very low power (60 nA standby current) and provides a good precision and accuracy (±3 % RH and ±0.4 °C).

This sensor is pin and software compatible with HTU21D and works with Sparkfun's Arduino library for this sensor.

Wiring

Minibat SI7021 provides a footprint for the SI7021 sensor and a decoupling capacitor. panStamp sells this board with the sensor assembled so that you only have to assemble the panStamp module onto the carrier board and then program the module as explained later.

minibat with on-board Si7021 humidity+temperature sensor

Power

SI7021 and HTU21D can be powered from a wide voltage range so sensor and panStamp can share the same source of power. Standby current is very low so we don't need to unpower the sensor during the sleeping periods.

minibat with panStamp NRG powered from a couple of AAA batteries

A panStamp + SI7021 circuit can be typically powered from a 3V battery. Current consumption is under 2 uAmps during sleep mode and around 30 mAmps when measuring and transmitting.

Sample code

We provide a SWAP-compatible sample application called htusensor. This sketch is quite simple. It relies on Sparkfun's Arduino library and our SWAP stack. If you don't want to dive into the code, simply grab the application into your panStamp and configure your desired transmission interval from SWAPdmt.

SWAP packets

SWAP status packets transmitted by this application are very simple. Data payload simply consists of four bytes. temphum.xml is the device definition file used for this application. In order to transform this 4-byte number into readable temperatures and humidities you need to apply the formulas defined in the units section of this XML file:

First two bytes are related to the temperature:

  • Celsius degrees: Temperature (ºC) = data x 0.1 - 50
  • Fahrenheit degrees: Temperature (ºF) = data x 0.18 - 58
  • Kelvin degrees: Temperature (ºK) = data x 0.1 + 223.15

Last two bytes show the humidity information:

  • Relative humidity (%) = data x 0.1

Anti Swap

API for Anti Swap

Clone this wiki locally