Xtrinsic MPL3115A2 provides a microelectromechanical systems MEMS pressure sensor with integrated i2C interface to provide an accurate Pressure / Altitude and Temperature Data. The sensor output are high resolution 24 bit ADC. Internal processing removes compensation tasks from the host Microcontroller system. Multiple user-programmable, power saving, interrupt and autonomous data acquisition modes are present including programmed data acquisition cycle and timing and poll only modes, typical active supply current at 40 uA per measurement-second for stable 10 cm output resolution. The MPL3115A2 driven power at 1.95v to 3.6v internal regulated by LDO, direct reading compressed on 20-bit pascal for Pressure and Altitude and 12-bit degree Celsius for the temperature, operates up to 400 kHz. Applicable for high accuracy Altimetry, Smart Phones and Tablets, PEA Personal Electronic Altimetry, GPS Dead Reckoning, GPS for Emergency Services, Mapping Assist for Navigation, and Weather Station Equipment.
Required Components
- Arduino Microcontroller, NodeMCU, Teensy Board, TeensyDuino, ESP8266 12, 12E, ESP8266 NodeMCU, ESPDuino, ATMEGA328 16/12, ATMEGA32u4 16/8/ MHz, ESP8266, ATMEGA250 16 MHz, ATSAM3x8E, ATSAM21D, ATTINY85 16/8 MHz (Note: The Diagram below is using NANO. (please refer to the respective pin-outs)
- ADNS 3050 Module / ADNS Sensor
- Jumper Wire / DuPont Wire
- Solder Less Breadboard
Optional if your using a MPL3115A2 Module
- 100nF, 10uF Capacitor
- 4.7k Ohms Resistor
- PCB Board
Wiring Guide
Source Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
#include <Wire.h> #include <SparkFunMPL3115A2.h> //Library can be downloaded below #include <SoftwareSerial.h> // Library can be downloaded below SoftwareSerial display(3, 2); MPL3115A2 sensePressure; char pastring[10]; char tmpstring[10]; float pressure; float temperature; int ipress; int itemp; void setup() { Wire.begin(); // begin i2c bus Serial.begin(9600); // set to start serial for output sensePressure.begin(); // start sensor to availability sensePressure.setModeBarometer(); // Set to measure pressure in Pascals from 20 to 110 kPa sensePressure.setOversampleRate(7); // Set Over sample to the recommended 128 sensePressure.enableEventFlags(); // set all 3 pressure and temp event flags display.begin(9600); Serial.begin(9600); delay(500); display.write(254); display.write(128); display.write(" "); // set to clear display display.write(" "); } void loop() { pressure = sensePressure.readPressure(); ipress = pressure; sprintf(pastring, "%3d", ipress); Serial.print("Pressure(Pa): "); Serial.print(pastring); display.write("Pres (Pa): "); display.write(pastring); temperature = sensePressure.readTempF(); itemp = temperature; sprintf(tmpstring, "%3d", itemp); Serial.print(" Temp(f): "); Serial.print(temperature, 2); display.write("Temp (f): "); display.write(tmpstring); Serial.println(); display.write(254); // set to move cursor to beginning of first line display.write(128); delay(100); } |
Downloads
- Download MPL3115A2 Code Library & Other Example Codes For Arduino | Zip
- Download MPL3115A2 Datasheet | PDF