Skip to content
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

[Feature Request]: use internal ESP32, NRF52, RP temperature sensor of RTC #3883

Closed
roha-github opened this issue May 14, 2024 · 8 comments
Closed
Labels
enhancement New feature or request

Comments

@roha-github
Copy link

Platform

NRF52, ESP32, RP2040

Description

Idea: use the internal temperature sensor of the Real Time Clock (RTC) as a temperature sensor.

RTC chips have an internal temperature sensor for ongoing calibration of the Real Time Clock. The internal sensor could be used to ( approximately) determine the temperature.

https://www.instructables.com/Temperature-Measuring-Without-Any-Sensors-in-NRF52/
https://docs.espressif.com/projects/esp-idf/en/stable/esp32s2/api-reference/peripherals/temp_sensor.html
https://learnembeddedsystems.co.uk/using-the-rp2040-on-board-temperature-sensor

@roha-github roha-github added the enhancement New feature or request label May 14, 2024
@roha-github roha-github changed the title [Feature Request]: use internal ESP32, NRF52 temperature sensor of RTC [Feature Request]: use internal ESP32, NRF52, RP temperature sensor of RTC May 14, 2024
@GUVWAF
Copy link
Member

GUVWAF commented May 14, 2024

"The ESP32-S2 has a built-in sensor used to measure the chip's internal temperature."

"it can measure the die temperature over the temperature range of the device. Linearity compensation can be implemented if required by the application."

"The temperature sensor works by measuring the voltage of a diode in the chip itself, so straight off the bat we aren’t really measuring the ambient room temperature. We are measuring the temperature of the chip itself instead."

You'll get a temperature that's (much) higher than the actual ambient temperature, and it's unknown how to compensate for it. I'm not sure how useful this really is.

@roha-github
Copy link
Author

You'll get a temperature that's (much) higher than the actual ambient temperature, and it's unknown how to compensate for it. I'm not sure how useful this really is.

It depends ... I have already used the RTC temperature sensor in projects. With a correction value you can adjust the measurement temperature to the little heating of the chip.

But with pure sensors, the MCU is almost always in sleep mode anyway and there is de facto no heating. The values are then +/-1°C and a good indicator of heat.

Btw you can also use LEDs as light sensors for certain circuits.

@caveman99
Copy link
Sponsor Member

any measurement close to the MCU board will have to be compensated, and the formula is non-linear, because the components produce constant heat. A sensor inside the MCU is even less useful. If you want to measure ambient temperature the sensors need to be put in a special ventillated enclosure away from the processing unit.

I know about these quirks because i have 2 DECT repeater plugs in my home router system that include an ambient sensor. the readings are pretty useless, even with offset configured.

@roha-github
Copy link
Author

roha-github commented May 14, 2024

@caveman99 This is about the possibility of enabling a temperature sensor WITHOUT additional hardware. I would leave it up to the user to decide exactly what this is and for what purposes it can be used.

Have you had any practical experience with the temperature sensors from RTC? What were your deviations from reality?

There is the sensor device type, which hopefully does not permanently heat the MCU and where the RTC temperature should be close to or equal to the ambient temperature.

@thebentern
Copy link
Contributor

A dirt cheap supported BMP180 or SHT temp i2c sensor can be added for little cost and effort. Trying to use problematic CPU temperatures isn't something that seems like a fruitful effort in the face of relatively easy alternatives.

@thebentern thebentern closed this as not planned Won't fix, can't repro, duplicate, stale May 14, 2024
@roha-github
Copy link
Author

@thebentern Everything is correct, more precise measurements could be determined with an external sensor. This makes less sense for permanently radioing routers in permanent TX. And of course any experienced hobbyist can solder on a few components and developers can program them into the firmware themselves.

What I particularly like about Meshtastic is that it's not just made for nerds. Without IT knowledge, users can buy one of the inexpensive devices and simply flash it via the web UI.

I have the feeling that I am being misunderstood here. RTC is an posible option e.g. for Heltec V3, the most used device in the wild.

@GUVWAF
Copy link
Member

GUVWAF commented May 14, 2024

What I particularly like about Meshtastic is that it's not just made for nerds. Without IT knowledge, users can buy one of the inexpensive devices and simply flash it via the web UI.

That's indeed nice. However, if a temperature sensor is included by default, those people expect it to be accurate. You can’t really say that you shouldn’t rely on it when it’s -20 degrees outside, but if it’s +20 degrees it might be accurate, depending on how busy your mesh and thus processor and radio is, etc.

@roha-github
Copy link
Author

As caveman99 says, the real temperature and the RTC temperature are not directly identical.

Instead of a simple correction value, you could also determine how the RTC temperature behaves depending on the proportion of deep / light sleep. The deviation depends on how much energy the MCU consumes in heat.

For the device type sensor or as an indicator for the temperature, this should be negligible. Btw, the battery voltage and the percentage of charge are also only approximated.

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

No branches or pull requests

4 participants