I have verified that both the Temperature and Pressure are correct. However I can't get the Altitude reading to get even close to the correct altitude.
I live in Miami, FL (South Florida). I'm practically at sea level, 22 miles (33.5 km) from the beach. Elevation reading from a local weather station is 2 meters.
The Pressure today is 1010.38 hPa, again from the local weather station. The reading on the MPL3115A2 is 101488 PA, which is close enough. hPa on Miami Beach tonight is 1011.74.
Outside temperature tonight is 27.3 C. I am testing the MPL3115A2 inside my one story house where the temperature is around 23 C. Temperature reading is correct on the MPL3115A2.
The altitude being displayed is ... 25394.xx meters!
I read through a document I found on the freescale site and I did see something about adjusting a register to local conditions or something.
Notes: Arduino Uno/Adafruit MPL3115A2/Libraries being used to test are the ones from Adafruit and Sparkfun/
So what is going on here? Why is the Altitude way off while the other two variables are correct. The Altitude is calculated correct?
I really appreciate anyone's help with this.
Thanks
Chris - Miami, FL
Hello All,
I am very new to this. I would like to get the connection details of arduino and mpl3112 freescale xtrinsic sensor.
What I have observed is jumper J1 has 6 pins on its base board and 8 pins on its top pressure sensor board.
I am unable to get the connection details. Can you please guide me with the same? I would also be really helpful if you can guide me with proper pdf for connectrion.
I am having following sensor.
Hi Mitesh,
Attached you can find the schematic of the board you are using.
There are five pins that need to be hooked up in order to start using this sensor.
MPL3115A2 sensor board -> Arduino
VDD (J3-3) -> 3.3V
VDDIO (J2-1) -> 3.3V
GND (J2-5) -> GND
SCL (J2-4) -> A5 (or SCL)
SDA (J2-6) -> A4 (or SDA)
If you are using a 5V Arduino Uno, we recommend putting 330 ohm resistors in line to limit the 5V signal going into the MPL3115A2 and prevent damage to the sensor.
Regards,
Tomas
Tomas,
Thank you so much! I did see that function somewhere in the Arduino library for the MPL3115A2. I'll check this out tonight as soon as I get back home. I'll let you know how it goes.
Once again, thanks!
Chris
Hi Chris,
It looks like you are calculating the altitude in the barometer mode. In order to calculate the correct altitude from registers 0x01 – 0x03, the device needs to be in the altimeter mode (ALT bit of the CTRL_REG1 register has to be set). I am not familiar with Arduino libraries in detail, but I guess that there is a function called “setModeAltimeter()” that puts the sensor into altimeter mode.
I hope it helps.
Regards,
Tomas
PS: If my answer helps to solve your question, please mark it as "Correct" or “Helpful”. Thank you.
Hi Tomas,
I too have a similar problem when I try to read data from the mpl3115a2. I get values in the range of 25394.xx-35111.xx meters even I I try to configure the mpl to altitude mode like you suggested. It seems like non of the configuration process is being picked up by the sensor. I am able to read from the sensor but I cant get it to output appropriate altitude values. When I display values on terminal, I see the values fluctuation at a very fast rate.
I am using Tiva C MCU with code composer studio compiler, and all the codes are written using registers (my own libraries). I have test my code on other sensors (MPU 6050) and I am able to configure the devices properly and read but I just cant seem to have this device configured properly.
void configure_PressureSensor(void)
{
//system mode register
write_pressureSensor(0x11, 0x00);
// Active barometer mode, OSR = 128
//write_pressureSensor(0x26, 0x39);
//* Set to Altimeter with an OSR = 128 */ and Active altimeter mode
write_pressureSensor(0x26, 0xB8);
//* Enable Data Flags in PT_DATA_CFG */
write_pressureSensor(0x13, 0x07);
// activate
write_pressureSensor(0x26, 0xB9);
//system mode register
write_pressureSensor(0x11, 0x01);
}
Hi Saeed,
It is hard to say where the problem might be. At first, I would recommend you taking a closer look at my example code for the MPL3115A2 that illustrates how to configure it and compute altitude as well.
Looking at your configuration, the SYSMOD register (0x11) only indicates the current operating mode (either standby or active), you should not write to it. The SBYB bit in the CTRL_REG1 register (0x26) is used to select the operating mode.
I hope it helps.
Regards,
Tomas
Tomas,
Much better! Still not correct but at least not thousands of meters. It's -27 meters.
It should be 2 meters (or close to 2 meters).
So back to the drawing board.
Let me know if I should check anything else or you need any further information.
Thank you very much.
Chris
Glad to hear this, Chris.
Now you can adjust the altitude using the built-in OFF_H (0x2D) register that offers user-set altitude offset adjustments in twos complement format with a scale factor of 1 m/LSB. In your case the difference is about 29 meters, so you need to write this value into the OFF_H register. Then this offset value is automatically added to the altitude data and the adjusted resulting value is stored in the output data registers 0x01 – 0x03.
Let me know if you have any other questions.
Regards,
Tomas