PatrickE94 / pycalima

Python interface for Pax Calima Fan via Bluetooth LE
Apache License 2.0
43 stars 22 forks source link

Humidity values #10

Open ACrazyConcept opened 5 years ago

ACrazyConcept commented 5 years ago

I don't know if the recent patch changed how humidity was read or if I just hadn't noticed before but I get this from fan.getState() :

FanState(Humidity=216, Temp=26.5, Light=8, RPM=0, Mode='Trickle ventilation')

Obviously it cannot be the relative humidity. So wonder what it is ?

PatrickE94 commented 5 years ago

Oh this I have forgotten. I think it's simply 21.6%. I had the Android app decompiled once to check how it handled the value. But I must have forgotten to actually document and/or convert the value. Let me get back to you on that!

ACrazyConcept commented 5 years ago

Awesome. But I think it is something else. It varies too much: image

PatrickE94 commented 5 years ago

Yeah right you are. That's a large change in value which makes me think this is not an encoding issue but rather understanding the value.

Reading a bit on humidity sensors leads me to think that the value might be logarithmic. And possibly not temperature compensated.

Try taking a value and do log2(value)*10. However, for me it's off by a lot. But the curve seems more right.

The app didn't give anything since the value is never used.

ACrazyConcept commented 5 years ago

Try taking a value and do log2(value)*10. However, for me it's off by a lot. But the curve seems more right.

I think you nailed it :D Comparing a few sample values the last 24hours, the result is now very much in line with my other sensor.

toast1234 commented 5 years ago

I have used that calculation for about a year now and it looks to be correct. E.g it roughly follow a different sensor that I from time to time had in the same environment. Also need to take care of value=0 reported in dry conditions by my fan.

PatrickE94 commented 5 years ago

For me the resulting value was quite off (36% readout Vs 60% real). However I'm contemplating if this value is the raw value (absolute) as given by the sensor and that it's not temperature compensated at all. I have not successfully found any good resources around temperature compensating the value, as almost all sensors do this natively before reporting the value.

ACrazyConcept commented 5 years ago

If it is a raw value of the amount of water in the air then air pressure (though not fluctuating as much as temperature) should also be factored in when calculating RH. Where did you read about the log conversion? I haven't come across that. But anyway this is good enough for me. I'm not running a lab here.

PatrickE94 commented 5 years ago

Took it as a clue from https://www.sciencedirect.com/topics/engineering/humidity-sensors

the logarithm of the resistance decreases linearly with RH

Seeing as the graph you sent fit the description it seemed testworthy.

However, as previously said, if this is the actual raw value from an absolute sensor, there is compensation to be done. I simply have not found any concrete information on how during my limited time searching.

I checked my sensors again today. Much less deviation when temperature rose (51% measured vs 59% actual). Another clue...

toast1234 commented 5 years ago

I also looked arround for how to calculate. But did not find any simple way of doing it. I saw a few Python solutions but cant judge if they are worth looking in to and if they can be reused. Maybe some parameters can be used with a fixed value. But I guess eaven small differens have an impact. I woundre how they do it in the sensors....

ACrazyConcept commented 5 years ago

I sent PAX support a mail. Let's see if they know themselves.

PatrickE94 commented 5 years ago

Nice!

My morning googling lead me to this paper and a reminder that resistance depends on temperature. Since my value improved with a rise in temperature I'm wildly guessing that the 1:1 ratio lies at 30C. However I have no idea with which value or curve to adjust with. Chemistry is not my strong suite, and as this seems dependent on material types etc I'm out of my league.

One solution is to "calibrate" it at a normal temperature and hope the deviation is not too large (showering raises the temperature).

PatrickE94 commented 5 years ago

I'm closer and closer to taking it apart to see if I can find a chip number or equivalent to identify the sensor and find the datasheet.

ACrazyConcept commented 5 years ago

PAX didn't even make an effort to understand what I was asking about. Just got a reply from the support script.