ESP32S3 : Temperature Sensor (T° out of range)

ThomasESP32
Posts: 229
Joined: Thu Jul 14, 2022 5:15 am

ESP32S3 : Temperature Sensor (T° out of range)

Postby ThomasESP32 » Wed Jan 10, 2024 10:04 am

Good morning,

I get a problem using the temperature sensor of the Esp32S3.
I am trying to use the sensor in order to measure an ambiant T° of -18°C or something near this T°.

My T° sensor is configured in the range [50; 125], and I would like the temperature_sensor_get_celsius method to tell
ESP_FAIL (Because the measured T° is outside the T° range°).

I configure the T° sensor this way :

temperature_sensor_config_t temp_sensor_config;
temperature_sensor_handle_t TempSensor;

temp_sensor_config = TEMPERATURE_SENSOR_CONFIG_DEFAULT(50, 125);
temperature_sensor_install(&temp_sensor_config, &TempSensor);
temperature_sensor_enable(TempSensor);
esp_err_t err = temperature_sensor_get_celsius(TempSensor, &Temperature);

However, the err is not 0xFFFF. The method answers 0x0000 but the Temperature given by the method is not correct.
Do you know what can happen ?

Best regards,

Thomas TRUILHE

ThomasESP32
Posts: 229
Joined: Thu Jul 14, 2022 5:15 am

Re: ESP32S3 : Temperature Sensor (T° out of range)

Postby ThomasESP32 » Wed Jan 10, 2024 10:58 am

Moreover, last time I did the test, the method sent me 0xFFFF as a result
and the firmware told the error message "Temperature out of range..." or something like that.

No (Today), I did the test again and I do not get the same result.
The error code is 0x0000 and the error message is not displayed anymore.
However, the T° measured is out of the range and the method gave me a strange/wrong value.

Thank you for your help,
If you have any idea

Nespressif
Posts: 76
Joined: Tue Sep 12, 2017 11:25 am

Re: ESP32S3 : Temperature Sensor (T° out of range)

Postby Nespressif » Wed Jan 10, 2024 12:25 pm

Hello, you can try this syntax

temperature_sensor_handle_t temp_handle = NULL;
temperature_sensor_config_t temp_sensor = {
.range_min = 20,
.range_max = 50,
};
ESP_ERROR_CHECK(temperature_sensor_install(&temp_sensor, &temp_handle));

axellin
Posts: 200
Joined: Mon Sep 17, 2018 9:09 am

Re: ESP32S3 : Temperature Sensor (T° out of range)

Postby axellin » Thu Jan 11, 2024 5:39 am

The issue is when the device is put in an environemnt that out of current
setting range, the API does not return any error but a wrong reading.
i.e. There is no way to know the out-of-range with certain devices.

ThomasESP32
Posts: 229
Joined: Thu Jul 14, 2022 5:15 am

Re: ESP32S3 : Temperature Sensor (T° out of range)

Postby ThomasESP32 » Thu Jan 11, 2024 8:25 am

Thank you for your answers,
so can you explain me when the API returns an error ?
In what case exactly ?

Best regards,

MicroController
Posts: 1725
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: ESP32S3 : Temperature Sensor (T° out of range)

Postby MicroController » Thu Jan 11, 2024 10:07 pm


Who is online

Users browsing this forum: Baidu [Spider] and 328 guests