Page 1 of 1

Esp32S3 : Is it possible to get the temperature from the internal T° sensor with a decimal part ?

Posted: Tue Apr 29, 2025 1:35 pm
by ThomasESP32
Good afternoon,

I am using an Esp32S3 and I configured/installed the internal emperature sensor using the following lines :

temperature_sensor_handle_t TempSensor;
temperature_sensor_config_t temp_sensor_config;
float Temperature = 0.0f;
char Msg[COM_MSG_MAX_LEN];
uint8_t Length = 0;

temp_sensor_config = TEMPERATURE_SENSOR_CONFIG_DEFAULT(-10, 80);
temperature_sensor_install(&temp_sensor_config, &TempSensor);
temperature_sensor_enable(TempSensor);

Now, I would like to ask the internal temperature of the chip and get it with a decimal part.
So, I do the following thing :

temperature_sensor_get_celsius(TempSensor, &Temperature);
sprintf(Msg, (const char *)"\n%f", Temperature);
Length = strlen(Msg);

When I print the Msg variable, I can see the temperature containing a decimal part.
Unfortunately, this decimal part is always the same and the temperature changes degree by degree.

Do you think it is possible to see the decimal part changing ?
If yes, how to do it please ?

Best regards,

Thomas TRUILHE