particleflux-Si7021 (community library)

Summary

Name Value
Name particleflux-Si7021
Version 1.2.1
Installs 155
License MIT
Author Stefan Linke
URL https://github.com/particleflux/Si7021
Repository https://github.com/particleflux/Si7021.git
Download .tar.gz
All Versions 1.2.1, 1.2.0, 1.1.0, 1.0.0

Si 7021 Temperature and Humidity Sensor Particle photon library for interfacing the Silicon Labs Si 7021 temperature and humidity sensor

Example Build Testing

Device OS Version:

This table is generated from an automated build. Success only indicates that the code compiled successfully.

Library Read Me

This content is provided by the library maintainer and has not been validated or approved.

Si7021

A Particle library for the Silicon Labs Si7021 Temperature and Humidity sensor

Hardware setup

Wire the sensor to your Particle Photon:

[image unavailable]

Usage

Add the Si7021 library to your project and follow this simple example:

#include "Si7021.h"

Si7021 si7021;
float temperature, humidity;

void setup() {
if (si7021.begin()) {
Serial.println("Sensor initialized successfully");
}
}

void loop() {
humidity = si7021.readHumidity();
temperature = si7021.readLastTemperature();

Serial.printlnf("temperature: %.2fC\thumidity: %.2f%%", temperature, humidity);
delay(5000);
}

See the examples folder for more details.

Advanced conditional compilation

In case you do not require all features, some modules can be disabled and thus be removed from compilation. The most radical approach would be to #define SI7021_TINY as seen in examples/tiny . Defining this before the library is included, will remove support for reading device info and for using the sensor internal heater.

If this is too much, you can also go with SI7021_CUSTOM, which, when used standalone, equals the use of TINY. But with CUSTOM, you can activate additional features with #defines.

// this will enable the deviceInfo() functionality
#define SI7021_FEATURE_DEVICEINFO

// this will enable the heater() functionality
#define SI7021_FEATURE_HEATER

// this will enable CRC checks
#define SI7021_FEATURE_CRC

LICENSE

Copyright 2018 Stefan Linke

Licensed under the MIT license

References

Si7021 datasheet

Browse Library Files