MPL3115A2 pressure sensor and LinkIT example

In this article we connect a MPL3115A2 sensor to a LinkIT one.

The MPL3115A2 is a compact, piezoresistive, absolute pressure sensor with an I2C digital interface. MPL3115A2 has a wide operating range of 20 kPa to 110 kPa, a range that covers all surface elevations on earth. The MEMS is temperature compensated utilizing an on-chip temperature sensor. 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 9.1.3 “Pressure/altitude” provided in meters.The internal processing in MPL3115A2 removes compensation and unit conversion load from the system MCU, simplifying system design

Parts List


Amount Part Type
1 MPL3115A2 I2C Intelligent Temperature Pressure Altitude Sensor V2.0 For Arduino
1 LinkIt ONE MT2502A wireless 2503 development board



Here is a schematic and layout showing how to connect the sensor to your LinkIT One

linkit and mpl3115a2 layout
linkit and mpl3115a2 layout



linkit and mpl3115a2 schematic
linkit and mpl3115a2 schematic



Test Code

Again we use a library and again its an adafruit one –

[codesyntax lang=”cpp”]

#include <Wire.h>
#include <Adafruit_MPL3115A2.h>

// Power by connecting Vin to 3-5V, GND to GND
// Uses I2C - connect SCL to the SCL pin, SDA to SDA pin
// See the Wire tutorial for pinouts for each Arduino
Adafruit_MPL3115A2 baro = Adafruit_MPL3115A2();

void setup() {
  Serial.println("Adafruit_MPL3115A2 test!");

void loop() {
  if (! baro.begin()) {
    Serial.println("Couldnt find sensor");
  float pascals = baro.getPressure();
  // Our weather page presents pressure in Inches (Hg)
  // Use for other units
  Serial.print(pascals/3377); Serial.println(" Inches (Hg)");

  float altm = baro.getAltitude();
  Serial.print(altm); Serial.println(" meters");

  float tempC = baro.getTemperature();
  Serial.print(tempC); Serial.println("*C");




Test Output

Open the serial monitor

29.77 Inches (Hg)
64.81 meters
29.77 Inches (Hg)
64.62 meters
29.77 Inches (Hg)
64.56 meters