I have adapted and written code for my home temperature project. It works a dream most of the time but sometimes the data is corrupted and I get bad readings.
10:00 2nd Floor data 24.0C 52%,
10:05 2nd Floor data -32.7C 111%,
10:10 2nd Floor data 24.0C 52%
13:45 3rd Floor data 24.4C 50%
13:50 3rd Floor data -25.0C 100%
13:55 3rd Floor data 24.4C 50%
I want to add two rules to my code that would eliminate all the obviously wrong readings I have captured so far.
The full code is here (too long to paste)
The two rules I want to add to the code are;
Do not use the reading as the float value IF:
- the humidity reading is over 100%
- the temperature reading is more than 10 degrees away from the current float value
With the humidity you can see that I have already limited bad readings where the humidity is over 128% by adapting the code for decoding the signal to look for a bit in the signal that is always 0. My attempts to take the reading value and compare it to a fixed value failed.
In relation to temperature the readings are received every minute so there should never be a very dramatic change. I found that trying to compare to a range of values that changes according to the current float value was beyond me.
Any help would be appreciated.
PS I tried to crack the CRC but it has turned out to be more difficult than I thought.
PPS I should also point out that the number of bad readings is very small, the last batch of data contained 1,254 readings, of which only 4 were bad. Still it mucks up my graphs!