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

Remarks

The HIH6130 sensor allows the reading of the relative humidity and temperature providing the data over an I2C interface.

Purchasing

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

Examples

Example:

using System.Threading;
using Meadow;
using Meadow.Foundation.Sensors.Atmospheric;

namespace HIH6130_Sample
{
    public class Program
    {
        static IApp _app; 
        public static void Main()
        {
            _app = new App();
        }
    }

    public class App : AppBase<F7Micro, App>
    {
        public App ()
        {
            // Create a new HIH6130 and set the temperature change threshold to half a degree.
            HIH6130 hih6130 = new HIH6130(temperatureChangeNotificationThreshold: 0.5F);

            // Hook up the temperature interrupt handler.            
            hih6130.TemperatureChanged += (s, e) =>
            {
                Console.WriteLine("Temperature changed: " + e.CurrentValue.ToString("f2"));
            };

            // Hook up the humidity interrupt handler.
            hih6130.HumidityChanged += (s, e) =>
            {
                Console.WriteLine("Humidity changed: " + e.CurrentValue.ToString("f2"));
            };
        }
    }
}
Example Circuit

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 SDA White

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>