When using devices with internal temperature sensors, such as the Arduino Nicla Sense ME or the Arduino MKR IoT Carrier, a common issue is inaccurate temperature readings due to self-heating. This happens because heat generated by other components on the device can affect the sensor, leading to higher readings than the actual ambient temperature. Factors like power supply, board positioning, and the specific code running on the device can increase the impact of this effect.
Calibrating the internal sensor can correct these inaccuracies, giving you more accurate temperature readings.
Steps to calibrate the temperature sensor
Measure the required offset
-
Turn on your board and let it operate for some time to allow the components to reach their normal operating temperature, ensuring any heat-related offset becomes noticeable.
-
Use a reliable external source to measure the room temperature, like a digital thermostat.
-
Compare the temperature reading from your sensor with the reading from the external source.
-
Subtract the sensor’s reading from the external source’s reading to calculate the offset.
Implement the offset in your sketch
Once you have determined the offset, you can adjust the temperature readings in your sketch. Locate the part of the code that retrieves the temperature value and subtract the offset. For example:
float temperature = sensor.readTemperature(); // Function to get temperature from the sensor
float offset = 5; // Your calculated offset
float calibratedTemperature = temperature - offset; // Apply the offset