1 thought on “Programming of SHT11”

  1. SHT11 is a single -calibrated digital relative humidity and temperature sensor produced by the I2C bus interface produced by Sensirion, Switzerland. The sensor adopts a unique CMOSENS TM technology, which has the characteristics of digital output, debugging, calibration, free peripheral circuit and full swap. In the article, the performance characteristics, interface timing and command of the sensor are explained in detail, and the interface circuit and corresponding programs of SHT11 and single -chip microcomputer are given. Keywords: digital; temperature and humidity sensor; I2C bus; single -chip machine 1 outlines the measurement of temperature and humidity in warehousing management, manufacturing, meteorological observation, scientific research, and daily life. Traditional simulated humidity sensors are generally designed The signal conditioning circuit also requires complex calibration and calibration process, so the measurement accuracy is difficult to guarantee, and it is often unsatisfactory to linearity, repetitiveness, interchangeability, consistency, and other aspects. SHT11 is a new temperature and humidity sensor based on CMOSENSTM technology launched by Sensirion, Switzerland. The sensor combines CMOS chip technology with sensor technology to play their powerful advantage complementarity.
    2 Performance characteristics SHT11 The main characteristics of the temperature and humidity sensor of SHT11 are as follows: ● All the temperature and humidity sensor, signal amplification conditioning, A / D conversion, and I2C bus interface are integrated in one chip (CMOSENSTM technology); Humidity and temperature value output; ● The digital output interface of I2C bus with industrial standards; ● Calculate output function with dew point value; ● Has excellent long -term stability; 12 bits, and can be programmed as 12 -bit and 8 -bit; ● Small volume (7.65 × 5.08 × 23.5mm), which can be installed on the surface; ● With a reliable CRC data transmission verification function; The calibration coefficient can ensure 100 % interchangeability; ● The voltage range of the power supply is 2.4 to 5.5V; ● The current consumption is 550 μA, the average is 28 μA, and the dormant is 3 μA.

    sht11 The temperature and humidity sensor uses SMD (LCC) surface packaging form. The arranges of the tube foot are shown in Figure 1. Two -way serial data cable; (3) SCK: serial clock input; (4) VDD power supply end: 0.4 ~ 5.5V power supply end; (5-8) NC: empty pipe foot.
    3 Working principle SHT11's humidity detection uses a capacitive structure, and uses a "miniature structure" to detect the electrode system and polymer coverage layer with different protection to form a capacitor of the sensor chip. In addition to the characteristics, it can also resist the impact from the outside world. Because it combines the temperature sensor and the humidity sensor, it constitutes a single individual, so the measurement accuracy is high and can be accurately obtained, and at the same time, it will not produce errors caused by changes in temperature gradient between temperature and humidity sensors. CMOSENSTM technology not only combines temperature and humidity sensors, but also integrates signal amplifiers, mold / number converters, calibration data memory, standard I2C bus and other circuits in one chip. The internal structure box diagram of the SHT11 sensor is shown in Figure 2. Each sensor of SHT11 is calibrated in extremely accurate humidity rooms. The calibration coefficient of the SHT11 sensor pre -existence in OTP memory. The calibrated relative humidity and temperature sensor are connected to a 14 -bit A / D converter, which can send the conversion digital temperature humidity value to the second -line I2C bus device, thereby converting the digital signal into a serial number that meets the I2C bus protocol Signal.

    It because the sensor and the circuit are partially combined, the sensor has much better performance than other types of humidity sensors. The first is that the increase in the signal strength of the sensor enhances the anti -interference performance of the sensor, ensuring the long -term stability of the sensor, and the completion of the A / D conversion at the same time reduces the sensitivity of the sensor to interference noise. Secondly, the calibration data loaded in the sensor chip ensures that each humidity sensor has the same function, that is, 100 % interchangeability. Finally, the sensor can be connected directly with any type of microprocessor and microcontroller system through the I2C bus, thereby reducing the hardware cost of the interface circuit and simplifying the interface method. 3.1 Output features (1) Humidity value output SHT11 can directly output digital measurement humidity values ​​through the I2C bus. The relative humidity digital output characteristic curve is shown in Figure 3. It can be seen from Figure 3 that the output characteristics of the SHT11 are certain non -linear. In order to compensate the non -linearity of the humidity sensor, the humidity value can be corrected according to the following formula: Rhlinear = C1 C2SORH C3SORH2 formula, SORH is the sensor's relative humidity measurement value, the coefficient value of the value As follows: 12 digits: SORH: C1 = -4, C2 = 0.0405, C3 = -2.8 × 10-68 bits: SORH: C1 = -4, C2 = 0.648, C3 = -7.2 × 10-4 (2) Temperature value output. Since the linearness of the SHT11 temperature sensor is very good, the following formula can be used to convert the temperature digital output to the actual temperature value: T = D1 D2SOT When the power supply voltage is 5V, and the resolution of the temperature sensor is 14 bits of 14 bits At this time, D1 = -40.d2 = 0.01. When the resolution of the temperature sensor is 12 bits, D1 = -40. D2 = 0.04. (3) The dew point value of the dew point calculation can be obtained according to the relative humidity and temperature value. The specific calculation formula is as follows: logew = (0.66077 7.5T / (237.3 t) [log10 (RH) -2] dp = [(0.66077 -Logew) × 237.3] / (logew -8.16077) 3.2 commands and interface timing SHT11 sensors have 5 user commands. Command sequence and command time order.

    i2c bus digital temperature humidity sensor SHT11 and its application in the single -chip microcomputer system. Measurement humidity 00101 humidity measurement Reading register status 00111 "Reading" status registers Write the register status 00110 "Write" status Soft Start 11110 restart chip, remove the error record of the status recorder 11 milliseconds (1) transmission starts initialization starting initialization. When transmitting, the "transmission start" command should be issued first. This command can change the data from high level to low level when SCK is high, and increase the data when the next SCK is high. Three address positions (currently only support "000") and 5 command positions. When the ACK bits of the Data foot are at a low potential, it means that SHT11 correctly receives commands. The following signal order will reset the serial port: that is, when the DATA cable is at high electricity, it will trigger SCK more than 9 times (including 9 times). After that, a "transmission start" command should be issued. Table 2 SHT11 status register type and Explanation of the level type Explanation of default 7 Reserved 0 6 Reading Inspection Restriction (Low voltage inspection) x 5 Keep 0 4 Keep 0 3 for testing, you can not use 0 2 read/write heating 0 levels 1 reading/writing can not be from OTP. Re -download 0 Download 0 Reading/Writing 1 = 8 -bit relative humidity, 12 -bit temperature resolution. 0 = 12 -bit relative humidity, 14 -bit humidity resolution 012 -bit relative humidity, 14 -bit humidity (3) temperature and humidity measurement as the sequence of sequence as the measurement of temperature and humidity measurement should be After the temperature (wet) measurement command is issued, the controller must wait until the measurement is completed. Use the resolution measurement of 8/12/14 bits requires about 11/55 / ​​210MS. To indicate that the measurement is completed, the SHT11 will make the data make the data make the data. The line is low. At this time, the controller must restart the SCK, and then transmits two -byte measurement data with the 1 -byte CRC verification. The controller must confirm each byte by the DATA to low. For right, MSB is first in the first place. The communication stops after confirming the CRC data bit. If the CRC -8 checks is not used, the controller will keep the ACK stop communication after the measurement data LSB is measured. After the communication is completed, the sleep mode will be automatically returned. Note: In order to make the temperature rise of the SHT11 below 0.1 ° C. At this time, the operating frequency cannot be greater than 15 % of the calibration values ​​(such as 12 bits of accuracy, maximum measurement per second). The timing corresponding to the measurement temperature and humidity command is shown in Figure 4.
    Thesis I2C bus Digital temperature and humidity sensor SHT11 and its application in the single -chip microcomputer system From

    Figure 4
    3.3. To achieve it, the types and descriptions of the registers are listed in Table 2. The functional description of the register -related bit below: (1) After the heating is connected to the heating switch in the chip, the temperature of the sensor increases by about 5 ° C, which increases the power consumption to 8mA @ 5V. The heating purposes are as follows: ● By comparing the temperature and humidity before and after starting the heater, the functions of the sensor can be correctly distinguished; ● In the environment with a relatively high humidity, the sensor can avoid condensation by heating. (2) The low voltage detection SHT11 can detect whether the VDD voltage is less than 2.45V during work, and the accuracy is ± 0.1V. (3) Download the calibration coefficient In order to save energy and increase speed, OTP must be re -downloaded the calibration coefficient before each measurement, so that each measurement saves 8.2MS time. (4) Measurement resolution settings The measurement resolution will be reduced from 14 (temperature) and 12 -bit (humidity) to 12 and 8 bits, respectively in high -speed or low power consumption occasions.

    4 Application Instructions 4.1 The temperature other than the measurement of the operating conditions will temporarily offset the humidity signal 3 %. Then the sensor will slowly return to the calibration conditions. If the chip is heated for 24 hours to 90 ° C under the environment of humidity less than 5 %, the chip will quickly restore the effects of high relative humidity and high temperature environment. However, extended strength conditions will accelerate the aging of the chip. 4.2 Installation Note Due to the close relationship between the relative humidity of the atmosphere and the temperature, the main point when measured the atmospheric temperature is to keep the sensor and the atmosphere of the same temperature. In order to reduce the thermal conductivity between SHT11 and PCB, the copper wire should be the finest and add a narrow seam to it. At the same time, the sensor should be avoided under strong light or UV. When the sensor is wiring, the SCK and Data signals are parallel and close to each other, or when the signal line is 10cm, the interference information will be generated. At this time, the VDD or GND should be placed between the two sets of signals.
    5 Specific application Figure 5 is the interface circuit of AT89C2051 single -chip microcomputer and SHT11. Since AT89C2051 does not have the I2C bus interface, the universal I / O port of the single -chip microcomputer is used to virtual I2C bus, and the P1.0 is used to use the P1.1 port to the virtual clock line, and access on the data end. A 4.7kΩ pull -up resistance, at the same time, connects a 0.1 μF decoupled capacitor on the VDD and GND end. The C51 applications supported with the above hardware circuit are given below. #define DATA P1_1#define SCK P1_0#define ACK 1#define noACK 0#define MEASURE_TEMP 0x03 //测量温度命令#define MEASURE_HUMI 0x05 //测量湿度命令//读温湿度数据char s-measure(unsigned char *p- value, un-signed char *p_checksum, unsigned char mode){unsigned char error=0;unsigned int i;s_(); //传输开始switch(mode){caseTEMP:error+=s_write_byte(measure_temp);break;caseHUMI: error = s_write_byte (meAsure_humi); break; default: break;} for (i = 0; i u003C65535; i ) if (data == 0) break; if (data) Reeor = 1; ACK);*(p_value+1)=s_read_byte(ACK);*p_checksum=s_read_byte(noACK);return error;}//温湿度值标度变换及温度补偿void calc_sth15(float *p_humidity,float *p_tempera-ture){ const float C1 = -4.0; const float C2 = 0.0405; const float C3 = -0.0000028; const float T1 = -0.01; const float T2 = 0.00008; float Rh = × P_Humidity; float; t = × p_; float rh_lin; float th_ture; float T_C; t_c = t × 0.01-40; rh_lin = c3 × rh × rh c2 × rh c1; TRH_TURE = (T_C -25) × (t1 t2 × rh) rh_lin; × p_ = t -c; × p_humidity = rh_ture;} // Calculate the dew point from the relative temperature and humidity charc_dewpoint (float H, Float T) {float logEx, DEW_POINT; logex = 0.6. 6077 7.5 × T / (237.3 T) [log10 (h) -2]; Dew_point = (logex -0.66077) × 237.3 / (0.66077 7.5 -logex); In length, the above program does not give the transmission start, writing line data, and reading byte data function.

Leave a Comment

Shopping Cart