Hi,
This can be done when taking your use case specifications into account.
For example, your use case envisions temperatures between -17°C up to 50°C, and requires a resolution of 0.5°C for freezing temperatures, and 1°C for positive temperatures.
So your full temperature range is then, say, [-20°C, 55°C].
- From -20°C until 0°C there are 41 possible values: -20, -19.5, -19, ... -1, -0.5, 0
- Above 0°C there are 55 possible values: 1, 2, 3, 4, ..., 54, 55.
This gives a total of 96 different values. Every temperature value you measure can thus be mapped to an integer value between 0 and 95. This requires 7 bits for storage. You still have some integers left to indicate extreme temperatures that are not covered by your full use case-specific temperature range.
The code can be adapted to follow this sequence:
- measure temperature
- map value to a number in the range [0..95]
- store the 7-bit number
Another option is to store the difference between successive temperatures only. Depending on your thermal resistance, you can check what the maximum possible temperature change is between two measurements. Perhaps this is only 10 degrees. Then you need to find a system that can store full temperatures once in a while, and store differences most of the time.
Last, a word of caution. The compression library used in the demo application will not yield the same compression ratio for all data sets: depending on the temperature changes experienced, the compression may be better - or much worse.
Kind regards,
Dries.