Showing results for 
Search instead for 
Did you mean: 

condition check below low level

Associate II


I have question, I wanted to check whether a condition has reached below threshold level. How many check do I need to do whether it has reached the level below. Does it need to be three check or do a 20 check and average out to see if it below that level. Is there better way of doing ? alogortihm perhaps.


ST Employee


Do you mean a reading from ADC?

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Andrew Neil
Chief III

That all depends entirely on your particular situation,  application, and requirements - you haven't given enough information to make any specific suggestions.


Thanks for the reply. I am measuring liquid level. if it below the level with sensor readings. whether it has reached low level from the sensor. 

So think about the nature of the signal you're getting, and the nature of the system you're controlling:

  • How quickly does the signal change?
  • Does the signal "jitter" up and down?
  • Does it matter if you give a "low" indication a bit early/late?
  • etc, etc, ...

Yes, the signal spikes up and down suddenly. Yes it matter if the low indication a bit early. Because I am trying to measure the liquid ion level below the level. and it needs to be low enough for the test.

Hi Andrew,

Will it work if it implemented as a moving average as a condtion check


It definitely might work, depending on how bad the errors are.

If you are getting bad readings from a sensor of any kind, it would be better to address that problem directly rather than put a bandaid on it with an averaging scheme. Why are you getting bad readings? How do you know you can trust the other readings that aren't bad?

If you feel a post has answered your question, please click "Accept as Solution".

Thank you for reply. I am looking for stable conditon when its reached the below the level that I require. And then for example taking 20 readings reading and average it to see level is below.

Averaging 20 readings will definitely improve the accuracy of the result, if the level is stable. If you have the liberty of taking many readings, for instance if your application doesn't see fast changes in fluid level, it seems smart to average many readings together to improve accuracy.

But it really depends on your application, maybe this improvement isn't buying you anything.

If you feel a post has answered your question, please click "Accept as Solution".