SparkFun Humidity and Temperature Sensor Breakout - HTU21D

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.

Note: Full drops of water can damage the sensor. We recommend wrapping the board in Teflon/irrigation tape for extreme conditions where water droplets may find their way onto the sensor.

  • 0.6 x 0.6"

SparkFun Humidity and Temperature Sensor Breakout - HTU21D Product Help and Resources

Core Skill: Soldering

This skill defines how difficult the soldering is on a particular product. It might be a couple simple solder joints, or require special reflow tools.

2 Soldering

Skill Level: Rookie - The number of pins increases, and you will have to determine polarity of components and some of the components might be a bit trickier or close together. You might need solder wick or flux.
See all skill levels


Core Skill: Programming

If a board needs code or communicates somehow, you're going to need to know how to program or interface with it. The programming skill is all about communication and code.

3 Programming

Skill Level: Competent - The toolchain for programming is a bit more complex and will examples may not be explicitly provided for you. You will be required to have a fundamental knowledge of programming and be required to provide your own code. You may need to modify existing libraries or code to work with your specific hardware. Sensor and hardware interfaces will be SPI or I2C.
See all skill levels


Core Skill: Electrical Prototyping

If it requires power, you need to know how much, what all the pins do, and how to hook it up. You may need to reference datasheets, schematics, and know the ins and outs of electronics.

3 Electrical Prototyping

Skill Level: Competent - You will be required to reference a datasheet or schematic to know how to use a component. Your knowledge of a datasheet will only require basic features like power requirements, pinouts, or communications type. Also, you may need a power supply that?s greater than 12V or more than 1A worth of current.
See all skill levels


Comments

Looking for answers to technical questions?

We welcome your comments and suggestions below. However, if you are looking for solutions to technical questions please see our Technical Assistance page.

  • Member #522326 / about 9 years ago / 5

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

    http://www.sensirion.com/en/products/humidity-temperature/filter-caps/filter-cap-for-sht2x/

    • Lutorm / about 9 years ago / 1

      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.

  • A / about 10 years ago / 3

    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

    • Blacklab1 / about 10 years ago / 1

      Sensirion SHT21 - requires the Logic Level Converter too, I guess.

  • Member #362157 / about 10 years ago / 2

    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!

  • semaf / about 9 years ago / 1

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

  • Member #654483 / about 9 years ago / 1

    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.

    • MikeGrusin / about 9 years ago / 1

      Sorry for the late reply, this sounds similar to an issue we ran into with the SHT15. As it's not a true I2C device, it wasn't playing well with other devices on the bus, and locking everything up as you describe. Take a look at the older USB_Weather_Board code. In particular, we added a "connectionReset()" function to the SHT1x library, and in the main Weaher_Board_3.ino code we turn the I2C peripheral off when accessing the humidity sensor and back on when we're done with it. This solved our bus lockup issues. Note that this code is for the SHT15 not the HTU21D, but they appear quite similar to each other so it may help here as well. Good luck!

  • Lutorm / about 9 years ago / 1

    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.

    • Member #1116485 / about 7 years ago / 1

      SOLUTION (for me at least)

      I had a similar issue where the sensor would sometimes output humidity values over 100% (when I blew on it for example).

      In my case, it was solved by shorting the pullup resistor enable/disable pads with solder like in the pictures above (the blob between the two 472 SMD resistors). It didn't have this blob when I received it; there were three small, separate pads.

    • Member #109074 / about 9 years ago / 1

      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.

      • Lutorm / about 9 years ago / 1

        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.)

  • Member #387538 / about 10 years ago / 1

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

  • _Elliott / about 10 years ago / 1

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

  • rushidesai / about 10 years ago * / 1

    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.

  • marmarti / about 10 years ago / 1

    Vid 1 - Humidity and 4D Systems uOLED-128-G2 http://youtu.be/8JRTymzHmoM

    Vid 2 - Temp and 4D Systems uOLED-128-G2 http://youtu.be/3qJeOc7OALg

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

  • Member #294013 / about 10 years ago / 1

    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?

      • Makrull / about 10 years ago / 1

        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.

        • Makrull / about 10 years ago / 1

          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.

          • Member #432563 / about 10 years ago * / 1

            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?

            • Member #432563 / about 10 years ago * / 2

              Used the 330 ohm resistors and tied it with the OpenLog. Had it logging Temps and RH the first try. Great Job!!

  • shadfc / about 10 years ago / 1

    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

    • shadfc / about 10 years ago * / 2

      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 https://github.com/jwineinger/quick2wire-HTU21D

      • bennard / about 10 years ago * / 1

        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.

  • famzah / about 10 years ago / 1

    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.

      • bennard / about 9 years ago / 1

        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.

  • Member #286247 / about 10 years ago / 1

    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.

  • mcuaust / about 10 years ago / 1

    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.

  • Robdrech / about 10 years ago / 1

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

  • hlipka / about 10 years ago / 1

    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...

    • Blacklab1 / about 10 years ago / 1

      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.

  • Member #396428 / about 10 years ago / 1

    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

4.1 out of 5

Based on 10 ratings:

Currently viewing all customer reviews.

1 of 1 found this helpful:

Good sensor

This is a great way to include the HTU21 temp/humidity sensor in a project. The HTUxx sensors are widely used temp/humidity sensors with lots of information out there on how to use them with various micros. But they come in the difficult-to-deal-with surface-mount package so putting it on a breakout board makes it accessible to us "normal" makers. I like that they set this up for i2c but the one complaint I have is the solder jumper. I understand that including the pull-up is a convenience feature so the designer doesn't need to do it but a lot of boards already have the pull-up on the i2c bus so you have to de-solder the jumper pads on this thing to use it in these cases. And man... does that suck. The pads are so close to each other that you really need to suck all the solder off of them to make sure there isn't still a thread there. Even with a premium desolder wick it was a challenge. It would have been a lot nicer, in my opinion, to leave those pads clean and let me solder them if I needed the pull-up instead of defaulting it to on.

2 of 2 found this helpful:

As easy to use as it gets

This review is not only about the HTU21D breakout board, but about SparkFun as a whole.

I was starting to learn electronic (thanks to Arduino) when I fell upon SparkFun and it's been my crush for 2015. I like everything of it, from the website, to the quality of the pieces provided, going through the persons that answer emails, the articles, the lessons..

And all of that with a lighthearted, humorous tone, which make learning as fun as easy.

I am the kind of person who ask lots of question and its always been the an excellent costumer service. Now about the HTU21D piece itself, once the header are soldered and the linked to your Arduino, just launch the example and everything is working.

I bought a breadboard with the same chip on it from elsewhere (can't remember from where though) and it's been a real pain to make the library work. The one from SparkFun works on first try.

Thanks again for all the information, great products, great service. To all, have a great day.

Thank you for the kind words. Happy hacking!

1 of 1 found this helpful:

Does not hold up to sustained high humidity

I've now used 3 of these for my weatherstation here in Hilo, HI, where it rains more than 100" per year and the humidity usually hits 100% for at least a few hours per day. In all cases, the sensor has worked fine for about 6 months and then experienced a fairly sudden shift where it would saturate at humidity 118% unless the real humidity went down to 60% or so. This includes sensors that were wrapped in teflon tape, at Nathan's suggestion, and even after I desoldered the chip and replaced it with the version that has a built-in waterproof membrane.

The data sheet claims the sensor is ok with 100% condensing conditions, so it's unclear why this is happening. (Although I noted that the SHT15, another humidity sensor, has this in their data sheet: "Long term exposures to conditions outside normal range, especially at humidity >80%RH, may temporarily offset the RH signal..." It appears this one experiences a similar behavior.)

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. 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!

Very nice breakout board

Hardware & software worked as advertised.

Got it working after some fretting

Conflicting information on the hook-up guide. Code and bullet points in hook-up guide say need 10k resistors on datalines for 5V circuit, while further down diagram and text says resistors not required. I tried hooking up the circuit with 10k resistors inline initially with no results using the Arduino Uno R1. I removed the resistors and it started working immediately. Once it was working I am getting good and fast response values. I still need to verify if the reading is accurate but it's good enough for my application.

Sorry about the issue. You're right. This already has I2C pullups on board. You do not need additional resistors added. We are working to correct this mistake in our documentation. Thanks for working through it. Happy hacking!

Works great!

Haven't had any problems with it so far. Easy to use and provides fairly accurate temperature and humidity readings.

0 of 3 found this helpful:

50/50

Own two, but only one works.

gives good humidity and temp

Plugged it in and got good data, THis was nice compared to the TMP36

Great breakout!

I added headers, hooked it up, dowloaded the examples and it worked perfectly. I added a Thing and light sensor and am streaming that data to data.sparkfun.com. No problems!