.. module:: mpl3115a2 **************** MPL3115A2 Module **************** This module contains the driver for NXP MPL3115A2 Pressure, Altitude and Temperature sensor. The MPL3115A2 is capable of direct I2C communication; the pressure and temperature data is fed into a high resolution ADC to provide fully compensated and digitized outputs for pressure in Pascals and temperature in °C. The compensated pressure output can then be converted to altitude (utilizing the formula stated in Section 8.1.3 "Pressure/altitude" of the `datasheet `_ or putting the sensor in altimeter operating mode) provided in meters. .. class:: MPL3115A2(i2cdrv, addr=0x60, clk=400000) Creates an intance of a new MPL3115A2. :param i2cdrv: I2C Bus used '( I2C0, ... )' :param addr: Slave address, default 0x60 :param clk: Clock speed, default 400kHz Example: :: from nxp.mpl3115a2 import mpl3115a2 ... mpl = mpl3115a2.MPL3115A2(I2C0) mpl.start() mpl.init() alt = mpl.get_alt() pres = mpl.get_pres() .. method:: init(osr=0) Initialize the MPL3115A2 setting the oversample rate value. :param osr: set the oversample rate value (from 0 to 7), default 0 ========= ================ ========== OSR Value Oversample Ratio Data Ready ========= ================ ========== 0 1 6 ms 1 2 10 ms 2 4 18 ms 3 8 34 ms 4 16 66 ms 5 32 130 ms 6 64 258 ms 7 128 512 ms ========= ================ ========== .. method:: get_raw_alt() Retrieves the current altitude data from the sensor as raw value. Returns raw_a .. method:: get_raw_pres() Retrieves the current pressure data from the sensor as raw value. Returns raw_p .. method:: get_raw_temp() Retrieves the current temperature data from the sensor as raw value. Returns raw_t .. method:: get_alt() Calculates, from measured pressure, the current altitude data as value in meters. Returns altitude .. method:: get_pres() Retrieves the current pressure data from the sensor as calibrate value in Pa. Returns pres .. method:: get_temp() Retrieves the current temperature data from the sensor as calibrate value in °C. Returns temp