# Pysense temperature and humidity not correct

• Hi,

I'm using the pysense for a project where i need ambient temperature and humidity.
But the temperature that I get is not quite right, 30 degrees +.

Is this normal?

Thanks,
Marvin

• hi guys,

Temperature compensation is probably a polynomial function:

• a first degree, T_ambient = a * T_sensor + b, and for this 2 points should be measured (ambient and sensor temperature) in order to find 'a' and 'b' coefficients
• maybe for some designs a 2nd degree is a better model, and in this case 3 points are required to find the 3 coefficients

This is points can be easily found reading the sensor temperature. The rest can be done in with a piece of paper, or Excel(Trendline) or Matlab/Octave.
To understand more, here is a general description of the compensation methods, for the SI sensor: https://www.silabs.com/documents/public/application-notes/AN1026-Si70xx-Temp-Sensor-Designers-Guide.pdf

• @cristobal There is no simple solution for the calibration, since it depends on many factors of the assembly, like open board or device in a box, orientation, airflow, .... Genrally I would assume, that multiplicative correction works better, but to know it well you have to make a test series.

• Hi @catalin
I'm not sure if a linear adjustment (e.g. -7 degrees) will work because in the other forum somebody mentioned that reducing to 75% of measured temperature worked better for him. Can't you do a calibration and simply add that to the pycom github libraries for the sensor, providing additionally adjusted_temperature values or something like that? (I assume that such calibration would not be very different from device to device, so that a general calibration solution could be found and implemented.)

• Hi @cristobal and @AptusMarvin,
You could use a simple temperature offset to correct SI7006A20 readout temperature, taking into consideration your application sleep regime.
So, start your app (transmit data, do go_to_sleep), and measure temperature, let's say you have 30 deg C, and your ambient is 23, so you have a 7 deg offset. Let the board enough for the ambient to transfer (at least 30 min). Use this offset to compensate temperature for the future readings.
Try this setup, in a different ambient (outside, or in the fridge), but also for at least 30 mins. The offset method should offer +/-1 deg of precision.
In my experiments, I've obtained 2 deg offset, for a simple python script which wakes up LoPy every 5 mins, and stays active 30 secs(sending some data over Wifi).

• My pysense is also measuring 29°C (MPL3115A2) or 32°C (SI7006A20) when the real ambient temperature is quite a few degrees lower (probably around 23-24°).
The sensor shield is is not in a case. I am using a GPy. This makes the temperature sensors totally unusable unfortunately.

• Ok, Marvin, this happens on my board, too. The sensor measures basically the thermal paddle which is connected with the PCB ground plane. I'll give more details on the topic: https://forum.pycom.io/topic/2001/pysense-accuracy

• No the ambient temperature measured is around 30 degrees all the time. It's not in a closed case. The pcb is quite hot due to the *py.

• Hi Marvin,

You're saying that the temperature obtained from the Pysense is 30 degrees more than the Ambient Temperature? Like, you're obtaining 55 degrees Celsius, instead of the ~25, that you probably have on your desk?

Could you give more details, do you have the Pysense in a closed case, battery is also inside? Together with LoPy(or any *py board) these are heat sources that are increasing temperature on the PCB.

Or maybe the sensor is broken, could you check humidity, also?