blog

Low-Power Sensor for DIY? HTU21D Boasts Long Battery Life & High Precision!

HTU21D PASSAGE COVER

Introduction

The HTU21D sensor is a digital temperature and humidity sensor suitable for various applications.It provides accurate and reliable data in a compact package and supports the straightforward I2C communication protocol,making integration into various devices simple and direct.Its energy-efficient design,fast response,and low-cost advantages make it an ideal choice for numerous application fields.

Working Principle

HTU21D integrates a capacitive humidity sensor and bandgap temperature sensor.The humidity sensor measures humidity by changes in the capacitance of a hygroscopic polymer film;the temperature sensor precisely determines temperature by measuring the bandgap voltage of the silicon inside the chip.All signals are processed and calibrated internally,and users can directly read the calibrated digital data via the I2Cinterface.

Working Principle of Digital Temperature and Humidity Sensors

Digital temperature and humidity sensors convert ambient temperature and humidity changes into electrical signals via built-in sensing elements.These signals are then transformed into digital signals by an analog-to-digital converter(ADC)and subsequently processed by a microcontroller.The sensors typically incorporate built-in calibration algorithms to ensure measurement accuracy.

Functional Description

  1. Features a lead-free sensor suitable for reflow soldering,with a compact DFN package that is ideal for automated assembly process.
  2. Both the humidity and temperature outputs of the sensor are in digital format and communicate via an I2C interface.
  3. Each sensor undergoes individual calibration and testing prior to factory shipment.Batch identification information is printed on the sensor,and an electronic identification codes is stored within the chip and can be read via command.
  4. The sensor features a low-battery detection function and the ability to change the humidity sensor resolution via command(8/12-bit to 12/14-bit for humidity and temperature respectively).
  5. The sensor’s design optimizes the performance-to-price ratio,and its advanced energy-saving operation mode will benefit any device.
  6. The sensor features fast response times and offers an optional PTFE filter membrane for protection against dust,water immersion,and particulate contamination.

Electrical Characteristics

  • Offers full interchangeability and can be used without calibration under standard conditions.
  • Capable of rapid desaturation after prolonged periods of saturation.
  • The sensor features extremely fast response times and can be configured with an optional PTFE filter/membrane to protect against dust and water immersion.

Humidity Parameter

Humidity Parameter

Temperature Parameter

Temperature Parameter

Pin definition

Pin definition
PinDescription
Power      pin (VDD, GND)The HTU21 operates within a supply voltage range of 1.5 VDC to 3.6 VDC, with a recommended voltage of 3.0 V. A 0.1uF decoupling capacitor must be connected between the power supply (VDD) and ground (VSS), and the capacitor should be placed as close to the sensor as possible.
Serial clock input (SCK)SCK is used to synchronize communication between the microcontroller and the HTU21. Since the interface incorporates fully static logic, there is no minimum SCK frequency requirement.
Serial data (DATA)The DATA pin has a tri-state structure and is used to read sensor data. When sending commands to the sensor, DATA is valid on the rising edge of SCK and must remain stable while SCK is high. DATA changes after the falling edge of SCK. When reading data from the sensor, DATA becomes valid after SCK goes low and remains valid until the next falling edge of SCK. To avoid signal conflicts, the microcontroller should drive DATA to a low level. An external pull-up resistor (e.g., 10kΩ) is required to pull the signal to a high level. The pull-up resistor is typically already included in the microcontroller’s I/O circuit.

Sensor Parameter

HTU21D

  1. Supply voltage:1.5V-3.6V.
  2. Humidity measurement range:0-100%RH.
  3. Temperature measurement range:-40℃ to 105℃.
  4. Power consumption:2.7uW.
  5. Communication method:I2C.
  6. Humidity accuracy range(10%RH to 95%RH):HTU21D±2%RH.
  7. Humidity hysteresis:±1%RH.

  8. Measurement time:50ms.

  9. Annual drift:-0.5%RH/year.

HDC1080

  1. Power supply voltage:3V-5V.

  2. Power supply current:100mA sleep mode current.

  3. Temperature measurement range:-40℃ to 125℃.

  4. Temperature measurement accuracy:±0.2℃.

  5. Humidity measurement range:0~100%RH.

  6. Humidity measurement accuracy:±2%RH.

  7. Response time:Humidity 5s,Temperature 10s.

  8. Resolution:14-bit.

  9. Interchangeability:Fully interchange.

  10. Humidity hysteresis:±1%RH.

I2C Interface

The HTU21D sensor module utilizes the I2C communication protocol to transmit sensor data to a microcontroller.It features SCL (Serial Clock)and SDA(Serial Data)pins,which can be connected to the I2C interface of an Arduino or other microcontrollers supporting the same protocol.

However,the HTU21D sensor module has a fixed I2C address of 0x40.To communicate with multiple HTU21D sensors on the same bus,an I2C multiplexer is required.

To use multiple I2C devices on the same bus,the 4.7k ohm pull-up resistor on the HTU21D sensor module must be disabled.

Communication Process

I2C Start Signal

Start Transmission – When sending a bit of data,this includes a transition of the DATA line from high to low level while the SCK line is held high.

HTU21D I2C Start Signal

I2C Stop Signal

Stop Transmission – When ceasing data transmission,this involves a transition of the DATA line to a high level while the SCK line is held high.

 

HTU21D I2C Stop Signal

I2C Data Transmission

When the SCL clock level is low,the level of the SDA data line can be changed.Data on SDA is transmitted during the rising edge of SCL.When SCL is at a high level,the data on SDA remains stable.

HTU21D I2C Data Transmission

I2C Write One Byte

Data transmission is completed,and the acknowledgment operation is performed.

0:Indicates a slave acknowledgment,allowing the next step to proceed;

1:Indicates a slave non-acknowledgment,preventing the next step from proceeding.

HTU21D I2C Write One Byte

I2C Read One Byte

I2C read operations are similar to write operations,except that the direction of data transmission is reversed.

When the host reads the last byte of data,it sends a NACK to inform the slave that data reading is complete.For all other bytes,it sends an ACK.

HTU21D I2C Read One Byte

I2C Acknowledgment Signal Handing

Wait for Acknowledgment

Generate Acknowledgment

Generate Non-Acknowledgment

HTU21D VS DHT22

Character HTU21D DHT22
Port I2C (Standard Protocol) Signal bus (synchronous timing)
Accuracy ±2%RH ±5%RH
Consumption Extremely low When measuring >1mA
Data verification Support CRC No verify
Multi-device expansion Easy Difficulty

Construction of a Low-Power Environmental Monitor Using HTU21D

HTU21D is a digital temperature and humidity sensor specifically designed for low-power application.It not only offers high accuracy(±2%RH)but also consumes almost no power during idle period.It only “wakes up “when data is needed,and immediately”goes to sleep”after measurement—truly a master of energy efficiency!

Reason:The humidity capacitor,temperature bandgap element,and signal conditioning ASIC are all integrated into a single chip,which directly outputs digital via the standard I2C bus.The operating voltage is only 1.5V to 3.6V,making it particularly suitable for battery-powered.

On-demand trigger

HTU21D does not have a continuous sampling mode;all measurements must be actively initiated by sending commands.

Send 0xF5→Start humidity measurement

Send 0xF3→Measure temperature

Wait for the conversion to complete(maximum 16ms)→Read back 3 bytes of data(including CRC).

Internal Workflow

  1. The sensor captures the raw analog signal;
  2. Digitized by a 16-bit ADC;
  3. On-chip built-in logic performs nonlinear correction and temperature compensation;
  4. Outputs a digital value with CRC verification.

Notes:

It does not support:I2C hold”mode,so each communication must be fully initiated and terminated to avoid prolonged occupation of the bus.

Use the 0xE0 command to read the last temperature value,avoiding repeated measurements to save both time and power.

All delays are designed with a margin based on the maximum conversion time to ensure stability.

It is essential to enforce CRC verification in industrial environments with high levels of noise to ensure data integrity.

Application Scenario

  1. Automotive field:Used for defogging and HVAC system;
  2. Home application:Used in smart thermostats,air quality detectors,and smart air conditioners to provide a comfortable living environment;
  3. Environmental monitoring:Used in greenhouses,museums,or data centers to monitor environmental conditions and protect sensitive items;
  4. Medical devices:Applications in medical-related products.
  5. Printers:Used as humidity monitoring components in printers;
  6. Humidifiers:Integrate into humidifiers for use;
  7. Agricultural Research:Helps farmers monitor optimal conditions for crop growth to increase crop yields.
  8. Industrial Automation:Monitors humidity on production lines to prevent products from becoming damp or excessively dry.

Relative Information

FAQ

1.How can users perform calibration?

The HTU21D chip undergoes high-precision calibration by the manufacture before leaving the factory,and the calibration coefficients are stored in the chip’s OTP(One-Time Programmable)memory.Users cannot modify or repeat this process.

Calibration is the process of identifying and correcting any deviations by comparing the sensor’s output with an accurately known standard value.For the HTU21D,this means adjusting the sensor’s readings based on a set of known temperature and humidity values to make its output as close as possible to these known values.

Static calibration is performed under stable conditions,typically requiring completion in a constant-temperature chamber.Dynamic calibration,on the other hand,is conducted in the actual application environment,taking into account various variables under real-world conditions.

Static Calibration

  • Place the HTU21D sensor inside a constant temperature and humidity chamber.
  • Record the sensor reading under various constant temperature and humidity conditions.
  • Use linear regression or other mathematical models to determine deviations.
  • Adjust the sensor’s output to correct for these deviations.

Dynamic Calibration

  • Install the HTU21D sensor in the actual application environment.
  • Record sensor data and reference data at the same time points across different time periods.
  • Analyze the data to determine the sensor’s response time and accuracy.
  • Adjust the sensor output based on the analysis results to improve accuracy under dynamic conditions.

2.Methods to Extend the Lifespan of the Sensor

Design life refers to the maximum duration a sensor is expected to operate continuously under ideal condition.However,in practical applications,due to the complex and variable environmental conditions,long-term durability testing must be conducted to assess the difference between actual lifespan and design life,followed by comparative analysis with real-world operating conditions.

Maintenance and care are crucial for ensuring the long-term stable operation of sensors.

  • Usage Guidelines:Strictly follow the usage and maintenance instructions provided by the sensor manufacture to avoid damage caused by improper operation.
  • Cleaning and Maintenance:Regularly clean and inspect the sensor,especially those exposed to the external environment.
  • Storage Conditions:When not in use,store the sensor in a suitable environment to avoid damage from high temperature,high humidity,or extreme temperature fluctuations.
  • Replacement of Parts:Regularly inspect and promptly replace consumable components inside the sensor,such as filter membranes and seals.

Leave a Reply

Your email address will not be published. Required fields are marked *