Environmental Sensing

Some devices need to be aware of the conditions of their environment, such as ambient light or temperature. For example, a thermostat to be able to sense the ambient temperature in order to regulate the room temperature accurately. In some cases, environmental sensing is related to the core functionality of a product (e.g. a thermostat). In other situations, this information is used for ancillary purposes, such as product safety (e.g. over-temperature protection) or battery life (e.g. to enable a power-saving mode). This article gives a brief overview of environmental sensors that are commonly found in smart devices.

Light

A light-dependent resistor (LDR) is a resistor whose value changes in response to light. The resistance of LDRs will decrease in response to more light. LDR sensors are simple and cheap. These sensors are analog, but they are simple to interface with most microcontrollers. However, they are temperature-dependent, meaning that they are not suitable for precision measurements. LDRs also respond more slowly than other types of light sensors. Typically, their resistance value lags 10ms behind ambient light conditions. Certain types of LDRs is restricted in Europe (RoHS directive) because they contain cadmium.

Another group of light sensors are photodiodes and phototransistors. Unlike LDRs, photodiodes are true semiconductor devices. Photodiodes are diodes that lack an opaque coating around the active element. Because of this, their operation is influenced by visible light. In light-sensor circuits, photodiodes are reverse-biased so that they block the flow of electricity. Incident light will knock electrons loose, causing a small leakage current proportional to the amount of ambient light. This signal can be amplified in order to detect ambient light conditions. Photodiodes respond much more quickly than LDRs. However, they require additional support circuitry for amplification. Reverse-biased LEDs also exhibit photosensitive behavior. Phototransistors are related to photodiodes, but they are more convenient because they have amplification built-in.

A third option is to use a specialized light-sensor IC. They are usually more expensive, but they are more precise and easier to use. Their spectrum response is similar to that of the human eye. Less advanced light sensors are also very sensitive to UV light, which is invisible to humans. Typically, these ICs have amplification and analog-to-digital conversion circuitry built-in. This simplifies the electronics design and improves sensor precision.

Temperature

Thermistors are resistors whose resistance is dependent on temperature. Conceptually, they are similar to light-dependent resistors, though they measure a different physical quantity. Thermistors offer an inexpensive way to measure temperature. However, they are not very accurate and their sensing range is limited (< 100°C). Thermistors exist in two different types: negative temperature coefficient (NTC) and positive temperature coefficient (PTC). NTCs will decrease in resistance as temperature rises, whereas PTCs will increase in resistance. Thermistors that are suitable for temperature sensing applications typically have a nominal resistance of 1 kOhm to 10 kOhm.

Resistance temperature detectors (RTDs) are similar to thermistors in that they change resistance in response to changes in temperature. However, RTDs are made out of a fine metallic strand wrapped around a ceramic core, whereas thermistors are generally made out of a ceramic or a polymer. Unlike thermistors, RTDs offer a very high degree of accuracy and repeatability. They can be used at temperatures up to 600°C. However, they are much more expensive and they require careful amplification. PT100 and PT1000 are common types of RTDs. The sensing element is made of platinum, and they have a nominal resistance of 100 Ohm and 1000 Ohm respectively.

Thermocouple probes rely on the Seebeck effect to measure temperature. This effect generates a small voltage when the junction between two dissimilar materials is heated, and this voltage is proportional to the temperature. Thermocouples are reasonably accurate (± 1°C), they are robust, and they offer a very large sensing range (up to 2000°C). The voltage generated by thermocouples is very small, typically around 40 μV/°C, and needs to be amplified into a usable voltage range. Sometimes, cold junction compensation is used in the amplification circuit to improve accuracy. This is done because thermocouples measure the temperature difference between the hot side and the cold side, and not the absolute temperature. Therefore, a separate sensor (e.g. a thermistor) can be used to measure the cold side temperature. Finally, many different types of thermocouple probes exist, each offering a different measurement range and resolution. The thermocouple type is denoted by a letter and corresponds with different metal pairs being used. One of the most common types is the type K thermocouple (chromel–alumel), offering a measurement range of -200°C to +1350°C.

A final option is to use a integrated temperature sensor chip, such as the MCP9808 or the DS18B20. These sensors rely on the silicon bandgap to measure temperature. A silicon bandgap circuit can be included in an integrated circuit at very low cost. For this reason, these temperature sensors are often included in microcontrollers and CPUs for over-temperature protection. Of course, stand-alone chips are also readily available. They are precise (± 0.5 °C to ± 0.25 °C) and easy to use, but offer only a limited measurement range. This type of temperature sensor is generally limited to a maximum temperature of 100°C due to the physical construction of the chip package.

Air humidity

Air humidity sensors are less common than light/temperature sensors, and are often used for specialized applications such as weather stations. Still, many types of humidity sensors are available in ready-to-use chip packages. Different sensing principles can be used to measure humidity, though capacitive sensing is the most common one. Capacitive humidity sensors use an open air capacitor to measure humidity. This works because the moisture content of the air influences the capacitance value of the capacitor. Humidity sensors measure the relative air humidity. Often, a temperature sensor is included in the same package so as to be able to calculate the absolute humidity (e.g. DHT22 or SHT31-D). It is also not uncommon for the same sensor package to include a pressure sensor (e.g. BME280), thus offering a complete sensing solution for atmospheric conditions.