-
In the Port of the DOWDQ6 and Pico D4 variants of the ESP32 the esp library contains functions for the internal hall and temperature sensor however, on the ESP32-C3 Port these functions are missing from the esp lib. Were they moved or just not added? |
Beta Was this translation helpful? Give feedback.
Replies: 14 comments 34 replies
-
The ESP32-C3 has a temperature sensor but it doesn't have a hall sensor. At least there is no mention of a hall sensor in ESP32-C3 datasheet. If I understand the source code correctly, functions |
Beta Was this translation helpful? Give feedback.
-
I have CONFIG_IDF_TARGET_ESP32S3=y defined however it isn't present in my code |
Beta Was this translation helpful? Give feedback.
-
I want to add raw_temperature for ESP32C3 , How can we add it .I tried to use ESP32 code but getting below error |
Beta Was this translation helpful? Give feedback.
-
You right robert but as you're explain in july 2019 (old forum) the max temperature is 125C so 50C-60*C it's Ok! for Esp32 chipset.. So this value is to take with precaution... That's why for me it's more useable to have a sensor in the case and not to monitor the chipset ... |
Beta Was this translation helpful? Give feedback.
-
@ricksorensen and @everyone , I have added the code in modesp32.c file and build the firmware, Now I am able to read temperature only first time after hard resetting device after that continuously 0 value is coming. Also, the temperature value which is reading first time after hard resetting device is more than the actual value. Is there any way to fix both the issues?? ![]() CODE SCREENSHOT |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Thank you @robert-hh for the Support , I have added the above code in modesp32.c file and get the correct value of temperature. But after hard resetting the device, first time temperature reading is coming incorrectly. First time temperature value is coming as more than 60. Is there anyway to fix this issue? Please find the below screenshot ![]() Code Added in modesp32.c file #if CONFIG_IDF_TARGET_ESP32C3 STATIC mp_obj_t esp32_raw_temperature(void) { #endif |
Beta Was this translation helpful? Give feedback.
-
b.t.w: Which esp-idf version do you use, v5.0.2 or v5.0.4? There are quite a few changes to the temperature sensor code between the two versions. The actual main line version is v5.0.4. |
Beta Was this translation helpful? Give feedback.
-
I am using 5.0.4 currently ... but 5.0.2 seemed to work also ... maybe I
better check!
I am seeing what seems like a single spurious read after install --- but
today the values I read are 4deg C less than yesterday. Curious because it
is actually a bit warmer today externally. Maybe the range settings to
have an impact sometimes?
…On Wed, Dec 13, 2023 at 9:51 AM Robert Hammelrath ***@***.***> wrote:
b.t.w: Which esp-idf version do you use, v5.0.2 or v5.0.4? There are quite
a few changes to the temperature sensor code between the two versions. The
actual main line version is v5.0.4.
—
Reply to this email directly, view it on GitHub
<#10443 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA5QPQA6CNQE5WGKE7UFCLDYJHFGPAVCNFSM6AAAAAATUSXAISVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM3TQNBUGEZDE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***
com>
--
Rick Sorensen
***@***.***
651-470-5511
|
Beta Was this translation helpful? Give feedback.
-
The range setting will be changed by the esp-idf code depending on the actual temperature reading. The range at calling temperature_sensor_install() is just the starting point, and something in the middle range like 10,50 or 20,100 is a good starting choice. |
Beta Was this translation helpful? Give feedback.
-
Thanks --- looks good. I had come to pretty much the same start up. I did
add some test functions for playing with level (low and high) settings and
uninstall too ... but I think except for extreme low power requirements
(which probably should not heat up cpu much) an uninstall is may not be
needed.
Hope you get time this holiday to warm your fingers.
…On Wed, Dec 13, 2023 at 1:21 PM Robert Hammelrath ***@***.***> wrote:
This is my updated modesp32.c file, including support for ESP32S2 and
ESP32S3.
modesp32.zip
<https://github.com/micropython/micropython/files/13664756/modesp32.zip>
—
Reply to this email directly, view it on GitHub
<#10443 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA5QPQBBFGGCFEHPL2UAYTTYJH53NAVCNFSM6AAAAAATUSXAISVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM3TQNBWGMZTK>
.
You are receiving this because you were mentioned.Message ID:
***@***.***
com>
--
Rick Sorensen
***@***.***
651-470-5511
|
Beta Was this translation helpful? Give feedback.
-
Thanks. I compared a few C3 boards for their start temperature after having them settled together w/o power. There are differences of 2 °C (max - min) of the start value, which is about the room temperature. But the power consumption between boards of the same type varies as well slightly. Then ones with a higher start temperature and faster ramp up consume slightly more current. So it looks fine. |
Beta Was this translation helpful? Give feedback.
-
I will attempt that this weekend.
…On Thu, Dec 14, 2023 at 1:50 AM Robert Hammelrath ***@***.***> wrote:
@ricksorensen <https://github.com/ricksorensen> Do you want to make a PR
for it?
—
Reply to this email directly, view it on GitHub
<#10443 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA5QPQDSM23OTUSXX7LKUODYJKVVJAVCNFSM6AAAAAATUSXAISVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM3TQNJQGYZTS>
.
You are receiving this because you were mentioned.Message ID:
***@***.***
com>
--
Rick Sorensen
***@***.***
651-470-5511
|
Beta Was this translation helpful? Give feedback.
-
Once I figure out how to correct the format on the commit message I'll
update the request
…On Thu, Dec 14, 2023, 2:25 PM Robert Hammelrath ***@***.***> wrote:
In my last (not sent) version I renamed the function & object for
mcu_temperature to esp32_mcu_temperature() and esp32_mcu_temperature_obj as
well. This is just internal stuff in modesp32.c, so no need to change it.
Sorry for not mentioning before.
STATIC mp_obj_t esp32_mcu_temperature(void) {
static temperature_sensor_handle_t temp_sensor = NULL;
float tvalue;
if (temp_sensor == NULL) {
temperature_sensor_config_t temp_sensor_config = TEMPERATURE_SENSOR_CONFIG_DEFAULT(0, 80);
ESP_ERROR_CHECK(temperature_sensor_install(&temp_sensor_config, &temp_sensor));
}
ESP_ERROR_CHECK(temperature_sensor_enable(temp_sensor));
ESP_ERROR_CHECK(temperature_sensor_get_celsius(temp_sensor, &tvalue));
ESP_ERROR_CHECK(temperature_sensor_disable(temp_sensor));
return mp_obj_new_int((int)(tvalue + 0.5));
}
STATIC MP_DEFINE_CONST_FUN_OBJ_0(esp32_mcu_temperature_obj, esp32_mcu_temperature);
and
{ MP_ROM_QSTR(MP_QSTR_mcu_temperature), MP_ROM_PTR(&esp32_mcu_temperature_obj) },
—
Reply to this email directly, view it on GitHub
<#10443 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA5QPQFXUCZEULJRLPL3DZDYJNOB3AVCNFSM6AAAAAATUSXAISVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM3TQNJXGUYDS>
.
You are receiving this because you were mentioned.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
The ESP32-C3 has a temperature sensor but it doesn't have a hall sensor. At least there is no mention of a hall sensor in ESP32-C3 datasheet.
If I understand the source code correctly, functions
esp32.hall_sensor()
for reading the internal hall sensor and functionesp32.raw_temperature()
for reading the internal temperature are only available for the ESP32 but not for the ESP32-C3, ESP32-S2 or ESP32-S3. The code is here and is only added ifCONFIG_IDF_TARGET_ESP32
is defined. The code is not added whenCONFIG_IDF_TARGET_ESP32C3
is defined (which is the corresponding define for the ESP32-C3.)