Skip to content

ESP32 internal temperature sensor not working #2422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nikisalli opened this issue Feb 4, 2019 · 20 comments
Closed

ESP32 internal temperature sensor not working #2422

nikisalli opened this issue Feb 4, 2019 · 20 comments

Comments

@nikisalli
Copy link

esp32 internal temperature sensor reading 128F (53.33C) continuously with both example codes i found:

https://github.com/pcbreflux/espressif/blob/master/esp32/arduino/sketchbook/ESP32_int_temp_sensor/ESP32_int_temp_sensor.ino

https://gist.github.com/xxlukas42/7e7e18604f61529b8398f7fcc5785251

my setup:
ESP32 Dev module
QIO
4MB flash
Pochi partition scheme
80Mhz flash speed
240Mhz WiFi/BT cpu speed
psram disabled

ide used: arduino ide 1.8.5 on windows 10

i already checked issue #625 and the solution there doesn't work
thanks in advance :)

@lbernstone
Copy link
Contributor

That function was deprecated long ago, and the temperature sensor is no longer included in the technical manual (since 06/2018). I'd guess the fact that it always returns 128 indicates that it is obsolete.

@nikisalli
Copy link
Author

Hi, thank you for the fast answer. How can i read the internal temperature sensor then? Isn't there a register method to read that data directly from the registers?

@lbernstone
Copy link
Contributor

You cannot. That's what obsolete means 😄

@buitre-buitaker
Copy link

buitre-buitaker commented May 6, 2019

For me is working, just using this code:

#ifdef __cplusplus
extern "C" {
#endif
uint8_t temprature_sens_read();
#ifdef __cplusplus
}
#endif
uint8_t temprature_sens_read();


Serial.print("Temperature: ");

// Convert raw temperature in F to Celsius degrees
Serial.print((temprature_sens_read() - 32) / 1.8);
Serial.println(" C");

@asetyde
Copy link

asetyde commented May 6, 2019

On new revision of chip esp32 is no present , on old yes. Check old issues. It's not affidable

@buitre-buitaker
Copy link

Do you me hal sensor or library method? What is not present?

@asetyde
Copy link

asetyde commented May 6, 2019

hardware temperature sensor on chip

@stale
Copy link

stale bot commented Jul 31, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label Jul 31, 2019
@JZ-SmartThings
Copy link

Using Heltec Wifi Kit 32 and getting the same result as the OP. This is definitely an issue and it should be left open until resolved.

@stale stale bot removed the Status: Stale Issue is stale stage (outdated/stuck) label Aug 11, 2019
@atanisoft
Copy link
Collaborator

@JZ-SmartThings file an issue with esp-idf for it. There is no supported hardware/software backing the API being requested.

@lbernstone
Copy link
Contributor

Should I start an auction for reclaimed v0 chips?

@asetyde
Copy link

asetyde commented Aug 13, 2019

it can not be resolved if there isn't hw !!! Close this

@nikisalli
Copy link
Author

Ok so apparently the new version of the chip doesn't come with an internal temperature sensor anymore so I'm closing this issue.

ThomasWaldmann added a commit to ThomasWaldmann/MultiGeiger that referenced this issue Nov 18, 2019
see espressif/arduino-esp32#2422

(and it seems they really had a typo "temprature" in the
API function while it was supported...)
UnexpectedMaker added a commit to tinypico/tinypico-micropython that referenced this issue Mar 27, 2020
…l temperature functions as Espressif have depreciated the functionality in newer silicon

Reference:
espressif/arduino-esp32#2422
@BetterAutomations
Copy link

This may be interesting to some of you. I'm testing a ESP32-WROVER-IE which contains a ESP32-D0WD-V3 and I'm not seeing 128. Seeing 126, and can consistently reduce it to 125 by blowing on it then back to 126 when I warm it with fingers. I think the temp sensor is still working even in later chip revisions.

@lbernstone
Copy link
Contributor

Probably more interesting is that the S2, C3 and S3 have fully functional temperature sensors.

@gotsila
Copy link

gotsila commented Jun 20, 2021

If you flash Tasmota Webserver 9.5.0 on it. it always works. using the example code above. it shows 128 or 53.33°
so i guess the sensor is already there.
but how can we use it under arduino? i don't know how to looking in the tasmota code

@beachmiles
Copy link

beachmiles commented Aug 11, 2022

I got the internal temp sensor working on esp32-s2 and esp32-c3 dev boards using the legacy temp sensor driver. Seems pretty spot on temps.

#include "driver/temp_sensor.h"    //legacy esp32 temp sensor driver. https://github.com/espressif/esp-idf/blob/master/components/driver/test_apps/legacy_rtc_temp_driver/main/test_rtc_temp_driver.c

void initTempSensor(){
    temp_sensor_config_t temp_sensor = TSENS_CONFIG_DEFAULT();
    temp_sensor.dac_offset = TSENS_DAC_L2;  //TSENS_DAC_L2 is default   L4(-40℃ ~ 20℃), L2(-10℃ ~ 80℃) L1(20℃ ~ 100℃) L0(50℃ ~ 125℃)
    temp_sensor_set_config(temp_sensor);
    temp_sensor_start();
}

//Run the initTempSensor() function once in setup function then get temps in main like this
float result = 0;
temp_sensor_read_celsius(&result); 

@Masoud1344
Copy link

I got the internal temp sensor working on esp32-s2 and esp32-c3 dev boards using the legacy temp sensor driver. Seems pretty spot on temps.

#include "driver/temp_sensor.h"    //legacy esp32 temp sensor driver. https://github.com/espressif/esp-idf/blob/master/components/driver/test_apps/legacy_rtc_temp_driver/main/test_rtc_temp_driver.c

void initTempSensor(){
    temp_sensor_config_t temp_sensor = TSENS_CONFIG_DEFAULT();
    temp_sensor.dac_offset = TSENS_DAC_L2;  //TSENS_DAC_L2 is default   L4(-40℃ ~ 20℃), L2(-10℃ ~ 80℃) L1(20℃ ~ 100℃) L0(50℃ ~ 125℃)
    temp_sensor_set_config(temp_sensor);
    temp_sensor_start();
}

//Run the initTempSensor() function once in setup function then get temps in main like this
float result = 0;
temp_sensor_read_celsius(&result); 

Realy does it work?

@adrianlzt
Copy link

C3 and S3 do have a temperature sensor.

The temperature sensor has a range of –40 °C to 125 °C. It is designed primarily to sense the temperature
changes inside the chip. The temperature value depends on factors like microcontroller clock frequency or I/O
load. Generally, the chip’s internal temperature is higher than the operating ambient temperature.

@lbernstone
Copy link
Contributor

New variants all have temperature sensors. The early revs of the esp32 do as well. There is a temperatureRead function in arduino core, but it will give you bad readings if you run it on an unsupported chip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests