in arduino

HDC1000 temperature and humidity sensor breakout, with Arduino library!

Some time ago I came across a new chip from TI, the HDC1000. It’s a temperature and humidity sensor with I2C interface and requires little to no additional components. It comes in an 8BGA package: we can all agree it’s pretty small.
Some of the peculiar characteristics of this chip are that it has a DRDYn pin which goes low any time there is a new reading from the chip (so you can precisely time your requests) and that the sensor is located on the bottom of the IC, so that it’s not exposed to dust and other agents that may false the readings. Also, it has an integrated heater that can remove humidity from the sensor.

So I developed a very small breakout board for this chip as well as an Arduino library (yay, my first one! raspberryPi and nodemcu might come next).

The breakout boards.

I learned quite a lot about PCB design and soldering, effectively putting my new hot air station to good use.

Board layout

The boards were again fulfilled by DirtyPCBs, perfect for this kind of small projects.


So here are the pictures of my board…

Front view.

Front view.

Back view.

Back view.

Soldered and dirty.

..and here are the features:

  • Address selection jumpers: ADR0 and ADR1 are tied to GND by default but you can jump them to VCC in order to change the address of your sensor (default:0x40).
  • I2C pull-ups to VCC for SDA, SCL and DRDYn. If you don’t want to use the latter, just don’t solder the resistor and leave it floating.
  • 3-5V input, logic 5V tolerant (3.3V recommended).

Parts list:

  • IC1: HDC1000 sensor, you can’t really go wrong with the package since, sadly, it’s the only one.
  • R1,R2: 4.7k-10k ohm, 0805 package. I2C pull-up resistors.
  • R3: 10k ohm, 0805 package. Pull-up resistor to VCC, for the DRDYN pin. Leave the pin floating if not used.
  • R4, R5: 10k ohm, pull-down resistors to GND for address selection.
  • C1: 0.1uF cap, 0805 package.
  • JP1: 0.1″, 5-pin headers.

The board is 1.6×1.6 centimeters, and soldering that BGA chip (1.6×2 millimeters) wasn’t really that hard! I actually struggled more with the resistors, maybe because I used my ugly and huge 60W iron.

Here’s what I found works best:

  1. Solder the components in this order: resistors, IC, capacitor (on the back of the board), pin headers. If you do it any other way you will have trouble balancing the board, I found it the hard way.
  2. Apply a small quantity of flux on the pads (not on the middle of them, as it’s where the sensor lies..) – I used a flux pen.
  3. Place the IC on the pads without pre-tinning anything, and fire up your heatgun.
  4. If you aligned the chip correctly it will begin to stick to the pads by itself and you shouldn’t have to touch it anymore.

Of course you can do this with a reflow oven but using an hot-air gun it took me less than 3 minutes, for just the IC. You can’t solder this with a regular iron.

Note: the breakout boards should also be compatible with the HDC1008, but I haven’t tested it yet.

Now the best part…

The Arduino library.

Yesterday was a firsts day! (is this even remotely correct?) I soldered my first BGA and wrote my first Arduino library. I don’t think it’s quality code (there could be a lot to improve – should you feel compelled to do so, it’s on Github) but I tried to learn from both tutorials on the Arduino website and other libraries written by Ladyada and Seeedstudio.

How it works:

Just download (click!) and #include the library, declare your HDC1000 object and call the begin() function.

By default, the library is configured to enable both temperature and humidity readings, at 14-bit resolution, with the heater on. Also, the default address is 0x40. Should you want to change these features, you can declare your object like this (all the possible options are in the .h file – also check out the datasheet):

UPDATE 07/03/15: You can now use the DRDYn pin, which is pulled low by the chip itself when a new measurement is ready. It is off by default (drdyn_pin is set to -1).

By default, the sensor outputs temperature and humidity readings in a 14-bit format. Fortunately, the library automagically converts them into Celsius degrees (sorry, Americans!) and %. You can access them like this:

You can also access raw values using the getRawTemp() and getRawHumi() methods (which return uint16_t values).

One nifty feature of the HDC1000 is that it can detect if the battery that’s powering it is nearly flat.

The more tech-savvy of you can also read the registers’ configuration:

Full, super-basic sketch:

Sadly, I haven’t implemented the DRDYn pin yet, so I’m using a 20ms delay before reading the next value. I know that you can get the two readings at once (I send two separate requests to the chip) but I felt that there was no need to add another function to the library since you’d have to call two of them anyway.

As usual, leftovers (PCBs only!) are available in the store and on Tindie as soon as I get them approved. Design files on Github.

Let me know what you think – happy making!

Share on FacebookTweet about this on TwitterShare on Google+Share on RedditEmail this to someoneFlattr the authorShare on Tumblr

Write a Comment

Comment

 

17 Comments

  1. Good job on this board 🙂
    Regarding soldering, why don’t you try with soldering paste?
    You can be really precise with it using a tooth stick.
    Anyway the most important thing is that it works, after all ^^

  2. Francesco,

    Nice work, I wanted to do the same thing, but you did it!

    Got one question about soldering the HDC1000, you said you just applied flux and then used your air gun. What about the solder paste ? on your pictures it seems the board have little solder point on the HDC1000 pads, how did you got this ? your Pcb came with this solder from you manufacturer ? If so, how did you ask them to do this ? Really interested and curious.

    Thanks for your help

    • Hello Charles,

      I used no solder paste, mainly because I didn’t have any: the chip itself comes in BGA package and therefore already has tiny little blobs of solder under it. If you align them to the solder pads on the board and apply a little bit of flux (I used a flux pen) the blobs of solder will stick to the pads.

      Maybe this is not the best method and solder paste would have helped (maybe for larger chips with more pads?), but the soldering process was not that hard.

      Thanks for your interest!
      Francesco

      • Francesco,

        got it!!, I never took time to investigate on BGA package, but I’m happy to know that have little balls on it, it will help a lot and avoid a stencil creation, love this.
        The trick is may be not pulsing too many air to avoid chip moving. Just curious what temp did you use with your air gun ? with mine I always need to set it much higher that datasheet. I think it’s normal due to the fact that air is refreshing with ambient temp when it goes out, but I’ve been intrigued by this since I began to use it. Always fine to know how others work.

        Charles

        • Hello Charlie,

          I think I started with the heat gun at 200°C and then went up to 250°C. It was some time ago so I don’t remember exactly. As per the datasheet, the HDC1000 can withstand temperatures of 260°C, so don’t go higher than that!

          • Hi Francesco,
            Thank you for your answer, I ordered 2 PCB from your site and tried to solder the HDC1000 on them using the method you described. Unfortunately I wasn’t able to success. I Tried (after putting some flux, if I don’t the air flow was moving the chip away, so flux is also a good way to let the chip in place) from 200° (which was far away from melting anything) then increased step by step up to 350° (I know too much, but it wasn’t melting anything) which started to melt but not on every point and not very solid. I suspect my hot gun not reflecting the real temp, this is not the first time. When I solder ATmel328 I need to set temp to 350° before melt.

            By the way, I stopped trying after one hour of headache. Just to say that if you’ve got one or two PCB with HDC1000 left (just the HDC1000 not resistor or caps) I’d be happy to buy you. Just let me know.

          • Hello Charlie,

            I’m sorry you had problems soldering the HDC1000. I don’t remember the chip moving while being soldered: did you keep your heat gun perpendicular to the PCB and at its lowest speed? Also, an appropriately-sized nozzle might help you… my cheap “858D” hot air station did the job quite well! You can also put a small piece of solder on the PCB so that when it melts you know the temperature is right.

            Unfortunately, I don’t have more chips because TI only sent me one sample which is the one that I soldered to my own breakout board. Should you need any more PCBs, just drop me an email using the contact form!

            Please let me know if I can help you further.

            Cheers,
            Francesco

  3. Hi Francesco,

    Very cool job!!
    I’m designing a small board in Eagle and choose HDC1000 as well.
    Where can I find the library for schematic and the package for PCB in Eagle?
    I tried to download a library from element14, but I still couldn’t find them. Could you please help me with this?

    Thanks a lot.
    Lucas

  4. Hi Francesco,

    have a HDC1008 and was wondering if your HDC1000 is working with 5V?(mine 1008 is not).
    In case you used 3,3V, did you use a level shifter?

    • Hello Volker,

      the HDC1000 and HDC1008 should work with both 3.3V and 5V without the need for any level shifters, as long as the supply voltage matches the logic voltage of your microcontroller.

      You should power the HDC1008 with 5V (3.3V) only if your microcontroller has 5V (3.3V) logic: if you power it using 5V and connect it to a microcontroller with 3.3V logic, the chip will not be able to recognize the “high” signals, which have to be at least 0.7*VDD as per the datasheet.

      I tested mine with an Arduino Uno (5V) and an ESP8266 (3.3V) and it worked well in both cases… What device are you trying to connect it to?

      • I tried my HDC1008 with 5V on an arduino but it is not working, it stays off. Charlie’s idea is one to test, but I guess the problem is something else.

  5. Volker,
    That is strange, this sensor has the ability to work from 3V to 5V (this is what is claiming datasheet) which make a excellent choice other the concurrent such as SI7021 because it should not need a level shifter. Are you able to try make it working with 4.5V with 3xAA battery just to see ? Depending on your power quality, may be it is delivering little bit over 5V and that’s too much ? Just an idea.

  6. Francesco,
    Strange I can’t reply to the last answer you posted, si I’m doing it there. Yeah my heat gun was well oriented, but as I suspected, I took the Temp sensor of My PID reflow oven (http://www.ospid.com/blog/) and tested the output of my heat gun, far below of what’s indicated on the LCD, what I suspected. The other point is the airflow, even at lowest level sometime it’s flowing too much making the components moving. I think I need to take a look on my station to see the problem. it’s an AOYUE 852 http://shop.wiltec.info/product_info.php/language/EN/info/p2973_AOYUE-852-SMD-Rework-Station.html/XTCsid/b50dp3vqh9dhtbfcpg8tvtc0i4

    About the samples, yes only one HDC1000 on TI site, but on the same order I ordered 3 samples of HDC1008 (same but less precision) so I’ve got them but same thing was unable to solder them on PCB, really strange.

  7. After I got a bi-directional level converter for I2C I can confirm that the HDC1008 is working great with your code.

    Just use 3.3V, not more than that. Texas Instruments says it works with 3-5V but both of mine 1008er cannot handle 5V.

  8. Hi, the arduino lib is really cool!

    Here is a question, though:
    at HDC1000-Arduino/HDC1000.h line 41
    #define HDC1000_TEMP_11BIT 0x40
    Is the value possiblely 0x04?
    Since HDC1000 spec said the temp resolution is at Bit[10]…

    I maybe wrong since this is the first time I trying to understand I2C code.
    Just want to share the idea with you.

    • Hello Athena,

      you’re definitely right, thanks for finding it out!

      I’ve fixed it and updated the library on GitHub already 🙂

      Francesco

Loading Disqus Comments ...
Loading Facebook Comments ...