Choosing the right Temperature Sensor for the ESP32 Project
There are plenty of different temperature sensors, some also include humidity, pressure, other sensors, uses I2C or SPI. Choosing the best sensor for ESP32.
Today we are going to go through the most popular ESP32-compatible temperature sensors, exploring a range of options to suit your specific needs. From basic temperature sensing with popular sensors like the DHT11 to more advanced solutions offering precision, we are going to through different temperature sensors compatible with ESP32, in groups from most popular to less popular sensors. We are going to review the following ESP32 Temperature sensors:
- BME / BMP Series
- AHT Series
- DHT Series
- DS18B20 Series
- SHT Series
- TMP Series
- Other Popular Temperature Sensors
BME / BMP Series #
BME and BMP sensors are manufactured by Bosch Sensortec. The "BME" in their names stands for "Bosch Sensortec Environmental.", while the "BMP" stands for "Bosch Sensortec Pressure.".
BME Series sensors usually come with temperature and atmospheric pressure sensors, while BMP models also include a humidity sensor. Also, some sensors come with a gas sensor.
Bosch Sensortec is a division of Bosch, a multinational engineering and technology company headquartered in Germany. Bosch Sensortec specializes in the development and production of sensors and sensor solutions for various applications, including automotive, consumer electronics, industrial, and IoT (Internet of Things).
The BME and BMP sensors offer high accuracy and reliability and provide valuable insights into air pollution and indoor environmental conditions, making them suitable for a wide range of applications, from weather monitoring to indoor air quality assessment.
BMP085 / BMP180 #
BMP280 / BME280 #
BMP388 / BMP390 #
BMP581 #
BME680 #
AHT Series #
The AHT series comprises digital temperature and humidity sensors manufactured by Aosong Electronics Co., Ltd., also known as AOSONG.
These sensors offer reliable and accurate measurements of temperature and humidity, making them suitable for a wide range of applications in both industrial and consumer electronics. They are known for their ease of use, low power consumption, and competitive pricing, making them popular choices for environmental sensing and climate control systems.
The AHT series sensors typically use the I2C (Inter-Integrated Circuit) communication protocol for interfacing with microcontrollers or other devices.
AHT10 #
AHT10 is the first sensor in the AHT series developed by the manufacturer. The AHT10 sensor provides moderate accuracy in temperature and humidity measurements, making it a cost-effective solution for various applications. ESP32 has an integrated I2C interface, therefore this sensor can be easily used with any ESP32. You can find more about AHT10, its wiring with the ESP32 and Code Examples in the AHT10 Sensors Page.
AHT20 #
Building upon the AHT10, the AHT20 offers improved accuracy in temperature and humidity measurements while maintaining low power consumption. Its faster response time makes it suitable for applications requiring quicker environmental data updates, providing enhanced performance compared to its predecessor. ESP32 has an integrated I2C interface, therefore this sensor can be easily used with any ESP32 board. You can find more details and code examples for integrating AHT20 with ESP32 in AHT20 Sensor Page.
AHT21 #
As the most advanced sensor in the series, the AHT21 has the highest accuracy in temperature and humidity measurements. It features low power consumption and the fastest response time among the three sensors, making it ideal for applications demanding precision. Even though it is priced higher, its performance should justify the investment. ESP32 has an integrated I2C interface, therefore this sensor can be easily used with any ESP32 development board.
DHT Series #
The DHT series sensors are commonly manufactured by various companies, but one of the prominent manufacturers is the same as for the AHT Series, the Aosong Electronics Co., Ltd., also known as AOSONG.
These sensors are popular due to their simplicity, affordability, and ease of use. It can be used with practically any controller, not only the ones that have I2C or SPI protocols, such as ESP32, as it is controlled with a single-wire digital interface. These sensors provide a convenient way to measure temperature and humidity. However, it's important to note that while they offer cost-effective solutions, they do not provide the same level of accuracy and reliability as more advanced sensors.
DHT11 #
The DHT11 sensor offers basic temperature and humidity measurements with moderate accuracy. It is an economical choice for simple environmental monitoring applications. Since this sensor uses a single-wire digital interface, you just need one digital input on your microcontroller such as ESP32.
DHT12 #
DHT21 #
DHT22 #
Dallas Series #
The DS18B20 series consists of digital temperature sensors manufactured by Maxim Integrated. Uses the 1-Wire protocol for communication therefore is suitable for a wide range of microcontrollers.
DS18B20 #
SHT Series #
SHT Series consists of several groups of digital temperature sensors. The SHT3x-D, SHT4x, and SHTCx series refer to various models of digital temperature and humidity sensors manufactured by Sensirion. The SHT series sensors typically offer higher accuracy in temperature and humidity measurements compared to the AHT and DHT series sensors. Sensirion's SHT series sensors often have lower power consumption compared to the AHT and DHT series sensors. However, all these improvements come at a higher price and, therefore are a less popular choice for hobbyist projects.
SHT3X-D Series #
The SHT3x-D Series offers reliable temperature and humidity sensing with good accuracy. It provides temperature accuracy typically around ±0.3°C and humidity accuracy around ±2% RH. These sensors are compact, supporting both I2C and SPI interfaces for communication. Suitable for a wide range of applications where moderate accuracy and reliability are required.
SHT30-D #
The SHT30-D sensor offers reliable temperature and humidity measurements with good accuracy. It provides temperature accuracy of ±0.3°C and humidity accuracy of ±3% RH.
SHT31-D #
Building upon the SHT30-D, the SHT31-D sensor provides enhanced accuracy in temperature and humidity measurements. It offers improved temperature accuracy of ±0.3°C and humidity accuracy of ±2% RH.
SHT35-D #
The SHT35-D sensor represents the highest level of performance in the series, offering superior accuracy in temperature and humidity measurements. It features a temperature accuracy of ±0.2°C and humidity accuracy of ±1.5% RH.
SHT4x Series #
Building upon the capabilities of the SHT3x-D Series, the SHT4x Series provides enhanced accuracy and performance. With improved temperature accuracy typically around ±0.2°C and humidity accuracy around ±1.5% RH, these sensors offer superior reliability. They maintain a similar compact form factor and support both I2C and SPI interfaces. Ideal for applications demanding higher accuracy and precision in temperature and humidity measurements.
SHT40 #
The SHT40 sensor represents a significant improvement over its predecessors, offering ultra-low power consumption and high reliability. It provides a temperature accuracy of ±0.2°C and humidity accuracy of ±1.5% RH
SHT41 #
Building upon the capabilities of the SHT40, the SHT41 sensor offers even higher accuracy and stability in temperature and humidity measurements. It features temperature accuracy of ±0.2°C and humidity accuracy of ±1.5% RH
SHTCx Series #
The SHTCx Series represents the latest advancements in temperature and humidity sensing technology. These sensors offer additional features and improvements compared to their predecessors. With further enhanced accuracy and possibly lower power consumption, they cater to applications requiring superior performance. Some models may also feature smaller form factors, making them suitable for space-constrained applications.
SHTC1 #
The SHTC1 sensor is an ultra-small digital temperature and humidity sensor designed for space-constrained applications. It offers high accuracy in temperature and humidity measurements, with temperature accuracy of ±0.3°C and humidity accuracy of ±3% RH
SHTC3 #
Building upon the capabilities of the SHTC1, the SHTC3 sensor offers enhanced accuracy and stability in temperature and humidity measurements. It features temperature accuracy of ±0.2°C and humidity accuracy of ±2% RH
TMP Series #
The TMP series sensors are a range of temperature sensors produced by Texas Instruments (TI), a leading semiconductor company. These sensors are designed to measure temperature accurately and are available in various formats, including analog and digital, with different levels of accuracy, resolution, and interface options.
TMP36 #
TMP102 #
TMP117 #
Other Popular Temperature Sensors #
Apart from the already discussed groups of temperature sensors, compatible with ESP32, there are a lot of other sensors, from different manufacturers. They are less popular than the ones we have discussed above but still are very popular and highly available on the market. They can also easily be used with ESPHome.
DPS310 #
HDC1080 #
MCP9808 #
MLX90614 #
MPL3115A2 #
MS5611 #
HTU21D #
Comparison #
To easily choose a suitable temperature sensor, you can find below a comparison table of all mentioned temperature sensors with specified communication protocol, if the sensor includes pressure, humidity or other sensors.
Sensor | Communication Protocol | Temperature Sensor | Pressure Sensor | Humidity Sensor | Other Sensor |
---|---|---|---|---|---|
BMP085/BMP180 | I2C or SPI | Yes | Yes | No | No |
BMP280/BME280 | I2C or SPI | Yes | Yes | BME280 Only | No |
BMP388/BMP390 | I2C or SPI | Yes | Yes | No | No |
BMP581 | I2C or SPI | Yes | Yes | No | No |
BME680 | I2C or SPI | Yes | Yes | Yes | Gas |
AHT10 | I2C | Yes | No | Yes | No |
AHT20 | I2C | Yes | No | Yes | No |
AHT21 | I2C | Yes | No | Yes | No |
DHT11 | Single-wire | Yes | No | Yes | No |
DHT12 | Single-wire | Yes | No | Yes | No |
DHT21 | Single-wire | Yes | No | Yes | No |
DHT22 | Single-wire | Yes | No | Yes | No |
DS18B20 | Single-Wire | Yes | No | No | No |
SHT30-D | I2C or SPI | Yes | No | Yes | No |
SHT31-D | I2C or SPI | Yes | No | Yes | No |
SHT35-D | I2C or SPI | Yes | No | Yes | No |
SHT40 | I2C or SPI | Yes | No | Yes | No |
SHT41 | I2C or SPI | Yes | No | Yes | No |
SHTC1 | I2C | Yes | No | Yes | No |
SHTC3 | I2C | Yes | No | Yes | No |
TMP36 | Analog | Yes | No | No | No |
TMP102 | I2C | Yes | No | No | No |
TMP117 | I2C, SMBus | Yes | No | No | No |
DPS310 | I2C | Yes | Yes | No | No |
HDC1080 | I2C | Yes | No | Yes | No |
MCP9808 | I2C | Yes | No | No | No |
MLX90614 | I2C | Yes | No | No | No |
MPL3115A2 | I2C | Yes | Yes | No | No |
MS5611 | I2C | Yes | Yes | No | No |
HTU21D | I2C | Yes | Yes | No | No |
Internal Temperature Sensor #
Since we are talking about ESP32 temperature sensors, we must mention the Internal ESP32 Temperature Sensor. It measures the chip's temperature itself (think like CPU), instead of the environment. These sensors are included in most of the ESP32 versions. You can find more information in our post "Measuring ESP32 capabilities with Inbuilt Temperature Sensor".
Conclusion #
Throughout this guide, we've explored a variety of ESP32-compatible temperature sensors, from the beginner-friendly DHT11 to more advanced solutions like the BME680 and DS18B20.
No matter the complexity of your project or the level of precision required, there's a temperature sensor compatible with the ESP32 to suit your needs. By understanding the features and capabilities of each sensor, you can make informed decisions about which one best fits your requirements.
Whether you're monitoring environmental conditions, controlling HVAC systems, or implementing temperature-based automation, there are plenty of temperature sensor options compatible with any ESP32.