문제

I'm trying to realize an Android application which tells the user if he is going downstairs or upstairs by measuring the pressure of different floors using the barometer of the phone.

My idea was to write a step counter to scan if the user is walking and check, every N steps, the pressure at step 1 and at step N, if the pressure changes by a threshold of 0.3 mbar I can tell that the floor is changed (I made some trials to find the value of 0.3).
The problem is that this method works if the first step is at the beginning of the stair and the last is in another floor, otherwise the barometer will be not able to recognize the difference in pressure between two floors. Could someone suggest me an idea to solve this problem?

P.S. I'm forced to use the barometer, so I have to use this sensor.

도움이 되었습니까?

해결책

Assuming that your 0.3 mbar is reliable (which it probably isn't; see below), you can't just assume N steps because some people are going to run up the steps two at a time, some are going to take two steps to cover each step, and some crazy kids are going to jump down an entire flight of stairs in one hop.

So you probably want to use a combination of time and steps. For example, set a timer to tick every 10 seconds, and check the barometer at that time. Just use the steps thing to determine if the phone has been moving during that period.

You'll likely find that your 0.3 mbar is, at best, a very rough approximation. It's probably going to vary from day to day, and quite possibly throughout the day based on temperature and humidity, and whether the stairs are in the building proper or in an enclosed stairwell. Some of those enclosed stairwells have a pressure differential between them and the inside of the building (or between them and the outside), and the pressure changes pretty quickly when somebody opens a door into the building or to the outside.

It's also going to depend on how tall the floors are.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top