For most new ESP32 and Home Assistant projects, the SHT40 is the best value: it is newer, smaller, faster, and consumes less power than the SHT31 while offering slightly better humidity accuracy. Choose the SHT45 when measurement accuracy matters most — its typical specifications reach ±1.0% RH and ±0.1°C. The older SHT31 remains an excellent sensor, especially when using existing hardware or when its wider 2.4–5.5 V supply range and mature ecosystem are useful. All three work well with ESPHome over I²C.

1. SHT31, SHT40 and SHT45 in one table
All three sensors are manufactured by Sensirion and measure:
- Temperature
- Relative humidity
However, SHT40 and SHT45 belong to the newer SHT4x generation, while SHT31 belongs to the older SHT3x generation. Sensirion describes the SHT4x family as using a new optimized CMOSens platform with reduced power consumption and improved accuracy.
| Feature | SHT31 | SHT40 | SHT45 |
|---|---|---|---|
| Sensor generation | SHT3x | SHT4x | SHT4x |
| Typical humidity accuracy | ±2% RH | ±1.8% RH | ±1.0% RH |
| Typical temperature accuracy | ±0.2°C | ±0.2°C | ±0.1°C |
| Humidity response time | ~8 s | ~4 s | ~4 s |
| Temperature response time | >2 s | ~2 s | ~2 s |
| Supply voltage | 2.4–5.5 V | 1.08–3.6 V | 1.08–3.6 V |
| Typical average current | ~1.7 µA | ~0.4 µA | ~0.4 µA |
| Interface | I²C | I²C | I²C |
| Heater | Yes | Yes | Yes |
| ESPHome support | Yes | Yes | Yes |
| Best for | Existing/general projects | Best value | Best accuracy |
The accuracy, response-time and power figures above are Sensirion’s specifications for the bare sensors rather than necessarily the entire breakout board they are mounted on.
2. SHT31: the established workhorse
The SHT31 has been around for years and remains one of the most widely used digital temperature and humidity sensors.
It sits in the middle of Sensirion’s SHT3x family:
- SHT30 → lower-cost
- SHT31 → standard
- SHT35 → higher accuracy
Sensirion rates the digital SHT31-DIS-B at a typical ±2% RH humidity accuracy and approximately ±0.2°C temperature accuracy.
That is already plenty accurate for applications such as:
- Home Assistant room monitoring
- HVAC control
- Greenhouses
- Bathrooms
- Bedrooms
- Weather stations
- Data logging
For normal home automation, the difference between ±2% RH and ±1% RH is rarely the difference between an automation working and failing.
3. Why SHT31 is still useful
The biggest advantage of the SHT31 today is not that it beats the newer sensors.
It is that it is:
- mature
- widely available
- well supported
- available on many breakout boards
- compatible with a broad supply range
The bare SHT31-DIS-B supports approximately 2.4 to 5.5 V, whereas the standard SHT40 and SHT45 devices operate from 1.08 to 3.6 V.
For an ESP32 this normally makes little difference because 3.3 V is ideal for all three.
But it can matter when building hardware around other microcontrollers or legacy systems.
4. SHT40: the modern replacement for most projects
The SHT40 is the sensor most readers should consider first when starting a new project.
It offers:
- newer SHT4x architecture
- lower power consumption
- faster humidity response
- slightly better humidity accuracy
- significantly smaller package
Sensirion specifies the standard SHT40 at:
Humidity: ±1.8% RH typical
Temperature: ±0.2°C typical
Its humidity response time is approximately 4 seconds, compared with roughly 8 seconds for the SHT31.
That makes the SHT40 a particularly attractive upgrade for responsive room monitoring.
5. SHT40 is much smaller
The physical difference is substantial.
SHT31
Approximately:
2.5 × 2.5 × 0.9 mm
SHT40
Approximately:
1.5 × 1.5 × 0.5 mm
The SHT40 is therefore dramatically smaller at chip level.
On breakout boards this difference may not be obvious because the PCB itself is much larger than either sensor.
For a custom PCB, however, the SHT4x generation is much easier to fit into very small devices.
6. SHT45: the accuracy winner
The SHT45 is the high-accuracy member of the standard SHT4x family.
Sensirion specifies typical accuracy of:
Humidity: ±1.0% RH
Temperature: ±0.1°C
That is significantly better than both the SHT31 and SHT40.
For comparison:
Humidity accuracy
SHT31 ±2.0% RH
SHT40 ±1.8% RH
SHT45 ±1.0% RH
and:
Temperature accuracy
SHT31 ±0.2°C
SHT40 ±0.2°C
SHT45 ±0.1°C
For applications where the absolute reading matters rather than just detecting trends, the SHT45 is the clear winner.
7. When does SHT45 accuracy actually matter?
For turning a bathroom fan on when humidity gets high, probably not much.
For deciding whether a bedroom is 47% or 49% RH, an SHT40 is already excellent.
SHT45 becomes more worthwhile for:
- calibration references
- environmental testing
- laboratory-style logging
- high-quality weather stations
- HVAC measurement
- museums or storage areas
- musical instrument storage
- humidity-sensitive materials
- comparing multiple rooms where sensor-to-sensor consistency matters
Sensirion specifically positions the SHT45 as its highest-accuracy SMD humidity option in this family.
8. Accuracy is not the same as resolution
This distinction often causes confusion.
A sensor may display:
23.417°C
but that does not mean the temperature is accurate to 0.001°C.
Resolution describes how finely the sensor can represent changes.
Accuracy describes how close the measurement is expected to be to the true value.
For choosing between SHT31, SHT40 and SHT45, the accuracy specification is usually much more useful than simply looking at the number of decimal places displayed by Home Assistant.
9. Power consumption: SHT40 and SHT45 win
For battery-powered ESP32 sensors, the SHT4x generation has another major advantage.
Sensirion lists average supply current around:
SHT31 → 1.7 µA
SHT40 → 0.4 µA
SHT45 → 0.4 µA
The difference may sound tiny compared with an ESP32’s Wi-Fi current.
And during active Wi-Fi transmission, it is.
But in a carefully optimized deep-sleep node where the ESP32 sleeps for most of its life, every microamp starts to matter.
The SHT40 is therefore an excellent companion for an ESP32 deep-sleep battery sensor.
10. Which one is fastest?
Humidity changes more slowly than temperature on these sensors.
Sensirion specifies approximately:
| Sensor | Humidity response | Temperature response |
|---|---|---|
| SHT31 | ~8 s | >2 s |
| SHT40 | ~4 s | ~2 s |
| SHT45 | ~4 s | ~2 s |
The SHT40 and SHT45 therefore respond roughly twice as quickly to humidity changes under the specified test conditions.
This can be useful in:
- bathrooms
- HVAC ducts
- ventilation control
- greenhouse monitoring
But sensor placement is often more important than the theoretical response-time advantage.
11. Sensor placement can ruin an expensive sensor
Putting an SHT45 directly beside a warm ESP32 can easily create worse temperature readings than a properly positioned SHT31.
The ESP32 itself generates heat.
So do:
- voltage regulators
- USB-UART chips
- displays
- relays
- power supplies
For accurate room-temperature measurements, keep the sensor:
- away from the ESP32
- away from the voltage regulator
- exposed to room airflow
- out of direct sunlight
- away from external walls where possible
Even moving the sensor several centimetres away from the ESP32 PCB can improve temperature measurements.
For the best results, mount the humidity sensor on a separate small PCB or cable.
12. I²C wiring with ESP32
All three sensors communicate over I²C.
For a classic ESP32 DevKit, the usual pins are:
| Sensor | ESP32 |
|---|---|
| VCC | 3V3 |
| GND | GND |
| SDA | GPIO21 |
| SCL | GPIO22 |
For other ESP32 families such as C3, C6, S2 or S3, the default pins may differ, although ESP32’s GPIO matrix usually allows I²C to be moved to other suitable GPIOs.
The safest approach for a breakout board is normally to power it from 3.3 V unless the specific breakout manufacturer explicitly documents otherwise.
A breakout board may contain regulators or level shifting that change its permitted input voltage, so the breakout specifications can differ from the bare Sensirion sensor.
13. I²C addresses
The SHT31 normally uses:
0x44
and can also support:
0x45
depending on how its address pin is configured. ESPHome’s SHT3x component defaults to 0x44 and documents 0x45 as the alternate SHT3x address.
Standard SHT4x ESPHome configurations also default to:
0x44.
However, Sensirion now produces SHT40 variants with alternative factory addresses such as 0x45 and 0x46, so the exact part number matters if several identical sensors need to share one I²C bus.
14. ESPHome configuration for SHT31
ESPHome has a native sht3xd component.
A simple configuration is:
i2c:
sda: GPIO21
scl: GPIO22
scan: true
sensor:
- platform: sht3xd
temperature:
name: "Room Temperature"
humidity:
name: "Room Humidity"
address: 0x44
update_interval: 60s
ESPHome supports both temperature and humidity entities, configurable update intervals, alternate I²C addresses and heater control.
Once the ESPHome node is added to Home Assistant, the two sensor entities appear automatically through the ESPHome integration.
15. ESPHome configuration for SHT40 or SHT45
SHT4x sensors use a different ESPHome platform:
i2c:
sda: GPIO21
scl: GPIO22
scan: true
sensor:
- platform: sht4x
temperature:
name: "Room Temperature"
humidity:
name: "Room Humidity"
address: 0x44
update_interval: 60s
The same ESPHome component works with the SHT4x family, including SHT40 and SHT45.
There is no separate:
sht40:
or:
sht45:
component.
Both use:
sht4x:
16. ESPHome measurement precision
ESPHome allows SHT4x measurement precision to be configured as:
- High
- Medium
- Low
The default is High.
For Home Assistant environmental monitoring, leaving it at High is usually sensible.
A typical configuration is:
sensor:
- platform: sht4x
temperature:
name: "Bedroom Temperature"
humidity:
name: "Bedroom Humidity"
precision: High
update_interval: 60s
There is little reason to request measurements every second for normal home climate monitoring.
An update every:
30–60 seconds
is normally more than sufficient.
17. What does the heater do?
All three families include heater functionality.
This is not intended to heat the room or provide normal temperature compensation.
Its main purpose is helping the sensor recover from:
- condensation
- very high humidity
- moisture on the sensing element
ESPHome warns that using the SHT3x heater can temporarily increase the reported temperature and reduce the reported humidity.
For SHT4x, ESPHome provides configuration for:
- heater power
- heater duration
- maximum heater duty cycle
and limits the configured maximum duty cycle to 5%.
For an ordinary indoor sensor, the heater should normally remain off.
18. Bathroom and condensation monitoring
For a bathroom, all three sensors can work very well.
The practical ranking would be:
1. SHT40
2. SHT45
3. SHT31
SHT40 provides excellent accuracy, faster humidity response and low cost without paying for accuracy that a bathroom fan automation probably does not need.
SHT45 is technically better but often unnecessary.
The heater functionality of SHT4x is also useful if the installation is exposed to extreme humidity or occasional condensation.
19. Best sensor for Home Assistant
For normal Home Assistant room monitoring:
Best overall
SHT40
Why:
- very accurate
- inexpensive
- low power
- faster than SHT31
- native ESPHome support
- readily available
Best accuracy
SHT45
Choose this when the extra accuracy is genuinely useful.
Best if already owned
SHT31
There is no reason to replace a functioning SHT31 simply because SHT40 exists.
Its ±2% RH and ±0.2°C typical performance is already excellent for most smart-home applications.
20. Best sensor for battery-powered ESP32 projects
Winner: SHT40
SHT40 and SHT45 both offer an average sensor current around 0.4 µA, compared with approximately 1.7 µA for the SHT31.
Since SHT40 is usually cheaper than SHT45 while retaining the same low-power architecture, it is the logical choice for:
- battery room sensors
- deep-sleep weather nodes
- greenhouse nodes
- remote temperature/humidity sensors
The ESP32’s sleep current and regulator choice will still dominate the overall design, so choosing an SHT40 cannot compensate for a development board that wastes milliamps while sleeping.
21. Best sensor for high accuracy
Winner: SHT45
The improvement is substantial:
Humidity
SHT31 ±2.0%
SHT40 ±1.8%
SHT45 ±1.0%
Temperature
SHT31 ±0.2°C
SHT40 ±0.2°C
SHT45 ±0.1°C
Sensirion’s published specifications make SHT45 the clear accuracy winner among these three.
22. Best value
Winner: SHT40
SHT40 reaches close to SHT45 performance while being positioned as the price-performance member of the SHT4x family. Sensirion itself describes the SHT40 in those terms.
For most hobbyists and Home Assistant users, paying extra for an SHT45 will not materially improve automations.
This makes the SHT40 the sweet spot.
23. Should an SHT31 be upgraded to SHT40?
Usually, no.
If an existing SHT31:
- reads consistently
- is positioned correctly
- agrees reasonably with other sensors
- is already integrated into Home Assistant
there is little practical reason to replace it.
The upgrade makes more sense when designing a new node, particularly if it is battery powered.
For a new project:
SHT40 > SHT31
For an existing working project:
Keep the SHT31.
24. Should an SHT40 be upgraded to SHT45?
Only when accuracy matters enough to justify it.
For normal climate automations:
If RH > 70% → fan ON
If RH < 60% → fan OFF
the extra ±0.8 percentage point typical humidity accuracy is unlikely to make a meaningful difference.
For comparative monitoring, calibration or scientific-style logging, the SHT45 is much easier to justify.
25. What about cheap breakout boards and fake sensors?
The sensor chip may be excellent while the breakout board is not.
Low-cost modules can introduce problems through:
- poor PCB layout
- heat from regulators
- questionable pull-up resistors
- contamination during assembly
- poor airflow around the sensor
- incorrectly advertised sensor models
If unusually high accuracy is the reason for buying an SHT45, buying a trustworthy module becomes particularly important.
There is little benefit in paying for a ±0.1°C sensor and then mounting it directly above a warm voltage regulator.
26. Final ranking
Best overall
1. SHT40
The best balance of price, accuracy, response speed and power consumption.
Best accuracy
2. SHT45
The clear choice when ±1% RH and ±0.1°C typical accuracy are valuable.
Best established/legacy choice
3. SHT31
Still an excellent sensor with an enormous installed base and mature software support.
27. Which one should be bought?
For most new ESP32 projects:
Buy the SHT40.
For the most accurate Home Assistant sensor possible from these three:
Buy the SHT45.
For an existing project that already contains an SHT31:
Keep using the SHT31.
The difference can be summarized simply:
SHT31 = mature and proven
SHT40 = best value and best general choice
SHT45 = maximum accuracy


