You can easily wire this breakout to any microcontroller, we'll be using an Arduino. For another kind of microcontroller, just make sure it has I2C, then port the code - its pretty simple stuff!
- Connect Vin to the power supply, 3-5V is fine. Use the same voltage that the microcontroller logic is based off of. For most Arduinos, that is 5V
- Connect GND to common power/data ground
- Connect the SCL pin to the I2C clock SCL pin on your Arduino. On an UNO & '328 based Arduino, this is also known as A5, on a Mega it is also known as digital 21 and on a Leonardo/Micro, digital 3
- Connect the SDA pin to the I2C data SDA pin on your Arduino. On an UNO & '328 based Arduino, this is also known as A4, on a Mega it is also known as digital 20 and on a Leonardo/Micro, digital 2
The HDC1008 has a default I2C address of 0x40
Download Adafruit_HDC1000
To begin reading sensor data, you will need to download Adafruit_HDC1000 library from the Arduino library manager.
Open up the Arduino library manager:
Search for the Adafruit HDC1000 library and install it
We also have a great tutorial on Arduino library installation at:
http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use
Load Demo
Open up File->Examples->Adafruit_HDC1000->HDC1000test and upload to your Arduino wired up to the sensor
Thats it! Now open up the serial terminal window at 9600 speed to begin the test.
Please note: TI has indicated that there's a 'settling' effect for the humidity and that you will need to re-hydrate the sensor once you receive it. To rehydrate it, place it in a location with 85% humidity for 24 hours or 60% humidity for 10 days.
Library Reference
The library we have is simple and easy to use
You can create the Adafruit_HDC1000 object with:
Adafruit_HDC1000 hdc = Adafruit_HDC1000()
There are no pins to set since you must use the I2C bus!
Then initialize the sensor with:
hdc.begin()
if you aren't using the default 0x40 i2c address, you can pass in the i2c address to begin to have it use that one instead.
hdc.begin(0x42)
this function returns True if the sensor was found and responded correctly and False if it was not found
Once initialized, you can query the temperature in °C with
hdc.readTemperature()
Which will return floating point (decimal + fractional) temperature. You can convert to Fahrenheit by multiplying by 1.8 and adding 32 as you have learned in grade school!
Reading the humidity is equally simple. Call
hdc.readHumidity()
to read the humidity also as a floating point value between 0 and 100 (this reads % humidity)
Text editor powered by tinymce.