Remarks

BMP085
Status
Source code GitHub
NuGet package

The BMP085 is a high-precision, low-power barometric pressure sensor. The BMP085 offers a measuring range of 300 to 1100 hPa with an absolute accuracy of down to 0.03 hPa. It's based on piezo-resistive technology for EMC robustness, high accuracy and linearity as well as long term stability. This sensor supports a voltage supply between 1.8 and 3.6VDC. It is designed to be connected directly to a micro-controller via the I2C bus.

Code Example

public class MeadowApp : App<F7Micro, MeadowApp>
{
    Bmp085 bmp085;

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

        // configure our BME280 on the I2C Bus
        var i2c = Device.CreateI2cBus();
        bmp085 = new Bmp085(i2c);   

        // Example that uses an IObersvable subscription to only be notified
        // when the temperature changes by at least a degree, and humidty by 5%.
        // (blowing hot breath on the sensor should trigger)
        bmp085.Subscribe(new FilterableObserver<AtmosphericConditionChangeResult, AtmosphericConditions>(
            h => {
                Console.WriteLine($"Temp and pressure changed by threshold; new temp: {h.New.Temperature}, old: {h.Old.Temperature}");
            },
            e => {
                return (
                    (Math.Abs(e.Delta.Temperature) > 1)
                    &&
                    (Math.Abs(e.Delta.Pressure) > 5)
                    );
            }
            ));

        // classical .NET events can also be used:
        bmp085.Updated += (object sender, AtmosphericConditionChangeResult e) => {
            Console.WriteLine($"  Temperature: {e.New.Temperature}°C, Pressure: {e.New.Pressure}hPa");
        };

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

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

    protected async Task ReadConditions()
    {
        var conditions = await bmp085.Read();
        Console.WriteLine($"Temperature: {conditions.Temperature}°C, Pressure: {conditions.Pressure}hPa");
    }
}

Sample projects available on GitHub

Wiring Example

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

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

It should look like the following diagram:

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

Syntax

public class Bmp085 : FilterableChangeObservableBase<AtmosphericConditionChangeResult, AtmosphericConditions>, IAtmosphericSensor, IBarometricPressureSensor, ITemperatureSensor

Constructors

Bmp085(II2cBus, Byte, Bmp085.DeviceMode)

Provide a mechanism for reading the temperature and humidity from a Bmp085 temperature / humidity sensor.

Declaration
public Bmp085(II2cBus i2cBus, byte address = 119, Bmp085.DeviceMode deviceMode = Bmp085.DeviceMode.Standard)

Parameters

Type Name Description
II2cBus i2cBus
System.Byte address
Bmp085.DeviceMode deviceMode

Properties

Conditions

The AtmosphericConditions from the last reading.

Declaration
public AtmosphericConditions Conditions { get; protected set; }

Property Value

Type Description
AtmosphericConditions

DEFAULT_SPEED

Declaration
public static int DEFAULT_SPEED { get; }

Property Value

Type Description
System.Int32

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.

Pressure

Pressure

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

Dispose()

Declaration
public void Dispose()

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()

Events

Updated

Declaration
public event EventHandler<AtmosphericConditionChangeResult> Updated

Event Type

Type Description
System.EventHandler<AtmosphericConditionChangeResult>