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 > Mpl115a2
Implements IAtmosphericSensor ITemperatureSensor IBarometricPressureSensor
Namespace Meadow.Foundation.Sensors.Atmospheric
Assembly MPL115A2.dll

Syntax

public class Mpl115a2 : FilterableObservableBase<AtmosphericConditionChangeResult, AtmosphericConditions>, IAtmosphericSensor, ITemperatureSensor, IBarometricPressureSensor

Constructors

View Source

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

View Source

Conditions

The AtmosphericConditions from the last reading.

Declaration
public AtmosphericConditions Conditions { get; protected set; }

Property Value

Type Description
AtmosphericConditions
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

Pressure

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

Declaration
public float Pressure { get; }

Property Value

Type Description
System.Single
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()

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

View Source

Updated

Declaration
public event EventHandler<AtmosphericConditionChangeResult> Updated

Event Type

Type Description
System.EventHandler<AtmosphericConditionChangeResult>