Reading temperature and humidity
Reading temperature and humidity
I'm using an ESP32 Azure IoT Kit. I want to send temperature and humidity along as telemetry to my IoT hub.
I cannot find almost any information on how to do this. I came across one post here where someone refers to using uint8_t temprature_sens_read() (note that the word temperature is misspelled) and much to my surprise that worked. I've searched the code base in esp-idf and can't find a single file that defines that function. There is no include file, you just "extern" it in your .c file.
I still need to get humidity. I haven't found any documentation or samples about that.
Am I reading temperature the right way? How do I get humidity?
Thanks,
David
P.S. I'm surprised the temperature reading is in F. I'd think C would be a better worldwide standard, and I'm curious about the decision to report in F.
I cannot find almost any information on how to do this. I came across one post here where someone refers to using uint8_t temprature_sens_read() (note that the word temperature is misspelled) and much to my surprise that worked. I've searched the code base in esp-idf and can't find a single file that defines that function. There is no include file, you just "extern" it in your .c file.
I still need to get humidity. I haven't found any documentation or samples about that.
Am I reading temperature the right way? How do I get humidity?
Thanks,
David
P.S. I'm surprised the temperature reading is in F. I'd think C would be a better worldwide standard, and I'm curious about the decision to report in F.
Re: Reading temperature and humidity
I found this sample, which uses a very different approach than the function I found for temperature earlier.
Is this what is recommended?
https://github.com/espressif/esp-iot-so ... ain/main.c
Thanks,
David
Is this what is recommended?
https://github.com/espressif/esp-iot-so ... ain/main.c
Thanks,
David
Re: Reading temperature and humidity
temprature_sens_read is not what you want. It is for reading esp32 internal temperature.
Re: Reading temperature and humidity
Gotcha.temprature_sens_read is not what you want. It is for reading esp32 internal temperature.
In the samples, why are temp and humidity divided by 10?
Re: Reading temperature and humidity
I guess a better way to ask my question is, if my temperature reading is 30.4 C, why is it stored as 304?To convert to decimal
I assumed the values are stored with accuracy of 0.1, but as an integer because maybe they store better than floats.
Re: Reading temperature and humidity
Are you using the HTS221 temp/humid sensor ?
if so: https://github.com/espressif/esp-iot-so ... /README.md
if so: https://github.com/espressif/esp-iot-so ... /README.md
IT Professional, Maker
Santiago, Dominican Republic
Santiago, Dominican Republic
Re: Reading temperature and humidity
I didn't realize I am, but I am. I took a second look at the spec sheet to confirm. I'm new to MCUs and honestly don't know many things, but I'm learning.Are you using the HTS221 temp/humid sensor ?
if so: https://github.com/espressif/esp-iot-so ... /README.md
I got a solution working yesterday, but the instructions didn't work. I resorted to copying the relevant components to my project component directory, and it finally built.
Re: Reading temperature and humidity
Post what you need.
Post what you have tried.
we'll help where we can.
Tom
Post what you have tried.
we'll help where we can.
Tom
IT Professional, Maker
Santiago, Dominican Republic
Santiago, Dominican Republic
Who is online
Users browsing this forum: Bytespider, meta-externalagent and 7 guests