Skip to content

Instantly share code, notes, and snippets.

@xxlukas42
Last active April 21, 2024 04:16
Show Gist options
  • Save xxlukas42/7e7e18604f61529b8398f7fcc5785251 to your computer and use it in GitHub Desktop.
Save xxlukas42/7e7e18604f61529b8398f7fcc5785251 to your computer and use it in GitHub Desktop.
Arduino source code for ESP32 internal temperature sensor and hall sensor
void setup() {
Serial.begin(115200);
}
void loop() {
int measurement = 0;
measurement = hallRead();
Serial.print("Hall sensor measurement: ");
Serial.println(measurement);
delay(1000);
}
#ifdef __cplusplus
extern "C" {
#endif
uint8_t temprature_sens_read();
#ifdef __cplusplus
}
#endif
uint8_t temprature_sens_read();
void setup() {
Serial.begin(115200);
}
void loop() {
Serial.print("Temperature: ");
// Convert raw temperature in F to Celsius degrees
Serial.print((temprature_sens_read() - 32) / 1.8);
Serial.println(" C");
delay(5000);
}
@Resner
Copy link

Resner commented Mar 2, 2022

@kickass42zer0 Thanks for your implementation! To format code in Markdown, you need to enclose your code in between 3 backticks.

```
like so
second line etc.
```

@An-Toha
Copy link

An-Toha commented Aug 31, 2022

Hello, I have change the Arduino sketch for internal temperature sensor ESP32 CPU little bit.
https://gist.github.com/An-Toha/5a53f4fbe571c1b9cf02b362a83e93df
(Don't know how properly put code here)
The main ideas are:
to ignore 53.3 (128 before converting to Celsius);
WiFi must be connected, if else you'll get 53.3 (128) only.
Tested in AI Thinker ESP32 Cam module. Can be add to standard camera example in Arduino.
While ESP32 Cam module was idle - the temperature was around 47C. One value per 10-15 sec while idle.
While camera video stream was on - the temperature was rising to around 57
C.
See temperature values in serial monitor at 115200.
Best regards, Anton S
ESP32_selftemp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment