Working with sensors
To relate to the physical world, we use sensors. For example, a button or a pot are sensors, but when we need to measure different phenomenaālet's say temperatureāwe can use a temperature sensor with a more advanced communication interface rather than a simple GPIO or ADC interface. In this section, we'll cover plenty of sensors with different communication interfaces to get familiar with those interfaces. Let's start with a popular temperature and humidity sensor, DHT11.
Reading ambient temperature and humidity with DHT11
DHT11 is a basic temperature and humidity sensor with a very low price tag. The operational voltage is between 3 and 5 V, so we can use it by directly connecting to our ESP32 without a need for a level shifter. The temperature range is 0-50Ā°C, with Ā±2Ā°C accuracy and 1Ā°C resolution. We can also use it to measure humidity between 20% and 90% with Ā±5% accuracy. It already comes calibrated...