Ability to calculate math


#1

I’ve been using the soil sensor a lot to determine if I am going to water in an upcoming series of scheduled events. I’ve noticed that sometimes it will capture a sample that is just out there. For example, I’d be expecting something between 700-900 and it would tell me 532.

Because of this I would like to perform one or two things.

  1. I’d like to be able to capture multiple samples and store their values in DATA_LABELs. Such as SENSOR_1, SENSOR_2, SENSOR_n. Then I’d like to average the values and store that in SENSOR_AVG.

  2. I’d like to be able to reject samples that seem to be way off. For example:

  • Read into SENSOR_1
  • Calculate SENSOR_AVG
  • Read into SENSOR_n
  • if SENSOR_n > SENSOR_AVG + 100 or SENSOR_n < SENSOR_AVG - 100
    • Skip calculating SENSOR_AVG (Throw this sample out)

I think that this would greatly reduce the chances of the sensor throwing a false positive.


#2

I so agree!
I am setting up my “GetPlotMoisture” sequence this week and I am noticing the same.
I will make an entry in the Sequences topic outlining my method and come back here and point to it.

My sequence structure is here:


#3

An simpler way to implement this might be to update the read sensor sequence command to take additional values such as:

  • number of samples (5)
  • sample delay ms (1000)
  • +/- threshold (100)

If these values were to default to number of samples (1) and +/- threshold (100) the system would act as it currently does.