Interfacing MPL3115A2 Altitude Sensor with Arduino UNO/ Mega
MPL3115A2 is an altitude sensor that operates at 3.3 volts.
Connection Diagram:
To Interface Altitude sensor with Arduino Mega:
To Interface Altitude sensor with Arduino UNO:
Altitude Sensor Library for Arduino:
Search for “MPL3115”, then select and Install “Adafruit MPL3115A2 Library”
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:
Related Links:
- Increasing the length of Serial Buffer in Arduino
- Reset Arduino using Programming
- Interfacing Accelerometer ADXL345 (GY-291) with Arduino UNO/ Mega
- Character LCD with large/ big fonts using Arduino
- Downloading a webpage from internet using Arduino
- Interfacing Soil Moisture Sensor with Arduino
- Interfacing Water Flow Sensor with Arduino
- Errors in Simulating AVR ADC codes on Proteus
- Interfacing GPS Shield for Arduino(ublox NEO-6M-0-001) with Arduino Mega 2560
- Master RESET ESP8266 Wifi Module using Arduino mega 2560
- Interfacing Bluetooth Modules HC-05, HC-06, JY-MCU BT_BOARD v1.02 and v1.03 with Arduino Uno and Arduino Mega 2560
- Bluetooth HC-05, HC-06 Command/ Master Mode and AT Commands
- Interfacing SIM900D GSM Module Board with Arduino Mega 2560