Remarks

SI70xx
Status
Source code GitHub
NuGet package

The SI70xx is a humidity and temperature sensor controlled via I2C.

  • ± 3% RH (max)
  • 0–80% RH
  • High Accuracy Temperature Sensor ±0.4 °C
  • –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
  • 60 nA standby current

Purchasing

The Si7021 is available on a breakout board from the the following suppliers:

Code Example

public class MeadowApp : App<F7Micro, MeadowApp>
{
    Si70xx si7021;

    public MeadowApp()
    {
        Console.WriteLine("Initializing...");

        // configure our SI7021 on the I2C Bus
        var i2cBus = Device.CreateI2cBus();

        si7021 = new Si70xx(i2cBus);

        // get an initial reading
        ReadConditions().Wait();

        // start updating continuously
        si7021.StartUpdating();
    }

    protected async Task ReadConditions()
    {
        var conditions = await si7021.Read();
        Console.WriteLine("Initial Readings:");
        Console.WriteLine($"  Temperature: {conditions.Temperature}ºC");
        Console.WriteLine($"  Pressure: {conditions.Pressure}hPa");
        Console.WriteLine($"  Relative Humidity: {conditions.Humidity}%");
    }
}

Sample projects available on GitHub

Wiring Example

To wire a Si7021 to your Meadow board, connect the following:

Si7021 Meadow Pin
GND GND
SCL D08 (SCL)
SDA D07 (SDA)
VCC 3V3

It should look like the following diagram:

Characteristic Locus
Inheritance System.Object > Si70xx
Implements IAtmosphericSensor ITemperatureSensor IHumiditySensor
Namespace Meadow.Foundation.Sensors.Atmospheric
Assembly Si70xx.dll

Syntax

public class Si70xx : FilterableChangeObservableBase<AtmosphericConditionChangeResult, AtmosphericConditions>, IAtmosphericSensor, ITemperatureSensor, IHumiditySensor

Constructors

Si70xx(II2cBus, Byte)

Create a new SI7021 temperature and humidity sensor.

Declaration
public Si70xx(II2cBus i2cBus, byte address = 64)

Parameters

Type Name Description
II2cBus i2cBus

I2CBus (default to 100 KHz).

System.Byte address

Sensor address (default to 0x40).

Fields

READ_2ND_ID_PART1

Declaration
public const byte READ_2ND_ID_PART1 = 252

Field Value

Type Description
System.Byte

READ_2ND_ID_PART2

Declaration
public const byte READ_2ND_ID_PART2 = 201

Field Value

Type Description
System.Byte

READ_ID_PART1

Declaration
public const byte READ_ID_PART1 = 250

Field Value

Type Description
System.Byte

READ_ID_PART2

Declaration
public const byte READ_ID_PART2 = 15

Field Value

Type Description
System.Byte

si7021

SI7021 is an I2C device.

Declaration
protected readonly II2cPeripheral si7021

Field Value

Type Description
II2cPeripheral

Properties

Conditions

The AtmosphericConditions from the last reading.

Declaration
public AtmosphericConditions Conditions { get; protected set; }

Property Value

Type Description
AtmosphericConditions

DEFAULT_SPEED

Declaration
public int DEFAULT_SPEED { get; }

Property Value

Type Description
System.Int32

FirmwareRevision

Firmware revision of the sensor.

Declaration
public byte FirmwareRevision { get; }

Property Value

Type Description
System.Byte

Humidity

The humidity, in percent relative humidity, from the last reading..

Declaration
public float Humidity { get; }

Property Value

Type Description
System.Single

IsSampling

Gets a value indicating whether the sensor is currently in a sampling loop. Call StartSampling() to spin up the sampling process.

Declaration
public bool IsSampling { get; protected set; }

Property Value

Type Description
System.Boolean

true if sampling; otherwise, false.

SensorType

Device type as extracted from the serial number.

Declaration
public Si70xx.DeviceType SensorType { get; }

Property Value

Type Description
Si70xx.DeviceType

SerialNumber

Serial number of the device.

Declaration
public ulong SerialNumber { get; }

Property Value

Type Description
System.UInt64

Temperature

The temperature, in degrees celsius (°C), from the last reading.

Declaration
public float Temperature { get; }

Property Value

Type Description
System.Single

Methods

Heater(Boolean)

Turn the heater on or off.

Declaration
public void Heater(bool onOrOff)

Parameters

Type Name Description
System.Boolean onOrOff

Heater status, true = turn heater on, false = turn heater off.

Initialize()

Declaration
protected void Initialize()

RaiseChangedAndNotify(AtmosphericConditionChangeResult)

Declaration
protected void RaiseChangedAndNotify(AtmosphericConditionChangeResult changeResult)

Parameters

Type Name Description
AtmosphericConditionChangeResult changeResult

Read()

Convenience method to get the current sensor readings. For frequent reads, use StartSampling() and StopSampling() in conjunction with the SampleBuffer.

Declaration
public Task<AtmosphericConditions> Read()

Returns

Type Description
System.Threading.Tasks.Task<AtmosphericConditions>

ReadSensor()

Declaration
protected Task<AtmosphericConditions> ReadSensor()

Returns

Type Description
System.Threading.Tasks.Task<AtmosphericConditions>

Reset()

Reset the sensor and take a fresh reading.

Declaration
public void Reset()

StartUpdating(Int32)

Declaration
public void StartUpdating(int standbyDuration = 1000)

Parameters

Type Name Description
System.Int32 standbyDuration

StopUpdating()

Stops sampling the temperature.

Declaration
public void StopUpdating()

Events

Updated

Declaration
public event EventHandler<AtmosphericConditionChangeResult> Updated

Event Type

Type Description
System.EventHandler<AtmosphericConditionChangeResult>