I have the MPL3115A2 on a PCB and I can read and write to it no problem. It is interfaced to an MCU.
Temperature reading is accurate but like I've seen in other posts, altitude varies over time when not moving. I undertstand that the manufacturing process plays a role in the calibration and I'm fine with that. But this is not where I need help.
I've seen many suggestions to use the <OFF_H - altitude data user offset register (address 2Dh)> but I'm not sure I fully understand how to use that register (I understand it's a "value" but how does that value compute in the whole picture to resolve my problem?).
So here's what I am trying to accomplish:
I have two circuits, each with the MPL3115A2 sensor. I can communicate with both circuits via a GSM modem to get their temperature and altitude readings. While both circuits are next to each other, I press a button on each and this sets their base altitude to 0 meters.
Then, both circuits are taken inside a building. The building can range from to 2 floors all the way up to whatever number of floors a high-rise building may have in a typical North-American city. With a colleague, one person (e.g. myself) stays at the bottom of the building with one circuit (base circuit) and my colleague takes the other circuit (top circuit) to a random floor in the building. Once my colleague reaches the desired floor, I get the reading off his circuit and calculate the difference with my circuit in order to get the height difference. All I want to know is the height difference between both, that's it.
But this is where it gets somewhat a bit more complex and hopefully someone can provide precise help.
I have a quadcopter with an altimeter on it and combined with GPS, it's quite amazing how it maintains its altitude when I tell it to stay in such location at such altitude. It just sits there waiting. With both my circuits, I noticed that the altitude swings a lot, not in the same way, even when they stay next to eachother.
What I am doing at the moment is reading 10 values, averaging them-out then use the average as the "altitude" but that still does not seem to provide sufficient precision. Ideally, if I can have roughly 1m - 1.5m apart, that would be ideal.
Question 1: Should the 0-base initialization of both devices be done outside the building first or inside the building?
Question 2: Does temperature affect overall calibration? If so, how do I introduce the temperature in the equation in order for it to be taken into account?
Question 3: What is the calculation I should use to make sure that once both sensors have their "base" offset set to 0m, they provide the same altitude when sitting next to eachother?
Question 4: After the 0-base altitude has been set on both, let's say they got calibrated inside the building, can the "base" circuit be taken outside or should it stay inside since both were calibrated inside? Temperature outside (here in Canada) can get pretty cold therefore if temperature has an effect on the sensor, then I guess it should remain inside?
Question 5: Should I be using the OFF_H (2Dh) register and if so, how does that come into play? That part I don't fully understand.
Really, all I care about is that the altitude difference between both is somewhat precise, that's it. If they're 153m apart, I want to know. If they're 27m apart, I want to know.
If you have a typical configuration of the registers that will do what I need, please let me know.
I have read the datasheet but I am asking for more precise help because the datasheet is not enough (or there are parts I'm not sure I fully understand).
Any help is appreciated.
1. The 0-base initialization should be done at the start of the application and in the location where the application will be used. The pressure in a building for example may be higher than the outside due to the ventilation system for example.
2. Temperature does affect the pressure, but the sensor’s output is already temperature compensated.
3. I would recommend using a maximum oversampling (OS[2:0] = 0b111) to decrease output variation. This coupled with post averaging and eliminating the first sample may help.
4. This has been explained in previous answers (1 and 2).
5. The OFF_H register allows altitude offset adjustments in two‘s complement format with a scale factor of 1 meter/LSB, so in the range of −128 to +127 meters. The value written into this register is automatically added to the altitude value calculated internally based on an ambient pressure as shown in the equation in section 9.1.3 of the datasheet.
Have a look at our AN4528 where you can find more information.