Share this

Sensing system design of SHT11 temperature and humidity sensor

2026-04-06 04:49:27 · · #1
1. Introduction to SHT11 The SHT11 is a digital temperature and humidity sensor chip launched by Scensilion, a Swiss company. This chip is widely used in HVAC, automotive, consumer electronics, and automatic control fields. Its main features are as follows: High integration: Integrating temperature sensing, humidity sensing, signal conversion, A/D conversion, and heater functions onto a single chip; Provides two-wire digital serial interfaces SCK and DATA, with a simple interface, supports CRC transmission verification, and ensures high transmission reliability; Programmable adjustment of measurement accuracy: Built-in A/D converter (8-12 bit resolution, selectable via programming internal registers); High measurement accuracy: Due to the integration of temperature and humidity sensors, it can provide temperature-compensated humidity measurements and high-quality dew point calculation; Ultra-small package size (7.62 mm × 5.08 mm × 2.5 mm); Automatically switches to low-power mode after measurement and communication; High reliability: Utilizes CMOS sensor technology, allowing the sensing head to be completely immersed in water during measurement. 2. Pin Functions of SHT11 The SHT11 temperature and humidity sensor uses an SMD (LCC) surface mount package, with a very simple interface. The pin names and arrangement are shown in Figure 1. The functions of each pin are as follows: Pins 1 and 4—Signal ground and power supply, with an operating voltage range of 2.4–5.5 V; Pins 2 and 3—Two-wire serial digital interface, where DA-TA is the data line and SCK is the clock line; Pins 5–8—Not connected. 3. Internal Structure and Working Principle of SHT11 The SHT11 temperature and humidity sensor integrates temperature sensing, humidity sensing, signal conversion, A/D conversion, and a heater function onto a single chip. Its internal structure is shown in Figure 2. This chip includes a capacitive polymer humidity sensing element and a temperature sensing element made of bandgap material. These two sensing elements convert humidity and temperature into electrical signals, respectively. These electrical signals are first amplified by a weak signal amplifier; then they enter a 14-bit A/D converter; finally, a digital signal is output through a two-wire serial digital interface. Before leaving the factory, the SHT11 is calibrated in a constant humidity or temperature environment, and the calibration coefficients are stored in the calibration register. During measurement, the calibration coefficients automatically calibrate the signal from the sensor. In addition, the SHT11 integrates a heating element, which raises the SHT11 temperature by approximately 5°C when activated, while also increasing power consumption. This function is primarily used to compare temperature and humidity values ​​before and after heating, allowing for comprehensive verification of the performance of both sensor elements. In high humidity (>95% RH) environments, heating the sensor prevents condensation, shortens response time, and improves accuracy. After heating, the SHT11 temperature increases and the relative humidity decreases, resulting in slightly different measured values ​​compared to before heating. The microprocessor communicates with the SHT11 via a two-wire serial digital interface. The communication protocol is incompatible with the general I2C bus protocol, therefore, the communication timing needs to be simulated using a general-purpose microprocessor I/O port. The microprocessor controls the SHT11 through five 5-bit command codes, the meanings of which are listed in Table 1. 4. SHT11 Application Design The microprocessor communicates with the SHT11 temperature and humidity sensor chip via a two-wire serial digital interface, making the hardware interface design very simple. However, the communication protocol is defined by the chip manufacturer, so the software design needs to simulate the communication protocol using the microprocessor's general-purpose I/O ports. 4.1 Hardware Design The SHT11 is accessed via a two-wire digital serial interface, making the hardware interface circuit very simple. Important points to note: the DATA line requires an external pull-up resistor, and the clock line SCK is used for synchronization between the microprocessor and the SHT11. Since the interface contains completely static logic, there is no minimum frequency requirement for SCK; when the operating voltage is higher than 4.5V, the maximum SCK frequency is 10 MHz, while when the operating voltage is lower than 4.5V, the maximum SCK frequency is 1 MHz. The hardware connection is shown in Figure 3. 4.2 Software Design The microprocessor and the temperature and humidity sensor communicate using a two-wire serial interface SCK and DATA, where SCK is the clock line and DATA is the data line. This two-wire serial communication protocol is incompatible with the I2C protocol. At the start of the program, the microprocessor needs to use a set of "start transfer" timing sequences to indicate the initiation of data transmission, as shown in Figure 4. When the SCK clock is high, DATA toggles low; then SCK goes low, then high again; when the SCK clock is high, DATA toggles high again. The SHT11 humidity test timing sequence is shown in Figure 5. The shaded area represents the SHT11 control bus. The master sends a start command, followed by an 8-bit command code containing 3 address bits (chip-defined address is 000) and 5 command bits. After sending the command code, the master sets the DATA bus to input mode and waits for the SHT11's response. Upon receiving the address and command code, the SHT11 pulls the DATA bus low on the 8th falling edge of the clock as the slave's ACK. After the 9th falling edge of the clock, the slave releases the DATA bus (returns to high level). After releasing the bus, the slave starts measuring the current humidity. After the measurement is completed, it pulls the DATA bus low again. The master detects that the DATA bus has been pulled low, indicating that the humidity measurement has ended, and sends an SCK clock signal. On the 8th falling edge of the clock, the slave first outputs the high byte of data. On the 9th falling edge of the clock, the master pulls the DATA bus low as the ACK signal. Then, the DATA bus is released; on the next 8 falling edges of the SCK cycle, the slave sends low-byte data; on the next falling edge of the SCK, the master pulls the DATA bus low again as an ACK signal for receiving data; on the last 8 falling edges of the SCK, the slave sends CRC check data, and the master does not acknowledge (NACK), indicating the end of the measurement. Since the microprocessor accesses the humidity sensor SHT11 via a two-wire serial digital interface, and the access protocol is defined by the chip manufacturer, it is necessary to simulate this communication protocol using general-purpose I/O ports. We chose the Atmel ATmega128 microprocessor. By programming the I/O port registers, the processor's I/O ports can be set to input, output, high-impedance, etc., as needed. This provides the conditions for simulating the communication protocol. In the software implementation, macro definitions are used to change the I/O port state. Through the above macro definitions, various input and output states of the SCK and DATA buses can be implemented. A delay function is also needed to simulate this two-wire serial digital protocol. The WINAVR library provides a delay function `_delay_loop_2` (unsigned chars), which runs for 4 clock cycles. Therefore, a custom 1 μs delay function can be defined as follows: Based on the above macro definitions and delay functions, the SCK and DATA buses can be easily made to output a high or low level for a certain period, thus simulating the read/write protocol of the SHT11 temperature and humidity sensor shown in Figure 5. 4.3 Calculation of Temperature and Humidity Values ​​4.3.1 Humidity Linear Compensation and Temperature Compensation The SHT11 can directly output digital humidity values ​​via the DATA bus. This humidity value is called "relative humidity," and requires linear and temperature compensation to obtain a more accurate value. Since the digital output characteristics of relative humidity exhibit a certain degree of non-linearity, the humidity value can be corrected using the following formula to compensate for the non-linearity of the humidity sensor: Where: RHlinear is the humidity value after linear compensation, SORH is the relative humidity measurement value, and C1, C2, and C3 are linear compensation coefficients, with values ​​listed in Table 2. Since temperature has a significant impact on humidity, and the actual temperature differs from the test reference temperature of 25℃, it is necessary to perform temperature compensation on the humidity value after linear compensation. The compensation formula is as follows: Where: RHtrue is the humidity value after linear and temperature compensation, T is the temperature (℃) when the humidity value is tested, and t1 and t2 are temperature compensation coefficients, the values ​​of which are listed in Table 3. 4.3.2 Temperature Value Output Since the SHT11 is a temperature-sensitive element made of PTAT bandgap material, it has excellent linear output. The actual temperature value can be calculated by the following formula: Temperature=d1+d2×SOT Where: d1 and d2 are specific coefficients. The value of d1 is related to the operating voltage of the SHT11, and the value of d2 is related to the resolution of the A/D converter inside the SHT11. Their corresponding relationships are listed in Tables 4 and 5, respectively. 4.3.3 Dew Point Calculation The dew point is a special temperature value, which is the lowest temperature that air must reach to maintain a certain humidity. When the air temperature is below the dew point, the air cannot hold too much moisture, which will turn into fog, dew, or frost. The dew point can be calculated based on the current relative humidity and temperature values. The specific calculation formula is as follows: LogEW=0.66077+7.5×T/(237.3+T)+log10(SORH)-2 Dp=((0.66077-logEW)×237.3)/(logEW-8.16077) Where: T is the current temperature value, SORH is the relative humidity value, and Dp is the dew point. 5 Conclusion The SHT11 temperature and humidity sensor integrates a temperature sensor and a humidity sensor. Therefore, systems using SHT11 for real-time temperature and humidity monitoring have advantages such as high accuracy, low cost, small size, and simple interface. In addition, the SHT11 chip integrates a 14-bit A/D converter and uses digital signal output, so its anti-interference capability is also higher than that of similar chips. This chip has been widely used in temperature and humidity monitoring, automatic control, and other fields.
Read next

CATDOLL 138CM Mila (TPE Body with Soft Silicone Head)

Height: 138cm Weight: 26kg Shoulder Width: 30cm Bust/Waist/Hip: 65/61/76cm Oral Depth: 3-5cm Vaginal Depth: 3-15cm Anal...

Articles 2026-02-22
CATDOLL 138CM Sasha Silicone Doll

CATDOLL 138CM Sasha Silicone Doll

Articles
2026-02-22
CATDOLL 146CM Jing TPE

CATDOLL 146CM Jing TPE

Articles
2026-02-22
CATDOLL Coco Soft Silicone Head

CATDOLL Coco Soft Silicone Head

Articles
2026-02-22