remove errors in readings

I have 2 BMP280 sensors using I2C on an EXP8266
using the CactusIO.h library

one one pair, with them both next to each other, the readings are:
29.7515106201 - 29.7553424835 = 0.0038318634
29.7506294250 - 29.7550907135 = 0.0044612885
29.7498531342 - 29.7539787292 = 0.0041255950
29.7497386932 - 29.7532691956 = 0.0035305024
29.7481060028 - 29.7523212433 = 0.0042152405

these are readings taken about 2 minutes apart,
the raw values are converted to inches of water.

as you can see the difference is in the last 8 decimal places.

my needs are only for the first 6
when the fan in the greenhouse starts, the numbers separate to show that the fan is running.

on my second unit, subtracting P1 from P2 I get :
0.020081 // fan off
0.018320 // fan off
0.018597 // fan off
0.019386 // fan off
0.108194 // fan running
0.118654 // fan running
0.116537 // fan running
0.115227 // fan running

what I want to do is to ignore the errors when the two units are on the bench next to each other.

my thoughts are to run on the bench
let them run for 100 cycles take the highest reading
put the highestReading in EEPROM
the running program would be something like

unsigned long deltaP = P1 - P2 ;
if (deltaP < highestReading )
deltaP = 0.00 // assume if less, then the fan is not running and report 0

then datalog deltaP.

it would either be 0,0 or it would be any value over highestReading

Another thought is to set in the greenhouse, let run for an hour, average the readings and just create a threshold at startup and use that value.

I was thinking about creating a menu and putting an initialize loop in so I would not have to do this on the bench.
since I need to make 2 more units, the errors are becoming annoying.
and any readings below a certain point are parts errors, not actual process differences, I do not want to log them.

suggestion ?
is there a better practice ?

You forgot about temperature dependence differences.
I hope the temperature is about the same.

The BME280 has to be set into the highest and slowest accuracy, and that number can be averaged even more in software.
How fast should they respond ? Is the average during one minute okay ?

I don't know what you want with the highest rating.
When they are side by side, you could take the average during a minute and store the offset for one (or both) in EEPROM.

I like this:

my thoughts are to run on the bench
let them run for 100 cycles take the highest reading
put the highestReading in EEPROM

I'd probably increase highestReading by some factor too - ten percent?

Measure the mean difference at startup, add 50% of the pressure difference the fan creates - then the
threshold is halfway between the fan-off and fan-on values, giving the greatest immunity to mistakes
in the face of variations.

You mean mercury, not water, atmospheric pressure is about 400 inches of H2O

If I wanted to know if the fan is running, I’d use a light and a phototransistor to detect that.

Hi,
Where have you got the sensors situated with respect to the fan/s?

You only need to use one sensor and configure it like a pitot tube that aircraft use to measure air speed.

Just put a tube on the inlet of the sensor and point it at the airflow coming from the fan, a very small diameter tube/pipe would be needed for such a sensitive device.

You could even calibrate it for air speed.

Just a thought, and it would give you greater separation of readings.

OR a flap in the air flow of the fan, and a switch or potentiometer measuring angle.

Tom... :slight_smile:

it would seem then, that to set:
log readings
energize fan
log readings

set a point no more than halfway between the low and high readings.

this is simple enough. I was starting down the path of running a standard deviation calculation and figured it might be better to ask.

Once the new parts arrive, I will put all the sensors on the bench
run for 100 data points or so
test for highest value
lowest value
and run a standard deviation calculation to see how they compare. (kicks and giggles)

as for inches of water vs in of Hg
atmospheric pressure starts with standard air density or standard atmospheric pressure
SAP = 70 deg F, at sea level at :

101,325 pascals
14.6959 pounds per square inch
29.92 in. HG
760 mmHG (Torr)

407.17227 inches of water.

so, YES MartT, I am using inHG

I spent many years with HVAC, air flow, and velocity pressure in the US. With Pitot tubes, we used inches of water
ditto for the pressure separations for clean rooms, dirty air filters and duct pressures.

I think It would be best is I used the raw data output from the BMP280 for the settings.

With a 'zero' of about 0.02 separation and a high of about 0.11 (inHG)
The difference for the fan on/off is just under 1 inch of water differential pressure.
by having one (inside of the greenhouse) to measure exhausted temperature and humidity and pressure
and one on the outside that see Outside temperature, humidity and pressure, I get to see a higher pressure difference.

When the fan is running, I really see the inside temp and humidity. Only when the fan is off, do I get actual outside temperature and humidity readings.

I'm still confused. The best way to get the best value from a sensor is using the average.
Using the highest value that a sensor gives will create extra noise.
How can the standard deviation create a better value then the average ?

simply put with Standard Deviation,
if you have 10 readings.
.30 .31 .31 .31 .31 31 .31 .31 .31 .31
your average is 0.309

if you have 10 readings
3 .01 .01 .01 .01 .01 .01 .01 .01 .01
the average is still 0.309

Standard Deviaion would be much different for the two data sets.
high concentration of readings around the average in the first
wide range of readings, low confidence that the numbers are near the average in the latter.

Since I am not looking for the average, but the greatest deviation from the ‘not-running’ value, the average is not as important. but you are correct that the standard deviation is little more than an ‘interesting’ exercise.

the fan might run for 4:02 minutes.
I sample every 2 minutes.
so, it would be possible that the fan could turn on,then sample1, sample2, sample3 and the fan goes off
sample would be 1, 1, 1

the fan might run for 3:58 minutes.
sample -then fan on -sample - fan off - sample. = 0, 1 ,0

in the first, the average is 3
on the latter, 0.33

in either event the average of the last 10 readings would not be more than half of the distance between running and off.

as for the sketch

// lowest value of fan ON = 0.08 and highest value of fan OFF = 0.03
deltaP = P1 - P2
if (deltaP <= .5){
deltaP = 0;
}

Serial.print(deltaP);

this would result in a very short and simple sketch.
the output would be 0 or some higher reading
I could just use OFF and ON

but since summer just started and I am just getting this together, and on-line data storage is free…
getting the actual numbers will offer some confidence in the future.

as a note, I also have a current sensor ready to put in.
my thoughts are that presence of power does not dictate movement of air.
I have had too many leaf/dust/pollen clogged inlets to trust just power.

Thanks for the explanation. I understand it now, but I think that I would do it in a different way. What if there is a lot of wind or draft ? Or a large door is opened or closed with some force. You probably can measure such things as well.