Remarks

HIH6130
Status
Source code GitHub
NuGet package

The HIH6130 sensor allows the reading of the relative humidity and temperature via I2C.

Code Example

public class MeadowApp : App<F7Micro, MeadowApp>
{
    Hih6130 sensor;

    public MeadowApp()
    {
        sensor = new Hih6130(Device.CreateI2cBus());

        sensor.StartUpdating();

        sensor.Updated += Sensor_Updated;
    }

    private void Sensor_Updated(object sender, Meadow.Peripherals.Sensors.Atmospheric.AtmosphericConditionChangeResult e)
    {
        Console.WriteLine($"Humidity: {e.New.Humidity}, Temperature: {e.New.Temperature}");
    }
}

Sample projects available on GitHub

Purchasing

The HIH6130 sensor is available on a breakout board from Sparkfun.

Example:

public class MeadowApp : App<F7Micro, MeadowApp>
    {

        Hih6130 sensor;

        public MeadowApp()
        {
            Initialize();

            sensor.StartUpdating();

            sensor.Updated += Sensor_Updated;
        }

        private void Sensor_Updated(object sender, Meadow.Peripherals.Sensors.Atmospheric.AtmosphericConditionChangeResult e)
        {
            Console.WriteLine($"Humidity: {e.New.Humidity}, Temperature: {e.New.Temperature}");
        }

        public void Initialize()
        {
            Console.WriteLine("Init...");

            sensor = new Hih6130(Device.CreateI2cBus());
        }
    }

Wiring Example

The HIH6130 requires only four connections between Meadow and the breakout board.

Meadow Pin Sensor Pin Wire Color
3.3V Vcc Red
GND GND Black
SC SCK Blue
SD SDC White

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

Syntax

public class Hih6130 : FilterableObservableBase<AtmosphericConditionChangeResult, AtmosphericConditions>, IAtmosphericSensor, ITemperatureSensor, IHumiditySensor

Constructors

View Source

Hih6130(II2cBus, Byte)

Create a new HIH6130 object using the default parameters for the component.

Declaration
public Hih6130(II2cBus i2cBus, byte address = 39)

Parameters

Type Name Description
II2cBus i2cBus

I2C bus (default = 100 KHz).

System.Byte address

Address of the HIH6130 (default = 0x27).

Properties

View Source

Conditions

The AtmosphericConditions from the last reading.

Declaration
public AtmosphericConditions Conditions { get; protected set; }

Property Value

Type Description
AtmosphericConditions
View Source

Humidity

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

Declaration
public float Humidity { get; }

Property Value

Type Description
System.Single
View Source

IsSampling

Gets a value indicating whether the analog input port is currently sampling the ADC. 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.

View Source

Temperature

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

Declaration
public float Temperature { get; }

Property Value

Type Description
System.Single

Methods

View Source

RaiseChangedAndNotify(AtmosphericConditionChangeResult)

Declaration
protected void RaiseChangedAndNotify(AtmosphericConditionChangeResult changeResult)

Parameters

Type Name Description
AtmosphericConditionChangeResult changeResult
View Source

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>
View Source

StartUpdating(Int32)

Declaration
public void StartUpdating(int standbyDuration = 1000)

Parameters

Type Name Description
System.Int32 standbyDuration
View Source

StopUpdating()

Stops sampling the temperature.

Declaration
public void StopUpdating()
View Source

Update()

Force the sensor to make a reading and update the relevant properties.

Declaration
public Task Update()

Returns

Type Description
System.Threading.Tasks.Task

Events

View Source

Updated

Declaration
public event EventHandler<AtmosphericConditionChangeResult> Updated

Event Type

Type Description
System.EventHandler<AtmosphericConditionChangeResult>