A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://learn.sparkfun.com/tutorials/mpl3115a2-pressure-sensor-hookup-guide below:

MPL3115A2 Pressure Sensor Hookup Guide

MPL3115A2 Overview

The MPL3115A2 is a low-cost, low power, highly accurate barometric pressure sensor. Use this sensor to detect changes in barometric pressure (weather changes) or for altitude (UAV controllers and the like). The sensor is very sensitive and capable of detecting a change of only 0.05kPa which equates to a 0.3m change in altitude.

Things you should know about this sensor:

This sensor is ideal for environmental sensing, a weather station, or datalogging. It is a worthy replacement for the BMP085 and is more sensitive than the MPL115A1.

Suggested Reading Hooking It Up

Wiring up the MPL3115A2 pressure sensor is very easy! After soldering the headers of your choice on the board, you'll need to convert the logic between the 5V and the sensor using a logic level converter.

You'll need 5v and 3.3V for VCC, one for GND, and two data lines for I2C communication from your Arduino. You may also use the A4 and A5 pins on older Arduino Boards that do not have SDA and SCL broken out.

Note: This breakout board has built-in 1kΩ pull up resistors for I2C communications. If you're hooking up multiple I2C devices on the same bus, you may need to disable the other resistors on the bus.

Note:

If you have a RedBoard Qwiic, there is an alternative to use the built-in logic level converter using the qwiic adapter and cable or jumpers that can be used to adjust the voltage level to 3.3V.

SparkFun RedBoard Qwiic DEV-15123

The SparkFun RedBoard Qwiic is an Arduino-compatible development board with a built in Qwiic connector, eliminating the need …

SparkFun Qwiic Adapter DEV-14495

The SparkFun Qwiic Adapter provides the perfect means to make any old I2C board into a Qwiic enabled board.

Hookup Table

With respect to the logic level converter, the pin connections starting from LV1 are listed in the table below.

MPL3115A2 Logic Level Converter (Low Side) Logic Level Converter (High Side) 5V Arduino w/ Atmega328P SCL LV1 HV1 SCL (or A5) SDA LV2 HV2 SDA(or A4) VCC LV 3.3V HV 5V GND GND GND GND Arduino Code

The following Arduino example will get your sensor up and running quickly, and will show you current pressure in Pascals.

Note: This example assumes you are using the latest version of the Arduino IDE on your desktop. If this is your first time using Arduino, please review our tutorial on installing the Arduino IDE.

If you have not previously installed an Arduino library, please check out our

installation guide.

Load the Pressure example

Once the library is installed, open Arduino, and expand the examples menu. You should see the MPL3115A2_Pressure sub-menu. Load the "Pressure" example onto the Arduino. Open the serial terminal at 9600bps. You will see the current barometric pressure and temperature in the room!

Pressure readings!

Load the BarometricHgInch example for an example that coverts pressure from Pascals to inches of mercury, altimeter setting adjusted. This type of pressure reading is used in the USA on Wunderground for home weather stations and aircraft.

Load the Altimeter example for an example that coverts pressure to current altitude in feet (or meters).

Explanation of Functions

The library and example code demonstrate the most popular functions supported by the MPL3115A2. Here is an explanation of all the available functions in the library:

When you call the readAltitude, readAltitudeFt, readPressure, or readTemp you will get a float with the sensor reading or an error code:

Oversample settings

The MPL3115A2 has a large number of features. Checkout the datasheet for more info. This library covers the fundamentals. Help us out! Please add or suggesting more features on the MPL3115A2 github repo.

Pressure vs Altimeter Setting

If you grabbed a few pressure readings and became confused when you checked your local weather conditions, you're not alone. The absolute pressure that the MPL3115A2 pressure sensor outputs is not the same as what weather stations refer to as pressure. Weather stations report pressure in lots of different units:

In barometer mode, the MPL3115A2 outputs pressure readings in Pascals. This is most closely related to millibars or hectopascals. But, why does the sensor not agree with the station around the corner? This is because many stations report pressure in a few different formats. Have a look at all these numbers for the Boulder/Denver area. The key is that your local weather station is probably reporting the Altimeter setting.

Thank you National Oceanic and Atmospheric Administration (NOAA)! Did you know they're headquartered here in Boulder, CO?

The calculation to get from Pascals to 'Altimeter setting' is a bit gnarly:

Formula to convert Pascal pressure to Altimeter setting

Grab the full formula here and give this great Altimeter setting calculator a try. This formula relies on two things: knowing the current pressure in milibars and knowing the height above sea level that the pressure was read. We recommend you capture altitude using a local survey point or a GPS receiver.

If you installed the MPL3115A2 library, you should also have the BarometricHgInch example sketch under the Examples->MPL3115A2_Pressure menu under the Arduino IDE. We didn't build this calculation into the library because it could potentially chew up a lot of RAM and code space calculating all the floating point math. But, if you're doing home weather station calculations, this should get you started.

Resources and Going Further

Now that you've got barometric pressure sensing under your belt, consider checking out the following projects and products:

Looking for ideas to use the MPL3115A2 pressure sensor? Well you could:


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4