best sensor failure algorithm

Efried

Active Member
Hello,
I came across that code for detecting sensor failures. Is there a TS equivalend for Humidity?
 
thanks
 
SET WSRPLY 0   // dunno why...
    SET RAM3 T3 // set variable 3 to the themperature
    TSTEQ TS3 0 // check if there was a temp. sensor failure
    SET RAM3 99  // if yes set variable 3 to 99
    WEBSET URL7 RAM3 //write variable 3 it to the server via get 
    SET WSRPLY 0  
    WEBSET URL5 H1  // no check for humidity?
  
 
There is no status check for Humidity, it is simply a variable resistance read by an A/D.
 
Humidity should only change slowly so as a sanity check take several readings over a few seconds and see if any diverges too much.
 
Efried said:
    SET RAM3 T3 // set variable 3 to the themperature
    TSTEQ TS3 0 // check if there was a temp. sensor failure
    SET RAM3 99  // if yes set variable 3 to 99
    WEBSET URL7 RAM3 //write variable 3 it to the server via get 
    SET WSRPLY 0  
    WEBSET URL5 H1  // no check for humidity?
 
 
 
Just a suggestion for improving the overall efficiency of everything, and making your code somewhat more efficient.
 
Since variables are 32-bits, and since temperature only takes 12 bits (and humidity at most 10 bits), it is actually quite easy (and efficient) to align one in the upper 16 bits (or, if t makes more sense to you, do it in decimal digits) - and send both temperature and humidity in the one webset call.
 
Eg,

Code:
    mul t3 1000 ram3   # align temperature in top digits
    add ram3 h1 ram3  # humidity is in lower 3 digits
    webset url7 ram3   # send ttttt0hhh  to server
 
CAI_Support said:
We could add a PLC command for reboot, if that is useful.
 
 
yes please, a hard reboot definitively helped to recover from the sensor failure- I will however use a second sensor in parallel in order to be sure, that the cable is ok.
 
Efried said:
I will however use a second sensor in parallel in order to be sure, that the cable is ok.
 
I do this in my weatherstation. I have two DS18B20 sensors in close proximity. I read both. If they are within half a degree of each other, I average them. If they are more than half a degree different, I use the one that is closest to the last reading and generate a warning message that I need to look at it. (So far, that condition has never happened, and hopefully it won't)
 
rossw said:
 
I do this in my weatherstation. I have two DS18B20 sensors in close proximity. I read both. If they are within half a degree of each other, I average them. If they are more than half a degree different, I use the one that is closest to the last reading and generate a warning message that I need to look at it. (So far, that condition has never happened, and hopefully it won't)
Well good luck. Btw do you have a reliable source for ds18b20 or else? It would be great having a website to check what sensor quality I have, entering its code. ?..
 
Efried said:
Well good luck. Btw do you have a reliable source for ds18b20 or else? It would be great having a website to check what sensor quality I have, entering its code. ?..
 
I buy the sensors 100 at a time either as raw TO92 devices, or assembled with stainless sleeves, cables and connectors.
For "sensor quality", I think if they work at all, they should be fine. They're all calibrated to within 0.5 deg before they exit the fab plant. I check each string before I send them out but apart from two DOA, I've never had one fail in service.
 
rossw said:
I buy the sensors 100 at a time either as raw TO92 devices, or assembled with stainless sleeves, cables and connectors.
For "sensor quality", I think if they work at all, they should be fine. They're all calibrated to within 0.5 deg before they exit the fab plant. I check each string before I send them out but apart from two DOA, I've never had one fail in service.
so do I, I'm not sure if there is plagiarism or if all of them are licensed by DS
 
Back
Top