OK @BulldogLowell, I have now seen also your Particle.variables, but I saw also that you use serial output:
if (i < MAXRETRY)
{
// Serial.println(_temp); // For debugging only!
}
else
{
_temp = NAN;
// Serial.println("Invalid reading"); // For debugging only!
}
I have removed those lines now and compiled/uploaded the sketch remotely.
The result was not as expected:
With @ric’s sketch I get this:
As the temperatures are not published, it seems not to work.
Also, the fact that you combined the sensors in pairs is clever in this particular application, but is something which will not always work for me:
Depending on the application, I want to be able to flexibly use any combination of 1, 2, 3, 4, 5, 6, 12, 20 … sensors and use as well the waterproof (12 bit DS18B20) type or the pcb-mount (8 bit DS18S20) type of sensors.
Remember one of my 2 important requirements:
- Must allow MANY sensors (DS18B20 and DS18S20 versions mixed) on the same I/O pin (around 25…)
Also this mixing of types is easy with @ric 's sketch.
Due to this use of sensors in pairs, the calculation of the energy content in your sketch is wrong: You calculate the energy in only 3 of the 6 zones (you only calculate 3 averages of the H and L sensors). And this is difficult to change unless you change it completely and don’t combine sensors in pairs.
In @Ric 's sketch, the series of sensor variables is created independently and from then I am free to use them as needed.
@BulldogLowell, I just saw your endeavour during lunch time and I am grateful for your help, but I believe this is getting a bit too complicated for me…
This is the simple filtering method, ensuring the “continuity” of the data, I have in mind:
- The current sketch updates the 6 temperatures every 5 seconds.
- The water temperature changes so slowly that the difference between samples is very small. False readings are either much bigger or smaller.
- Five sequential values are stored in an array, they are sorted, and then the middle value is picked and published as Particle.variable.
- This means that the extremes will never be published.
As I mentioned earlier, you can see details here: LINK.
Let’s first see how @Ric can integrate his QSORT filtering in his current sketch.
You called this trivial, but I think it is probably a good way to achieve my goal.
The proof of the pudding will be the eating…