Last active
April 21, 2024 04:16
-
-
Save xxlukas42/7e7e18604f61529b8398f7fcc5785251 to your computer and use it in GitHub Desktop.
Arduino source code for ESP32 internal temperature sensor and hall sensor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setup() { | |
Serial.begin(115200); | |
} | |
void loop() { | |
int measurement = 0; | |
measurement = hallRead(); | |
Serial.print("Hall sensor measurement: "); | |
Serial.println(measurement); | |
delay(1000); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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); | |
} |
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 57C.
See temperature values in serial monitor at 115200.
Best regards, Anton S
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@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.
```