# How to compensate for weather changes in barometric pressure sensor (BMP180)?

I am using BMP180 barometric pressure sensor on an elevator for extended periods (months together), below is the guidance from Sparkfun.

Sparkfun guidance: “You should also remember that pressure changes due to weather will affect your altitude readings. The best accuracy will be obtained if you take a “fresh” p0 (baseline/reference pressure) when you need it and don’t rely on it to be accurate for extended periods due to changes in the weather”

How can I obtain a fresh p0 (baseline/reference pressure) when the elevator is continuously moving ?

-
Must be a fun elevator if you have to jump on and off it while it's moving. Or perhaps it's not actually continuously moving.... – Ecnerwal Jan 7 at 13:05
Are you using absolute pressure to measure the position of the elevator, or just pressure change to measure the relative position of the elevator? – gbulmer Jan 7 at 16:10
@Ecnerwal People having fun in a continuous elevator (a.k.a. Paternoster): Youtube video. – Andrew Morton Jan 7 at 16:45
I'm using a BMP180 for a weather station and therefore record temperature an pressure every few minutes since about 9 months I think. If you want to have a look on real environmental data, I can make it available for you. This might help to simulate your setup. – sweber Jan 7 at 21:46

Two options:

1. Detect ground-floor and perform a reset on each arrival.

2. Install a second unit on a specific floor and update the reference pressure in the elevator micro - perhaps by wireless connection.

And ...

1. Try to compensate in software. If you can detect the difference between the rapid changes of pressure due to elevator motion and those due to atmospheric variation, you could adjust accordingly when the elevator stops (but see caution notes).

2. If there is reasonably frequent travel to upper and lower limits, you could recalibrate then. i.e.,

 if (p > pmax) { // p is pressure reading. pmax = p; // Must be at top floor. pmin = p - bottom_to_top; // bottom_to_top is the pressure span } if (p < pmin) { pmin = p; // Must be at bottom floor. pmax = p + bottom_to_top; }  You would have to manage power-up if the micro doesn't have non-volatile memory.

Caution

If this is an office building with air conditioning, you may have trouble with varying pressures on different floors. This may be high enough to 'swamp' the readings between floors. One way of avoiding this may be to read only when the elevator doors are closed and monitor lift-shaft pressure but this may vary also due to compression of the air during descent and vice versa.

-
@user18197: Answer updated. Can you edit your question to state how many floors this will work over and what barometric pressure you expect at the bottom and the top? – transistor Jan 7 at 14:16
thanks for your answer, there would be around 70 floors with each floor about 2.5mts in height, I would like to know the position of the elevator in real time. In some cases elevator may not reach the ground floor for several hours to perform the reset. Please see the elevator in operation shutterstock.com/video/… – user18197 Jan 13 at 16:17
Cool video. With an industrial unit like that it should be possible to add a sensor somewhere to give a passing reference. My reading of your sensor data sheet indicated you'll get one count difference for 0.25m. Did you figure out what the change in pressure is for 70 floors? And how does that relate to typical range of atmospheric pressures? – transistor Jan 13 at 18:53
@transistor Your recalibration code example seems flawed. What is it supposed to do, and when? – JimmyB Apr 6 at 11:17
It's not flawed. It's just plain wrong! I've reversed the comparison operators. Thanks. – transistor Apr 6 at 11:29

Measure the ground level pressure and adjust your in-elevator reading accordingly. Except for storm front events, the pressure will change quite slowly, but you can update as often as needed. Cheers, Ross

-

Install a switch to detect a specific floor, it could be top, basement, or any in between. Switch options are actual mechanical switch, magnet and Hall sensor, light and photodiode, the possibilities are legion. Then take the pressure whenever you activate that switch.

How you use that reading to update your reference is another matter. You could simply use the reading as the new reference, or you could average it with the last (say) ten readings to reduce the inevitable reading noise.

-