arduino-ble-gadget
arduino-ble-gadget copied to clipboard
SHT4x
Greetings, I'm trying to find code for an ESP32 to send temp and humidity from my SHT4x to MyAmbiance. I see the example here but I can't figure out how to make it work. I have tried to cobble together the code from my CO2 sensor/esp 32 gadget I made but I'm obviously a total amature. I'm guessing I have to change the equation in the library, but like I said, I'm pretty clueless. I purchased the Sensirion SHT4x gadget but I want make my own since I don't think the button batteries are a good option for my application. Thank you. Diane Hallinen
For a gadget with only humidity and temperature you have to use a different data type. For SHT4x you need to use data type T_RH_V4. You also need to install the Arduino library for SHT4x: https://github.com/Sensirion/arduino-i2c-sht4x
What you need to adjust is the following (you should find the parts in e.g. the SCD4x example.
#include <SensirionI2CSht4x.h>
DataProvider provider(lib, DataType::T_RH_V4);
float temperature;
float humidity;
error = sht4x.measureHighPrecision(temperature, humidity);
provider.writeValueToCurrentSample(temperature, Unit::T);
provider.writeValueToCurrentSample(humidity, Unit::RH);
provider.commitSample();
If you are interested in the BLE protocol, you can find the documentation here: https://github.com/Sensirion/arduino-ble-gadget/blob/master/documents/Sensirion_BLE_communication_protocol.pdf
I hope this helps you implementing the gadget. Let me know if you need more help.
Best regards, Pascal
Thank you! I had been making up different data types, my mind reading skills stink!
I’ll work on it today. Thank you again!
Diane
On Oct 27, 2022, at 9:10 AM, Pascal Sachs @.***> wrote:
For a gadget with only humidity and temperature you have to use a different data type. For SHT4x you need to use data type T_RH_V4. You also need to install the Arduino library for SHT4x: https://github.com/Sensirion/arduino-i2c-sht4x
What you need to adjust is the following (you should find the parts in e.g. the SCD4x example.
#include <SensirionI2CSht4x.h>
DataProvider provider(lib, DataType::T_RH_V4);
float temperature; float humidity; error = sht4x.measureHighPrecision(temperature, humidity);
provider.writeValueToCurrentSample(temperature, Unit::T); provider.writeValueToCurrentSample(humidity, Unit::RH); provider.commitSample(); If you are interested in the BLE protocol, you can find the documentation here: https://github.com/Sensirion/arduino-ble-gadget/blob/master/documents/Sensirion_BLE_communication_protocol.pdf
I hope this helps you implementing the gadget. Let me know if you need more help.
Best regards, Pascal
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.