In this example we will connect a SHT20 temperature sensor to an ESP32.
Lets look at the SHT20 sensor
The SHT20 humidity and temperature sensor of Sensirion has become an industry standard in terms of form factor and intelligence: Embedded in a reflow solderable Dual Flat No leads (DFN) package of 3 x 3mm foot print and 1.1mm height it provides calibrated, linearized sensor signals in digital, I2C format.
The SHT2x sensors contain a capacitive type humidity sensor, a band gap temperature sensor and specialized analog and digital integrated circuit – all on a single CMOSens® chip. This yields in an unmatched sensor performance in terms of accuracy and stability as well as minimal power consumption.
Every sensor is individually calibrated and tested. Lot identification is printed on the sensor and an electronic identification code is stored on the chip – which can be read out by command. Furthermore, the resolution of SHT2 can be changed by command (8/12bit up to 12/14bit for RH/T) and a checksum helps to improve communication reliability.
Couldn't find a good part for fritzing
Its an I2C device that needs 3.3v and GND, so its not that difficult to wire
There is a library to make things easy and it is – https://github.com/DFRobot/DFRobot_SHT20
sht20.initSHT20(); // Init SHT20 Sensor
sht20.checkSHT20(); // Check SHT20 Sensor
float humd = sht20.readHumidity(); // Read Humidity
float temp = sht20.readTemperature(); // Read Temperature
Open the serial monitor and you should see something similar to this
End of battery: no
Heater enabled: no
Disable OTP reload: yes