Hello ESP32 how warm is it to you?

juebec
Posts: 2
Joined: Tue Mar 05, 2019 7:58 pm

Hello ESP32 how warm is it to you?

Postby juebec » Thu Mar 07, 2019 6:11 pm

Sorry,
I ask again for the ESP32 internal temperature sensor.
I've read the internet ;-) and found many blogs that get 128 ° F or 53.33 ° C as Arduino output.
e.g. this code "espressif/esp32/arduino/sketchbook/ESP32_int_temp_sensor/ESP32_int_temp_sensor.ino"

That the sensor is inaccurate, I can not determine.
It always shows the same temperature, even with different ESPs and also when I heat up the ESP32 with the hair dryer.

If I "mix" the program with the example: WiFiScan, I get a start value of 66.00 ° C, which rises to 75.00 ° C in one minute. Again, the hair dryer does not help ;-).

Code: Select all

// Wifi + intTemp _Ergebniss: int.temp from 156F to 168F
/*
 *  This sketch demonstrates how to scan WiFi networks.
 *  The API is almost the same as with the WiFi Shield library,
 *  the most obvious difference being the different file you need to include:
 */

 /*
github : pcbreflux/espressif
espressif/esp32/arduino/sketchbook/ESP32_int_temp_sensor/ESP32_int_temp_sensor.ino

*/
#include "WiFi.h"

#include <time.h>
#include <sys/time.h>

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

#ifdef __cplusplus
}
#endif


void setup()
{
    Serial.begin(115200);

    // Set WiFi to station mode and disconnect from an AP if it was previously connected
    WiFi.mode(WIFI_STA);
    WiFi.disconnect();
    delay(100);

    Serial.println("Setup done");
    
    tzset();
}
uint8_t temp_farenheit;
float temp_celsius;
char strftime_buf[64];
time_t now = 0;
struct tm timeinfo;
char buf[256];

void loop()
{
    Serial.println("scan start");

    // WiFi.scanNetworks will return the number of networks found
    int n = WiFi.scanNetworks();
    Serial.println("scan done");
    if (n == 0) {
        Serial.println("no networks found");
    } else {
        Serial.print(n);
        Serial.println(" networks found");
        for (int i = 0; i < n; ++i) {
            // Print SSID and RSSI for each network found
            Serial.print(i + 1);
            Serial.print(": ");
            Serial.print(WiFi.SSID(i));
            Serial.print(" (");
            Serial.print(WiFi.RSSI(i));
            Serial.print(")");
            Serial.println((WiFi.encryptionType(i) == WIFI_AUTH_OPEN)?" ":"*");
            delay(10);
        }
    }
    Serial.println("");

    localtime_r(&now, &timeinfo);
    strftime(strftime_buf, sizeof(strftime_buf), "%c", &timeinfo);
    sprintf(buf,"scan start %02d:%02d:%02d ",timeinfo.tm_hour,timeinfo.tm_min,timeinfo.tm_sec);
    Serial.print (buf);

    temp_farenheit= temprature_sens_read();
    temp_celsius = ( temp_farenheit - 32 ) / 1.8;
    Serial.print("Temp onBoard ");
    Serial.print(temp_farenheit);
    Serial.print("°F ");
    Serial.print(temp_celsius);
    Serial.println("°C");
    delay(1000);
    now++;

    // Wait a bit before scanning again
    delay(5000);
}
Please check if the c-program queries the correct memory area.[/Codebox]

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: Hello ESP32 how warm is it to you?

Postby ESP_Angus » Thu Mar 07, 2019 11:06 pm

Unfortunately, official support for the internal temperature sensor was removed some time ago as it's not accurate. It's not mentioned in the datasheet any more, and the temprature_sens_read() function is not in any header file (this is why it needs to be independently declared in the sketch you posted).

However, it does look like at some point the sensor became *much* less accurate than before. Older versions of IDF get more reasonable seeming values that change based on the environment around the ESP32.

I'll check if this functionality can be restored. However, it may not be possible.

juebec
Posts: 2
Joined: Tue Mar 05, 2019 7:58 pm

Re: Hello ESP32 how warm is it to you?

Postby juebec » Fri Mar 08, 2019 7:40 pm

Thanks for the information. I hope you can turn it on again. Please consider the solution that I can only do something Arduino ;-)
There are many high temperature locations that require additional cooling. By covering the ESP32 with the aluminum sheet, it may be warmer under the sheet than an external sensor can measure outside.
It would be all the more important to measure the internal temperature and then turn on additional cooling.
If I have to set the offset for every single ESP32, that's ok. Immediately after switching on, the displayed temperature should be equal to the room temperature. I store the difference (once) with a program in non-volatile memory.
So I can always calculate the individual value in other programs.
If the sensor error is not linear, you may be able to develop a Nutrition formula and thus output a PWM for a fan ...
This is a suggested solution, unfortunately I can not program it!

joseluu
Posts: 1
Joined: Sat Mar 12, 2022 10:27 pm

Re: Hello ESP32 how warm is it to you?

Postby joseluu » Sat Mar 12, 2022 10:29 pm

The code mentionned here seem to work:
https://github.com/ubirch/arduino-esp32 ... p32-temp.c

Just paste it into your arduino sketch.

User avatar
ESPBoards
Posts: 6
Joined: Wed Jan 17, 2024 9:05 pm

Re: Hello ESP32 how warm is it to you?

Postby ESPBoards » Wed Jan 17, 2024 9:10 pm

Depends on the ESP32 version (SoC) you are using, the 53 degrees output might just mean your ESP32 doesn’t have the internal temperature sensor.

Anyways, if you are using Arduino for programming, the legacy temperature sensor driver could work:
https://github.com/espressif/esp-idf/bl ... p_driver.c

More information and how to use the legacy driver, you can find here:
https://www.espboards.dev/blog/esp32-in ... re-sensor/
ESPBoards.dev - Everything about ESP32 and ESP8266 Development Boards - https://www.espboards.dev

Who is online

Users browsing this forum: No registered users and 43 guests