Using the code and libraries provided, my results are negative and the altitude results increase as I go down in height and decreases as I go up. I have also tried these in the Arduino Forums to no avail: http://forum.arduino.cc/index.php?topic=104247.0 http://forum.dev.arduino.cc/index.php?topic=156339.0
Any ideas what the issue is? My setup is an Arduino Uno Rev. 3/Arduino Micro (assuming the SCL and SDA ports work the same) and the altimeter module (wired the same manner as in the Parallax link above) along with Arduino Version 1.0.5. Also, how do I calibrate it? Could I get some assistance in this? Any help would be appreciated!
The library can be downloaded from the Parallax link I posted previously.
I just realized-the sensor works well w/ this bit of code works IF the sensor is hooked up to the 3.3V port.
This is the typical results (going up). The temperature is off-the temp in my apartment is 76F. Any ideas how to fix that? Also how do I calibrate the AGL pressure? And how do I get the raw pressure in Pascals?
You may have to modify the library code to get the raw pressure readings. I didn't look at it very carefully, but here is where the altitude is calculated from the averaged pressure readings:
virtual int32_t AcquireAveragedSampleCm(const uint8_t nSamples)
{
int64_t pressAccum = 0;
for(size_t n = nSamples; n; n--)
{
const uint32_t temperature = ReadAdc(cmdAdcD2_ | cmdAdc4096_); // digital temperature value : typical 8077636
const uint32_t pressure = ReadAdc(cmdAdcD1_ | cmdAdc4096_); // digital pressure value : typical 6465444
const uint32_t pressConv = ConvertPressureTemperature(pressure, temperature);
pressAccum += pressConv;
/*
(commented out code)
*/
}
const int32_t pressAvg = pressAccum / nSamples;
const int32_t AltCm = PascalToCentimeter(pressAvg);
return AltCm;
If you continue to read the SPI without sending a MS5607 command, the entire register can be read.
But based on experience I can't recommend using the SPI interface for this sensor at 5V logic. Even some I2C devices cause I2C communication failures with this sensor, too.
Anyone ever check IntersemaBaro.h for data-type-conversion errors in the calculations? I recall having to change type declaration ordering to have the math match.
Also a bit curious what launch stress will do on circuit performance, especially the effect on this grade of crystal oscillators.