diff --git a/content/Hardware Support/Generic/Calibrate-the-internal-temperature-sensor-on-an-Arduino-device.md b/content/Hardware Support/Generic/Calibrate-the-internal-temperature-sensor-on-an-Arduino-device.md new file mode 100644 index 00000000..963eaa21 --- /dev/null +++ b/content/Hardware Support/Generic/Calibrate-the-internal-temperature-sensor-on-an-Arduino-device.md @@ -0,0 +1,32 @@ +--- +title: "Calibrate the internal temperature sensor on an Arduino device" +id: 4411202645778 +--- + +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 + +1. 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. + +1. Use a reliable external source to measure the room temperature, like a digital thermostat. + +1. Compare the temperature reading from your sensor with the reading from the external source. + +1. 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: + +```arduino +float temperature = sensor.readTemperature(); // Function to get temperature from the sensor + +float offset = 5; // Your calculated offset + +float calibratedTemperature = temperature - offset; // Apply the offset +``` diff --git a/content/Hardware Support/Shields and Carriers/How-to-calibrate-the-MKR-IoT-Carriers-temperature-sensor.md b/content/Hardware Support/Shields and Carriers/How-to-calibrate-the-MKR-IoT-Carriers-temperature-sensor.md deleted file mode 100644 index 737b05be..00000000 --- a/content/Hardware Support/Shields and Carriers/How-to-calibrate-the-MKR-IoT-Carriers-temperature-sensor.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -title: "How to calibrate the MKR IoT Carrier's temperature sensor" -id: 4411202645778 ---- - -The MKR IoT Carrier is equipped with a [HTS221](https://www.arduino.cc/en/Reference/ArduinoHTS221); which is a digital humidity and temperature sensor. However, when your temperature reading is inaccurate then a recalibration would assist in displaying a more accurate temperature. This can be easily adjusted by making small modifications to your code. - -## 1. Get Offset for Calibration - -Use another source to get the temperature of the room (e.g. Thermostat, Smartphone). Compare the temperature from your chosen source to the one of the HTS221 sensor by subtracting the two. Save the difference as your offset to be used for calibration adjustment. - -**Example:** Temperature reading from secondary source 28°C and the HTS221 sensor is 23°C. Therefore, (28°C - 23°C = 5°C) offset = 5°C. - -The example above would indicate that the HTS221 sensor is 5°C less than the actual temperature; therefore, we will offset the difference in the following sections. - -## 2. Calibrate the temperature - -Locate the variable in the loop function of your sketch to modify; this can be done using either following sketches but are not limited to: _Personal Weather Station_ project from Arduino Cloud or the ReadSensors sketch of the Arduino IDE under _File > Examples > MKRIoTCarrier > Sensor > ENV_HTS221 > ReadSensors._ - -``` - float temperature = carrier.Env.readTemperature(); -``` - -Depending if you need to calibrate your sensor higher or lower then you would add or subtract your offset to the return value of the function to be saved as your new temperature variable. However, for this guide we will continue to use the offset in the example above by subtracting as follows: - -``` - float temperature = carrier.Env.readTemperature()-5; -``` - -Now the temperature should be calibrated to a more accurate reading of your choosing. For more details on the HST221 library please visit their [GitHub webpage](https://github.com/arduino-libraries/Arduino_HTS221/blob/master/src/HTS.cpp#L87).