Skip to content
If this is your first visit, please click here to learn about shipping and delivery.
If this is your first visit, please touch here to learn about shipping and delivery.
MPL3115A2 barometric pressure and altitude sensor breakout board

Using a Barometric Altitude Sensor: References, Drift and Relative Height Tests

A barometric altitude sensor can show a small change in height without satellites or a clear view of the sky. It can also appear to climb while sitting on a desk. Both behaviours make sense once you remember that it measures air pressure and estimates altitude from that pressure.

The MPL3115A2 pressure, altitude and temperature module is one example in PMD Way's altitude sensor collection. It suits experiments in relative height, pressure logging and sensor interpretation. Getting useful results requires a reference, an appropriate sampling method and an enclosure that lets the sensor experience the air you intend to measure.

Pressure is measured; altitude is inferred

Atmospheric pressure generally falls as altitude increases, but weather also changes pressure. Converting one pressure reading into height therefore requires assumptions about the atmosphere and a reference pressure. A factory-compensated pressure sensor does not remove that reference problem.

The MPL3115A2 provides pressure and altitude operating modes. Its nominal atmosphere model is documented in the NXP MPL3115A2 datasheet. The specified operating pressure span is 20–110 kPa, while its calibrated pressure range is 50–110 kPa. These are different qualifications; neither means that every displayed altitude has survey-grade accuracy.

For a classroom investigation, relative height over a short session is often more useful than an absolute elevation. Establish a starting position, record a baseline and compare subsequent readings with it. For an outdoor logger used over hours, keep the raw pressure too, because a changing weather system may otherwise look like a change in terrain.

Separate resolution, noise and accuracy

Resolution describes how finely a reading can change. Noise describes variation when the physical input is steady. Accuracy describes closeness to the real quantity under stated conditions. A display with two decimal places does not prove centimetre accuracy, and averaging does not remove a wrong atmospheric reference.

Imagine a device that repeatedly reports 24.10, 24.14 and 24.11 metres on a bench whose true elevation is different. The readings are consistent, but that alone says little about absolute height. Conversely, a noisy signal can still show a useful sustained change after appropriate filtering. Assess those questions separately.

Check the module before connecting I2C

The bare sensor's supply is specified as 1.95–3.6 V, and its digital interface also has a low-voltage supply limit. The module listing advertises broader board compatibility, which depends on supporting circuitry. Confirm the exact board's regulator, level shifting and pull-up connections before connecting a 5 V controller.

A regulator on a board does not by itself make every signal pin 5 V tolerant. Identify the permitted input pin and the voltage to which SDA and SCL are pulled up. Check the host controller's own requirements and avoid tying together incompatible pull-up rails.

The sensor uses the seven-bit I2C address 0x60. An address scan can establish that something acknowledges there, but it is only the first check. Follow with the documented device identification and a plausible pressure reading. If communication fails, inspect supply, ground, bus mapping and pull-ups before changing the altitude calculation.

Build a trustworthy measurement record

Start with a small logger that records time, pressure, selected operating mode and validity status. Add derived altitude only after those basic fields behave sensibly. State units explicitly: pascals, kilopascals and hectopascals can represent the same pressure with very different numerical values.

NXP's data handling and settings application note explains mode changes, oversampling, data formats and polling or interrupt-based acquisition. Follow its register-format guidance rather than treating every returned byte as an independent measurement.

Read new data when it is ready and use a timeout for failed acquisition. A tight loop that repeatedly reads an unchanged result does not increase the true sample rate. Keep communication errors distinct from real pressure changes; substituting zero for a failed read can create a spectacular but entirely fictional altitude jump.

Choose filtering for the question

For a stationary pressure display, a gentle average can reduce visual jitter. For a short stair-climbing experiment, an overly long average may hide the timing of the movement. Compare the raw trace with the filtered trace and note the delay introduced by your processing.

Oversampling also involves a trade-off between noise and measurement timing. Choose settings from the documented conversion behaviour, then record them with the results. If two students compare logs produced with different settings, apparent differences may come from processing rather than the sensors themselves.

Run a repeatable relative-height experiment

  1. Place the assembled logger at a marked starting location and let readings settle.
  2. Record a baseline interval rather than one isolated sample.
  3. Move to a second marked location while keeping the sensor's enclosure and orientation consistent.
  4. Pause and record another stationary interval.
  5. Return to the starting point and compare the new baseline with the original one.

Returning to the start helps reveal drift during the experiment. Repeat the route and compare the difference between stationary sections, not the most extreme instantaneous readings. Use an independently measured height difference if you want to assess the result quantitatively.

A lift or ventilated stairwell may produce pressure disturbances unrelated to a simple open-atmosphere model. Record those surroundings in the experiment notes. An unexpected result can be useful evidence about the installation rather than an immediate reason to rewrite the conversion formula.

Give the sensor a suitable environment

A sealed enclosure measures trapped air, whose pressure can change as its temperature changes. Provide a suitable pressure path for ambient measurements while protecting the board against contamination and moisture. Do not cover the sensing opening with adhesive or attempt to waterproof it by filling the package.

Keep the sensor away from direct fan blasts and avoid locating it beside components that heat the surrounding air unnecessarily. Check the completed enclosure, because a successful open-bench test does not establish the response time of a restricted vent.

Save the reference method, physical mounting, firmware settings and original pressure data with each experiment. Those records let you distinguish weather, installation effects and genuine movement, making a modest barometric module a much more useful measurement tool.

Previous article Battery Power for Arduino Projects: Voltage Range, Runtime and Regulator Heat