I don't understand why you need 2 modules if you know the exact altitude of 25m ?
Eric
It looks like the altitude returned from the module, where the pressure at mean sea level is 1013 hPa is the reference pressure, is varying with the actual air pressure. If you understand what I mean?
Meaning that the air pressure at 0m is constantly changing, therefore the reference pressure used to calculate altitude is constantly changing.
Ok I get that, but is your module moving ? If it stays at 25m altitude, you may write an "auto-calibrating function" to find the right pressure reading. I'm thinking of something like
measuredAlt = sensor.getAltitude(theReferencePressure);
while (measuredAlt > 26) {
theReferencePressure -= 1;
measuredAlt = sensor.getAltitude(theReferencePressure);
}
while (measuredAlt < 24) {
theReferencePressure += 1;
measuredAlt = sensor.getAltitude(theReferencePressure);
}
//theReferencePressure should be ok now ?
Eric
Oh Lord, please don't let me be misunderstood (The Animals)
Actually, for me, the altitude is pretty much useless as I am not moving the module, I was only noting my findings in case anybody decided to use this module in a model aeroplane or quadcopter.
I was just trying just to put over that the sketch has to be zeroed out according to the local ambient air pressure, before deployment.
Ok, just found one quickly:
Goodnight and enjoy... I expect a working protocol by tomorrow night 🙂
Having said that however, could you not just put the 4 float variables in an array external to the structure, calculate their checksum, and then update the checksum variable in the structure before sending?
I suppose I could just make checksum a floating-point number, and just add the other floats together to make a crude checksum, but to use XOR, I really need the byte values!!
I have been looking at the BME280 and have setup a small altimeter. I did a number of tests. plotted the altitude at a fixed point over 2000 observations. The variance was not too bad about 30cm. I then took another plot of 2000 obs where each observation was the average of 1000 obs. In this case the variance dropped to around 10 cm. I ran into a conundrum using the device altitude. The device is very sensitive to small variations in pressure (eg,. can measure the height of the desk from the floor).In my extended tests I noticed the altitude gradually drifted off. This is fairly obvious because the sea level pressure is always changing with the weather patterns. What to do? Where I live I know the altitude so when I turn my altimeter on I calibrate to the correct altitude by adjusting the sea level pressure using a potentiometer. This works at home for a short while then needs recalibrating. If I go into the nearby mountains I will be in an area where I do not know the altitude nor do I know the sea level pressure. Hence my conundrum.
Has anyone looked at this?
I've never played around with altitudes before, but a quick search pulls up many, many pages of information. The following page provides some good detail with example code:
How to Set Up the BMP180 Barometric Pressure Sensor on an Arduino
Cheers.
Interesting article., but does not solve the problem. If you move from the site you know the altitude for then you do not know the sea level pressure or the altitude. You are calculating altitude based on an incorrect sea level pressure if you move your location or the time changes. For the device to work correctly you must know either your current altitude or the sea level pressure at your current location and time. As far as I can see it cannot be done. Unless you can get detailed weather information for your current location. The best I can imagine is to use a weighted mean of pressure data from any surrounding weather stations to get an approximate value. Here in northern Thailand there are only a handful of stations.
A rough and ready solution may be to use 2 BME280s. One to collect the actual air pressure at ground level and pass this on to the second BME280 as a zero point to work out the actual elevation above current ground level.
So if you were flying a model aeroplane this should be done just once before take-off!
Unless you can get detailed weather information for your current location. The best I can imagine is to use a weighted mean of pressure data from any surrounding weather stations to get an approximate value. Here in northern Thailand there are only a handful of stations.
Indeed, I did read another article which spoke about taking the mean, which sounds like reasonable solution, as long as you can obtain that information. Another article I read also mentioned that inaccurate readings can come from variables lacking in precision, such as a 4 byte 'float' - Even using a 'double' on ATMEGA based boards uses the same number of bytes, so 'double' offers no additional precision, but an Arduino DUE for example (32 BIT ARM controller), offers 8 bytes of precision and 12 bit A/DAC's for greater resolution, which may make up for some of those inaccuracies.
I like the idea @pugwash mentioned.
I was thinking of something along the same lines but he beat me to it! 🙂
Cheers.