Page 1 of 1

Reading values of Onboard Temperature sensor

Posted: Mon May 28, 2018 4:31 pm
by AmulKetR
Hello all,

I have been testing on board Temperature sensor. I followed the reference from an arduino example. I have used the predefined function "temprature_sens_read()" and got constant temperature as the result irrespective of how warm or cold the module is. It is not the issue of the module, as I have tested the code with more than one dev kit. I am using a basic ESP32 dev kit to test the temperature sensor.

I have integrated my code into Hello_world and the result is as follows:
This is ESP32 chip with 2 CPU cores, WiFi/BT/BLE, silicon revision 1, 4MB external flash
Temp: 53.333332 Celsius...
Temp: 128 F...
Restarting in 10 seconds...
Temp: 53.333332 Celsius...
Temp: 128 F...
Restarting in 9 seconds...
Temp: 53.333332 Celsius...
Temp: 128 F...
Restarting in 8 seconds...
Temp: 53.333332 Celsius...
Temp: 128 F...
Restarting in 7 seconds...
Temp: 53.333332 Celsius...
Temp: 128 F...
Restarting in 6 seconds...
Temp: 53.333332 Celsius...
Temp: 128 F...
Restarting in 5 seconds...
Temp: 53.333332 Celsius...
Temp: 128 F...
Restarting in 4 seconds...
Temp: 53.333332 Celsius...
Temp: 128 F...
Restarting in 3 s
It would be great if if some one can give any API reference to read the temperature values correctly.
To my knowledge, there is no Hardware or API reference for on board temperature sensor mentioned in ESP-IDF documentation.

Thanks in advance :)

Re: Reading values of Onboard Temperature sensor

Posted: Wed May 30, 2018 4:55 pm
by fly135
Where do you find the temperature_sens_read function? Doesn't appear to be in my SDK.

John A

Re: Reading values of Onboard Temperature sensor

Posted: Mon Jun 04, 2018 9:19 am
by AmulKetR
Hello John,
I followed the below tutorial
https://github.com/pcbreflux/espressif/ ... sensor.ino

Thank you for the reply. I was able to flash the code. All I did is intergrate into hello_world program.
The Temperature values displayed were too high(around 128 F).

Amulya K

Re: Reading values of Onboard Temperature sensor

Posted: Mon Jun 04, 2018 12:47 pm
by loboris
The exaple code in test_tsens.c can also used for reading the internal temperature sensor.
It looks like temprature_sens_read() function from librtc.a always returns 128 with the latest master esp-idf.