Interfacing MPL3115A2 Altitude Sensor with Arduino UNO/ Mega

Interfacing MPL3155A2 Altitude Sensor with Arduino UNO/ Mega

Interfacing MPL3115A2 Altitude Sensor with Arduino UNO/ Mega

MPL3115A2 is an altitude sensor that operates at 3.3 volts.

Interfacing MPL3155A2 Altitude Sensor with Arduino UNO/ Mega

Connection Diagram:

To Interface Altitude sensor with Arduino Mega:

Interfacing MPL3155A2 Altitude Sensor with Arduino Mega

To Interface Altitude sensor with Arduino UNO:

Interfacing MPL3155A2 Altitude Sensor with Arduino UNO

Altitude Sensor Library for Arduino:

Arduino Library Manager to install libraries in arduino

Arduino Library Manager to install libraries in arduino

Search for “MPL3115”, then select and Install “Adafruit MPL3115A2 Library”

Installing MPL3115A2 Altitude sensor library into Arduino

 

Arduino Code:

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


Adafruit_MPL3115A2 baro = Adafruit_MPL3115A2();

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

void loop() {
if (! baro.begin()) {
Serial.println("Couldnt find sensor");
return;
}

float pascals = baro.getPressure();
// Our weather page presents pressure in Inches (Hg)
// Use http://www.onlineconversion.com/pressure.htm 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");

delay(250);
}

Results:

Interfacing MPL3155A2 Altitude Sensor with Arduino UNO/ Mega

 

Related Links:

Leave a Reply

Your email address will not be published.