Remarks
MPL115A2 | |
---|---|
Status | Untested |
Source code | GitHub |
NuGet package | Not published |
The MPL115A2 is a low cost device for reading barometric pressure.
- I2C digital interface (address:
0x60
) - Resolution: 1.5 hPa
- Range: 100-1150 hPa up to 10Km
Sample projects available on GitHub
Purchasing
The MPL115A2 sensor is available on a breakout board from Adafruit
The application below connects the MPL115A2 to two interrupt handlers. These interrupt handlers (events) will display the Temperature
and Pressure
properties when the handlers are triggered. The sensor is checked every 500 milliseconds.
Wiring Example
Connecting the MPL115A2 to Meadow requires four connections:
In this diagram, the shutdown (SDWN
) and reset (RST
) pins have been left floating. Both of these pins are active low and can be tied to Vcc in normal operation.
Note that the Adafruit breakout board has 10K
pull-up resistors on the SDA
and SCK
lines.
Characteristic | Locus |
---|---|
Inheritance | System.Object FilterableChangeObservableBase<AtmosphericConditionChangeResult, AtmosphericConditions> > Mpl115a2 |
Implements | System.IObservable<AtmosphericConditionChangeResult> IAtmosphericSensor ITemperatureSensor IBarometricPressureSensor |
Inherited Members | FilterableChangeObservableBase<AtmosphericConditionChangeResult, AtmosphericConditions>._observers FilterableChangeObservableBase<AtmosphericConditionChangeResult, AtmosphericConditions>.NotifyObservers(AtmosphericConditionChangeResult) FilterableChangeObservableBase<AtmosphericConditionChangeResult, AtmosphericConditions>.Subscribe(IObserver<AtmosphericConditionChangeResult>) System.Object.ToString() System.Object.Equals(System.Object) System.Object.Equals(System.Object, System.Object) System.Object.ReferenceEquals(System.Object, System.Object) System.Object.GetHashCode() System.Object.GetType() System.Object.MemberwiseClone() |
Namespace | Meadow.Foundation.Sensors.Atmospheric |
Assembly | MPL115A2.dll |
Syntax
public class Mpl115a2 : FilterableChangeObservableBase<AtmosphericConditionChangeResult, AtmosphericConditions>, IObservable<AtmosphericConditionChangeResult>, IAtmosphericSensor, ITemperatureSensor, IBarometricPressureSensor
Constructors
Mpl115a2(II2cBus, Byte)
Create a new MPL115A2 temperature and humidity sensor object.
Declaration
public Mpl115a2(II2cBus i2cBus, byte address = 96)
Parameters
Type | Name | Description |
---|---|---|
II2cBus | i2cBus | I2CBus (default to 100 KHz). |
System.Byte | address | Sensor address (default to 0x60). |
Properties
Conditions
The AtmosphericConditions from the last reading.
Declaration
public AtmosphericConditions Conditions { get; protected set; }
Property Value
Type | Description |
---|---|
AtmosphericConditions |
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 |
|
Pressure
The humidity, in percent relative humidity, from the last reading..
Declaration
public float Pressure { get; }
Property Value
Type | Description |
---|---|
System.Single |
Temperature
The temperature, in degrees celsius (°C), from the last reading.
Declaration
public float Temperature { get; }
Property Value
Type | Description |
---|---|
System.Single |
Methods
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> |
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()
Update()
Update the temperature and pressure from the sensor and set the Pressure property.
Declaration
public Task Update()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Events
Updated
Declaration
public event EventHandler<AtmosphericConditionChangeResult> Updated
Event Type
Type | Description |
---|---|
System.EventHandler<AtmosphericConditionChangeResult> |