Barometers and parking floor math

Áp kế và toán tầng hầm

Modern phone barometers are MEMS pressure sensors reporting absolute atmospheric pressure in hectopascals with stationary noise on the order of plus or minus zero point three to one pascal root-mean-square. That noise floor sounds tiny until you realize what it represents physically: at sea level, air pressure decreases by roughly twelve pascals per meter of altitude gain, a relationship derived from hydrostatic equilibrium where the pressure change equals density times gravitational acceleration times height change. Twelve pascals of signal therefore corresponds to about one meter of vertical resolution in ideal conditions — good enough to distinguish basement level B2 from B3 in a typical three point two meter per floor garage, but nowhere near precise enough to replace horizontal GPS positioning.

Wheria uses barometer data as a floor hint, not a navigation solution. When you tap Park, the application records pressure P-zero as a session baseline, optionally flagged if you are still outdoors at street level where weather-driven drift has not yet accumulated. On each subsequent barometer sample, arriving at one to ten hertz depending on operating system scheduling, the algorithm computes delta-P equals current pressure minus P-zero, then applies a low-pass filter around zero point zero five hertz to suppress step noise from HVAC fans and walking-induced pressure fluctuations, and a high-pass filter around zero point zero zero one hertz to remove weather fronts that change ambient pressure by two hundred to four hundred pascals per day — enough to falsely suggest you descended an entire floor when a cold front arrived instead.

Where the naive formula breaks

Elevators introduce rapid pressure transients from pressurization and ventilation systems that exceed the rate of change produced by walking down a ramp, causing false floor detections unless the inertial measurement unit reports elevator-like motion and down-weights barometer trust during that interval. Parking with the engine or climate control running shifts local pressure slightly inside the vehicle cabin before you exit. iPhone and Pixel barometers exhibit different absolute offsets — we store per-session baselines at park time rather than attempting aviation-style QNH altimeter correction against a weather service. Pressurized elevator shafts in high-rise towers like Landmark 81 behave differently from open spiral ramps in suburban malls, which is why ktuyen segments barometer regression tests by garage architecture rather than assuming one calibration fits all.

What we display and what we refuse to claim

When delta-P maps to a floor index using user-configured slab height — default three point two meters per level, or values learned from prior visits to the same structure — the interface shows something like "Likely B3" with a plus-or-minus one floor uncertainty band. We never auto-overwrite a floor label the user typed manually, because barometer inference is probabilistic and a wrong automatic label erodes trust faster than no label at all. In Landmark-style open slab garages with three point two meter floor height, median classification error is zero floors when the user walks stairs; elevator-only transitions mislabel roughly thirty percent of the time without IMU activity context distinguishing "walking ramp" from "standing in moving box."

Understanding barometer behavior in garages also explains why we fuse floor hints with inertial activity rather than treating pressure alone as ground truth. A user who rides an elevator from B1 to B3 produces a pressure profile indistinguishable from someone who walked two flights of stairs in ten seconds — unless the accelerometer reports the characteristic vibration and near-zero horizontal displacement of elevator travel. That fusion logic lives in the same pipeline as step odometry and compass heading, and it is why ktuyen logs both "stairs only" and "elevator only" test cases separately in her regression spreadsheet.

You can experiment with pressure-to-floor mapping on our Lab page garage scroll demo, which visualizes the hydrostatic relationship in real time. The barometer feeds into the broader indoor pipeline described in indoor navigation when GPS dies, and its measurements enter the Extended Kalman Filter framework alongside step odometry and compass heading as discussed in Kalman filters for parking. For the sensor fundamentals behind the readings, Phyzix exposes raw barometer data with SI units in its environment instruments section.

Áp kế điện thoại hiện đại là cảm biến áp MEMS báo áp khí quyển tuyệt đối theo hectopascal, với nhiễu khi đứng yên cỡ ±0,3–1 pascal RMS. Mức nhiễu nghe nhỏ cho đến khi hiểu nó đại diện vật lý gì: ở mực nước biển, áp suất không khí giảm khoảng mười hai pascal mỗi mét độ cao tăng thêm — quan hệ từ cân bằng thủy tĩnh, thay đổi áp bằng mật độ nhân gia tốc trọng trường nhân độ cao. Mười hai pascal tín hiệu tương ứng độ phân giải dọc khoảng một mét trong điều kiện lý tưởng — đủ phân biệt tầng hầm B2 và B3 trong hầm 3,2 m/tầng điển hình, nhưng không đủ thay GPS ngang.

Wheria dùng dữ liệu áp kế làm gợi ý tầng, không phải lời giải dẫn đường. Khi bấm Đỗ xe, app ghi áp suất P-zero làm baseline session, tùy chọn flag nếu còn ngoài trời mặt đường nơi drift thời tiết chưa tích lũy. Mỗi mẫu áp kế sau đó, 1–10 Hz tùy lịch OS, thuật toán tính delta-P bằng áp hiện tại trừ P-zero, rồi low-pass ~0,05 Hz triệt nhiễu bước từ quạt HVAC và dao động áp khi đi bộ, và high-pass ~0,001 Hz loại front thời tiết đổi áp môi trường 200–400 pascal/ngày — đủ gợi ý nhầm bạn xuống cả tầng khi front lạnh đến thay vì bạn đi xuống ramp.

Công thức naive vỡ ở đâu

Thang máy tạo transient áp nhanh từ áp suất hóa và thông gió, vượt tốc độ đổi khi đi ramp, gây detect tầng sai trừ khi IMU báo chuyển động kiểu thang máy và giảm trọng số tin áp kế trong khoảng đó. Đỗ xe máy nổ hoặc climate chạy lệch áp local trong cabin trước khi bạn ra ngoài. Áp kế iPhone và Pixel lệch offset tuyệt đối khác nhau — team lưu baseline theo session lúc đỗ thay vì hiệu chuẩn kiểu QNH hàng không từ dịch vụ thời tiết. Hố thang máy áp suất cao ốc như Landmark 81 khác ramp xoắn hở ngoại ô mall, nên ktuyen tách regression áp kế theo kiến trúc hầm thay vì một calibrate cho mọi nơi.

Team hiển thị gì và không tuyên bố gì

Khi delta-P map sang index tầng bằng cao sàn user cấu hình — mặc định 3,2 m/tầng hoặc giá trị học từ lần trước cùng cấu trúc — giao diện hiện kiểu "Có thể B3" kèm band ±1 tầng. Team không bao giờ ghi đè nhãn tầng user tự nhập, vì suy luận áp kế là xác suất và nhãn tự động sai phá niềm tin nhanh hơn không có nhãn. Hầm sàn mở kiểu Landmark 3,2 m/tầng, median lỗi phân loại 0 tầng khi user đi cầu thang; chỉ thang máy sai nhãn ~30% nếu không có context IMU phân biệt "đi ramp" và "đứng trong hộp di chuyển."

Hiểu hành vi áp kế trong hầm cũng giải thích vì sao team fusion gợi ý tầng với hoạt động quán tính thay vì coi áp suất một mình là ground truth. User đi thang máy từ B1 lên B3 tạo profile áp không phân biệt được với ai đi hai tầng cầu thang trong mười giây — trừ khi gia tốc kế báo rung đặc trưng và dịch chuyển ngang gần bằng không của đi travel thang. Logic fusion đó nằm cùng pipeline với odometry bước và heading la bàn, và là lý do ktuyen log riêng case "chỉ cầu thang" và "chỉ thang máy" trong spreadsheet regression.

Bạn thử map áp–tầng trên demo scroll hầm trang Lab, visual hóa quan hệ thủy tĩnh real-time. Áp kế vào pipeline indoor rộng hơn trong dẫn đường trong nhà khi GPS chết, và đo vào Extended Kalman Filter cùng odometry bước và heading la bàn như Kalman cho đỗ xe. Nền tảng cảm biến đằng sau số liệu: Phyzix mở raw áp kế đơn vị SI ở nhóm công cụ môi trường.