The most common sensors in IoT
Temperature and humidity are among the first things people measure with connected devices. They matter in homes, greenhouses, server rooms, storage areas, museums and food transport, and the sensors are cheap and often sold together in one small package. But a surprising number of the readings they produce are wrong, mostly for reasons that have nothing to do with the sensor’s quality.
How temperature sensors work
Thermistors
A thermistor is a resistor whose resistance changes strongly with temperature. The most common kind, called NTC, drops in resistance as it warms. It is inexpensive, sensitive and quick to respond, though the relationship is curved and needs a formula or lookup table to convert. They are best across a limited range.
Resistance temperature detectors (RTDs)
An RTD uses a thin metal element, often platinum, whose resistance rises predictably with temperature. RTDs are stable and accurate, and they cover a wide range, but they cost more and need careful measurement electronics.
Thermocouples
A thermocouple joins two different metals, producing a small voltage that depends on the temperature difference between the junction and a reference point. They survive very high and very low temperatures and are rugged, so they appear in industrial equipment. Their signal is small, and they need correction for the reference junction.
Integrated digital sensors
Most hobby and consumer devices use a small chip that contains a sensing element, converter and digital interface. It reports a finished number over a bus. These are convenient and well suited to microcontrollers, with accuracy that is typically adequate for home and building uses.
How humidity sensors work
Humidity here normally means relative humidity, the amount of water vapor in air compared with the most the air can hold at that temperature, expressed as a percentage. This definition has an important consequence: warm air can hold more water vapor than cool air, so relative humidity changes when temperature changes, even if the actual amount of water in the air stays the same.
Most small humidity sensors are capacitive. A thin polymer layer between two electrodes absorbs water vapor from the air, and the layer’s ability to store charge changes as it does. The chip measures the capacitance and converts it into a percentage. A resistive design measures changes in a material’s conductivity instead. Because the sensing layer is exposed to air, it is also exposed to dust, vapors and condensation.
Humidity sensors almost always include a temperature sensor, because the humidity result must be corrected for temperature. Some devices also report dew point, the temperature at which condensation would begin, which is calculated from the other two values and can be a more intuitive indicator of moisture risk.
What affects readings indoors
- Self-heating. The chip and any nearby electronics warm up and heat the sensor. This raises the temperature reading and lowers the relative humidity reading. Placing the sensor away from voltage regulators, radios and displays, or reading it only briefly between sleep periods, reduces the effect.
- Enclosures. A sensor sealed inside a case measures the air in the case. Vent holes and thermal separation from the circuit board help.
- Heat sources and drafts. Sunlit windows, radiators, appliances, cold exterior walls and air vents all create local differences. A reading near the ceiling differs from one at floor level.
- Slow response. Sensors take time to equilibrate after moving to a new place, and humidity sensing layers can be slower than temperature elements, particularly at low temperatures.
- Daily activity. Cooking, showers, plants and open windows move humidity quickly.
What affects readings outdoors
- Solar radiation. Sunlight heating the housing makes the sensor read warmer than the air. A radiation shield, typically a set of white louvered plates, lets air flow while blocking direct sun.
- Rain and condensation. Wetting a humidity sensor can saturate it, and recovery may take hours. Membrane filters protect the element while letting vapor through.
- Ground and surroundings. Readings over concrete differ from readings over grass, and nearby walls radiate heat.
- Height and airflow. Standard weather observations are taken at a defined height above the ground in shaded, ventilated conditions, so a sensor on a hot wall will not be comparable.
- Temperature extremes. Many low-cost sensors become less accurate or slower near freezing or at high temperatures, and some stop working outside their rated range.
- Aging and contamination. Humidity elements can drift after prolonged exposure to high humidity, pollution or chemical vapors. Regular checks and sensor calibration help.
Accuracy in perspective
For common digital sensors, a temperature accuracy of a fraction of a degree to a degree or so and a humidity accuracy of a few percentage points are typical, though specifics depend on the part and conditions. Humidity is generally harder to measure well than temperature, and errors tend to grow at the extremes of the range. For tasks like comfort monitoring, those tolerances are fine. For storing medicines or sensitive materials, or for regulatory records, more careful selection and verification is needed, and the guidance in reading sensor specifications is worth following.
Making good use of the data
Place sensors where they represent the space you care about, not next to a window or a hot router, which is the kind of decision covered under sensor placement. Averaging several readings smooths noise. Logging trends tells you far more than a single number: a room that gains humidity overnight, for instance, has a different problem from one that is simply humid. Temperature and humidity data also drive automation, such as smart thermostats and ventilation, where bad readings lead directly to bad decisions.
A short checklist
- Choose a sensor whose range covers the real conditions.
- Keep it away from heat sources, direct sunlight and electronics.
- Provide airflow and shield it outdoors.
- Allow time to settle before trusting a reading.
- Compare against a trusted reference at least once.
- Expect to recheck it periodically, especially in dirty or humid places.