> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.stereolabs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.stereolabs.com/_mcp/server.

# Temperature Sensors Overview

According to the model of the ZED Camera you are using, you can access different temperature information
from sensors located in various areas of the PCB. These sensors monitor the thermal state of different
components on the board and adjust their calibration parameters if necessary.

> **Note**
>
> The ZED Mini camera has no temperature sensors onboard.

## Output Data

The following temperature information is accessible from the camera sensor stack:

| Output Data        | Description                                                                                       | Units | Max Frequency | Note                  |
| ------------------ | ------------------------------------------------------------------------------------------------- | ----- | ------------- | --------------------- |
| Left Image Sensor  | Temperature measured by the onboard temperature sensor located next to the **Left Image Sensor**  | °C    | 25 Hz         | Only ZED 2i           |
| Right Image Sensor | Temperature measured by the onboard temperature sensor located next to the **Right Image Sensor** | °C    | 25 Hz         | Only ZED 2i           |
| IMU                | Temperature measured by the sensor available inside the **IMU**                                   | °C    | 400 Hz        | ---                   |
| BAROMETER          | Temperature measured by the sensor available inside the **Barometer**                             | °C    | 25 Hz         | Only ZED 2 and ZED 2i |

## Using the API

To access the temperature measurements of these sensors, use the code below.

**`C++`**

```cpp C++
SensorsData::TemperatureData temperature_data;
temperature_data = sensors_data.temperature;
float temperature_left, temperature_right, temperature_imu, temperature_barometer;
temperature_data.get(SensorsData::TemperatureData::SENSOR_LOCATION::ONBOARD_LEFT, temperature_left);
temperature_data.get(SensorsData::TemperatureData::SENSOR_LOCATION::ONBOARD_RIGHT, temperature_right);
temperature_data.get(SensorsData::TemperatureData::SENSOR_LOCATION::IMU, temperature_imu);
temperature_data.get(SensorsData::TemperatureData::SENSOR_LOCATION::BAROMETER, temperature_barometer);
```

**`Python`**

```python Python
temperature_data = sensors_data.get_temperature_data()
temperature_left = temperature_data.get(sl.SENSOR_LOCATION.ONBOARD_LEFT)
temperature_right = temperature_data.get(sl.SENSOR_LOCATION.ONBOARD_RIGHT)
temperature_imu = temperature_data.get(sl.SENSOR_LOCATION.IMU)
temperature_barometer = temperature_data.get(sl.SENSOR_LOCATION.BAROMETER)
```

**`C#`**

```csharp C#
float temperature_left, temperature_right, temperature_imu, temperature_barometer;
temperature_left = sensors_data.temperatureSensor.onboard_left_temp;
temperature_right = sensors_data.temperatureSensor.onboard_right_temp;
temperature_imu = sensors_data.temperatureSensor.imu_temp;
temperature_barometer = sensors_data.temperatureSensor.barometer_temp;
```

> **Note**
>
> If the temperature sensor is not available, a **`NaN`** value is returned.

## Use the sensor to compensate for temperature drift

> **Note**
>
> This guide does not apply to the ZED Mini model as it lacks onboard temperature sensors.

When the ZED SDK opens the camera, it performs a quick *self-calibration* procedure to compensate for minor optical changes due to temperature variations or strong vibrations, which can affect stereo calibration accuracy.

If the camera is used for extended periods of time, internal temperature changes may occur, requiring a new self-calibration to maintain accurate stereo calibration.

You can use the temperature sensor measurements to monitor the internal temperature and trigger a new self-calibration by calling the API function `updateSelfCalibration`.

**`C++`**

```cpp C++
// Global variables
sl::Camera zed;
float ref_temp = -273.15f;
bool temp_ref_updated = false;
const float TEMP_THRESHOLD = 10.0f;


[...]

// Check the temperature periodically (e.g. every 5 minutes)
sl::SensorsData sensors_data;
zed.getSensorsData(sensors_data);
temp_ref_updated = temperature_changed(sensors_data);
if(temp_ref_updated) {
    zed.updateSelfCalibration();
}

[...]

// This is the function to control if the temperature changed with respect to a reference point
bool temperature_changed(const SensorsData& sensors_data) {
    float curr_temp;
    auto temperature_data = sensors_data.temperature;

    // Read the current internal temperature from the IMU sensor.
    temperature_data.get(sl::SensorsData::TemperatureData::SENSOR_LOCATION::IMU, curr_temp);

    if(fabs(curr_temp - ref_temp) > TEMP_THRESHOLD) {
        ref_temp = curr_temp;
        return true;
    }
    return false;
}
```

**`Python`**

```python Python

zed = sl.Camera()
ref_temp = -273.15
temp_ref_updated = False
TEMP_THRESHOLD = 10.0

[...]

# Check the temperature periodically (e.g. every 5 minutes)
sensors_data = sl.SensorsData()
zed.get_sensors_data(sensors_data, sl.TIME_REFERENCE.CURRENT)
temp_ref_updated = temperature_changed(sensors_data)
if temp_ref_updated:
  zed.update_self_calibration()

[...]

def temperature_changed(sensor_data):
  global ref_temp
  temperature_data = sensor_data.get_temperature_data()
  curr_temp = temperature_data.get(sl.SENSOR_LOCATION.IMU)
  if abs(curr_temp - ref_temp) > TEMP_THRESHOLD:
    ref_temp = curr_temp
    return True
  return False
```

**`C#`**

```csharp C#

sl.Camera zed = new sl.Camera(0);
float refTemp = -273.15f;
bool tempRefUpdated = false;
float TEMP_THRESHOLD = 10.0f;

[...]

// Check the temperature periodically (e.g. every 5 minutes)
sl.SensorsData sensorsData = new sl.SensorsData();
zed.GetSensorsData(ref sensorsData, TIME_REFERENCE.CURRENT);
tempRefUpdated = TemperatureChanged(ref sensorsData);
if (tempRefUpdated)
{
  zed.UpdateSelfCalibration();
}

[...]

// This is the function to control if the temperature changed with respect to a reference point
bool TemperatureChanged(ref SensorsData sensorsData)
{
  var temperatureData = sensorsData.temperatureSensor;
  float currTemp = temperatureData.imu_temp;
  if (Math.Abs(currTemp - refTemp) > TEMP_THRESHOLD)
  {
    refTemp = currTemp;
    return true;
  } 
  return false;
}
```

> **Warning**
>
> If your code internally uses the intrinsic and extrinsic parameters of the camera, ensure you use the `temp_ref_updated` variable and update them after the next `grab` using the `getCameraInformation` function.