Creative Commons images are CC BY-NC-SA 3.0

Description: The HTU21D is a low-cost, easy to use, highly accurate, digital humidity and temperature sensor. This sensor is ideal for environmental sensing and data logging and perfect for a weather stations or humidor control systems. All you need is two lines for I2C communication and you’ll have relative humidity readings and very accurate temperature readings as a bonus!

There are only four pins that need to be hooked up in order to start using this sensor in a project. One for VCC, one for GND, and two data lines for I2C communication. This breakout board has built in 4.7k pull up resistors for I2C communications. If you’re hooking up multiple I2C devices on the same bus, you may want to disable these resistors.

Dimensions: 0.6 x 0.6"


Recommended Products

Customer Comments

  • Since this has the same physical form factor, why not add the through holes for the waterproof protection membrane as well?

    • I second this. Mine just died after being outside (in an enclosure but still exposed to mist and moisture) in Hawaii for 6 months. I haven’t found a place that carries these filter caps either.

  • The pullup resistor enable/disable solder blob is an amazing idea and should be included on all i2c breakouts!

  • Heads up, this is not 5V tolerant. Absolute maximum is 3.8V

  • Well, this is damn near perfect. Accurate digital humidity at 3.3v (most are analog, and many are 5V) and very accurate temperature. Exactly what I have been waiting for!

  • Did anybody try to hold his hand over the Sensor :) Check the value what happens ;)

  • I keep having issues with my I2C bus when accessing the sensor, i use the non-locking read mode and after some 30 or 40 accesses the bus locks up and i cant access ANY other device on the bus either, i am using a beaglebone black as busmaster and i am using the linux chardev i2c interface using the RDWR ioctl. I have verified that the bus is stable when accessing other devices without accessing the sensor.

  • After a few months in the very humid Hawaii climate, my sensor now basically says 119% humidity all the time. I wonder if this is a condensation issue.

    • From the datasheet: “In no case, neither after manual nor reflow soldering, a board wash shall be applied. Therefore, it is strongly recommended to use a “no-clean” solder paste. In case of applications with exposure of the sensor to corrosive gases or condensed water (i.e. environments with high relative humidity) the soldering pads shall be sealed (e.g. conformal coating) to prevent loose contacts or short cuts. ”

      So check the solder job and possibly resolder it. But be very careful if you try to clean it. If you get it working, add a conformal coat.

      • I did cover the board, except for the sensor package, with hot glue to protect the pads. It’s possible that wasn’t enough. For my next one, I think I’ll pot the entire board in epoxy (after mounting a filter cap.)

  • using htu21d with 1.8" tft shield i2c communication does not operate to sensor

  • Is this sensor suitable for outdoor monitoring? I can shield it from the rain, but dew is a concern for many sensors. Thanks.

  • I managed to get this working with a BeagleBone Black? I’ve left the pull-up resistors intact even though I’ve read the BeagleBone Black has internal pull-ups (not sure). But I’m getting very inaccurate temperature readings (about 10-12F above real temperature). Can’t verify humidity.

  • Vid 1 - Humidity and 4D Systems uOLED-128-G2

    Vid 2 - Temp and 4D Systems uOLED-128-G2

    I’m very happy with the product, im currently experimenting with this Breakout and the 4D Systems uOLED-128-G2 screen.

  • I couldn’t get this to work with UNO (5v) using the 10k resistors (998 errors). I had to use a level converter.

    • Really? I did all my testing with a 5V Uno. Did you use the configuration in the hookup guide? Could you double check they are indeed 10ks?

      • Same thing here with the example code listed above. Using 10K resistors (double checked) and followed hookup guide to the T. Get the 998 error.

        • Got rid of the 10K resistors per tech support and it works great. Temp was accurate to .3 degrees when compared to a laboratory grade thermometer. Humidity seems to be right on although I don’t have anything to compare it to. Great product for the price.

          • Shoot! Sorry about that. I was able to replicate your error. Using 330 ohm resistors works well for me. I’ll update the assembly guide.

          • Same issue. I tried 2 different RedBoards with the 10 Ks. Only got the 998 error. Removed the inline resistors and it worked great. Should I be worried about running it without the resistors?

  • Anyone happen to access this sensor via python (maybe on a raspberry pi)? I’m attempting that and having a devil of a time getting readings. Code examples would be appreciated

    • It appears that it might be impossible to access this sensor using the python-smbus package. I was, however, able to get it working fairly quickly using the Quick2Wire python API. My code is at

      • Thanks for sharing your code. That got my sensor working.

        I wanted to not use Python3 (just Python2._) so I did a little more looking. Ended up using more direct io code (using io and fcntl) which worked for reading from the HTU21D. So yea, smbus wont work but its not that hard to make your own smbus clone/variant that will work.

        And adding… I just used this same method to read from my AM2315 which also doesnt play with smbus. I bought the HTU21D because I didnt want to deal with another AM2315, and it has the same problem with smbus anyway. Now im reading both in Python2._, and dont have a separate code for just the one sensor.

  • How do I address multiple sensors on the same I2C bus? They are all using 0x40 for I2C address, and I saw no documentation to change the address.

    • The HTU21D doesn’t have the ability to change its address. You would need to power down units that you don’t want to talk to or perhaps use a software I2C library to have multiple sensors hooked up to different pins.

      • I used a TI PCA9548A I2C Switch in a circuit to take care of the address issue with a couple BMP180s that have the same address. It switches the SDA and SCL lines on or off via I2C. The “via I2C” was what sold me. I am already connected to the I2C bus so no extra pins needed. Connect to the sensor, read it, and disconnect. Do again for another sensor with the same address. The other thing connected through the switch is a BlinkM that I am using as an indicator and its sending noise on the I2C bus making other I2C stuff not work. With the I2C switch I can tell it what color pattern to run and then isolate it. The I2C switch also acts as a logic level shifter.

        I was going to use a multiplexer until I found this thing.

  • Making me nervous…No production plans?

    • We’ll be building plenty once the parts arrive. The automated system is not the greatest when some info is not available.

  • What are the actual dimensions for this board?.

    • 0.6 x 0.6" square. I’ll add to the description. Lemme know if you need any other dimension.

  • Do these have the same re-hydration requirements as the honeywell and the like?

  • Looks like a cheaper knock-off of the Sensirion SHT21. I2C address and register addresses are the same, so you should be able to use existing code then…

    • Hold the PHONE !!! Does that mean that the problems with the SHT21 not being fully i2C compatible apply to this one too?

      • As far as I can tell the HTU21D is fully I2C compliant. I ran into no problems using it along side multiple other devices on the bus.

    • I was going to call you crazy, but you’re right. It’s shockingly similar. Same pinout, same footprint. I wouldn’t say anyone is knocking anyone else off, but I’m certainly not sure who is licensing what technology from who. Either way, the HTU21D is way cheaper, we’re super impressed with it, and we’ve got a library that works really well with it.

  • Does the HTU21D also need to be shielded from direct light exposure like the HIH-4030 for better accuracy?

    • That’s a really interesting question. A quick google search pointed me at a datasheet from April 2012 (older than the one we host). And according to it “HTU21D sensors are not light sensitive.” This is not in the current datasheet so I’m not sure. Perhaps someone at Measure Specialties knows.

Customer Reviews

3 out of 5

Based on 2 ratings:

5 star
4 star
3 star
2 star
1 star

2 of 2 found this helpful:

Easy to use, accurate temperature, and okay humidity.

Very easy to interface using the example code and connection circuit. Well labeled board. Some discrepancy regarding the necessity of resistors in series when using a 5V I2C. The example code on GitHub recommends a 330Ω resistor in series for 5V, the description in the Hook Up Guide states that one doesn’t need to level shift, and the example code link from the Hook Up Guide makes no mention of the resistors. Still, Five Stars to the SparkFun Team for a clearly marked board and well written connection guide. I really had to dig deep into old files before i found the one file that confused me. Compared with the recently calibrated equipment at the lab. So, for the 5V arduino, it did not any additional resistors. The temperature appeared very accurate (±0.5˚F) at room temperature. The humidity was less accurate (±5 %RH) at 20%RH. For the price, I am happy with this device! Saving the one last star for a device with more accurate humidity. Maybe the SHT15 will do that for me. Thank you and Happy New Year!

0 of 1 found this helpful:


Own two, but only one works.