

The MPL3115A2 is a digital barometer and altimeter sensor designed to provide highly accurate pressure and altitude measurements. It communicates via the I2C interface, making it easy to integrate into a variety of microcontroller-based projects. This sensor is widely used in applications such as weather stations, mobile devices, GPS systems, and altitude tracking for drones and robotics.
Key features of the MPL3115A2 include:








The following table outlines the key technical details of the MPL3115A2:
| Parameter | Value |
|---|---|
| Operating Voltage | 1.95V to 3.6V |
| Communication Protocol | I2C (7-bit address: 0x60) |
| Pressure Range | 20 kPa to 110 kPa |
| Pressure Resolution | 1 Pa |
| Altitude Resolution | 0.3 meters |
| Temperature Range | -40°C to +85°C |
| Temperature Resolution | 0.1°C |
| Current Consumption | 2 µA (standby), 40 µA (active) |
| Dimensions | 3 mm x 5 mm x 1.1 mm |
The MPL3115A2 has six pins, as described in the table below:
| Pin Name | Pin Number | Description |
|---|---|---|
| VDD | 1 | Power supply input (1.95V to 3.6V). |
| GND | 2 | Ground connection. |
| SDA | 3 | I2C data line. |
| SCL | 4 | I2C clock line. |
| INT1 | 5 | Interrupt output 1 (optional, configurable). |
| INT2 | 6 | Interrupt output 2 (optional, configurable). |
To use the MPL3115A2 with an Arduino UNO, follow these steps:
Below is an example Arduino sketch to read pressure, altitude, and temperature data from the MPL3115A2 using the Adafruit MPL3115A2 library:
#include <Wire.h>
#include <Adafruit_MPL3115A2.h>
// Create an instance of the MPL3115A2 sensor
Adafruit_MPL3115A2 mpl = Adafruit_MPL3115A2();
void setup() {
Serial.begin(9600); // Initialize serial communication
Serial.println("MPL3115A2 Sensor Test");
// Initialize the sensor
if (!mpl.begin()) {
Serial.println("Could not find MPL3115A2 sensor. Check wiring!");
while (1); // Halt execution if sensor is not found
}
// Set the sensor to barometer mode
mpl.setModeBarometer();
Serial.println("Sensor initialized successfully.");
}
void loop() {
// Read pressure in Pascals
float pressure = mpl.getPressure();
Serial.print("Pressure: ");
Serial.print(pressure);
Serial.println(" Pa");
// Read altitude in meters
float altitude = mpl.getAltitude();
Serial.print("Altitude: ");
Serial.print(altitude);
Serial.println(" m");
// Read temperature in Celsius
float temperature = mpl.getTemperature();
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" °C");
delay(1000); // Wait 1 second before the next reading
}
Sensor not detected by the microcontroller:
Incorrect or fluctuating readings:
No data output in the serial monitor:
Q: Can the MPL3115A2 measure altitude indoors?
A: The sensor calculates altitude based on pressure readings, which can be affected by indoor air conditioning or ventilation systems. For accurate altitude measurements, use the sensor in an open environment.
Q: What is the maximum altitude the MPL3115A2 can measure?
A: The sensor can measure altitudes up to approximately 10,000 meters (32,808 feet).
Q: Can I use the MPL3115A2 with a 5V microcontroller?
A: Yes, but you must use a logic level shifter for the I2C lines to prevent damage to the sensor, as it operates at 3.3V logic levels.
Q: How do I switch between barometer and altimeter modes?
A: Use the setModeBarometer() or setModeAltimeter() functions provided by the Adafruit MPL3115A2 library to switch modes.
By following this documentation, you can effectively integrate the MPL3115A2 sensor into your projects for accurate pressure, altitude, and temperature measurements.