# Renewable Energy Innovation

For a new project I am looking at measuring weather data in remote locations. This is for a low-cost, low-power wind data logging unit.
The main parameter to record is, of course, the wind speed and I am doing this with ten minute averages from a pulse-output anemometer.
While this data is useful, it would be even more useful with wind direction, temperature and humidity as all of these factors affect the wind potential.
While I was planning this project, I was contacted by the folk at Embedded Adventures who asked me to check out some of their kits. (I had blogged about their sound module which I had used in another project).
So to record additional data along with the wind speed, I decided to try out Embedded Adventures Humidity and Temperature sensor (MOD-1017).

# What is Relative Humidity?

The temperature is given in degrees C. The Humidity is give in % relative humidity

Relative Humidity is a term I have used, but didn't really know what it meant. So here are more details, taken mainly from here and here:

Relative humidity is the ratio of the current absolute humidity, compared to the highest possible absolute humidity (which depends upon the temperature).
Absolute humidity is the mass of water divided by the mass of dry air in a given volume at a given temperature. The hotter air is, the more water it can contain.

100% relative humidity means the air is saturated with water and cannot hold any more.
As we sweat, we rely upon air to get rid of moisture. If the relative humidity is high, then the sweat will not evaporate and we feel hotter than at lower humidity's.

# HIH-6130

The MOD-1017 uses the HIH-6130 IC from Honeywell. It 'talks' in I2C, so quite easy to interface and provides 14 bit temperature (+/- 1C) and 14 bit humidity (+/- 4%) data. This is a very high accuracy component. So here is a post about getting started with the sensor.

The HIH-6130 is the tiny surface mount IC on the left of the PCB.

# Connection to Arduino

I wired it up to an Arduino Uno. On the Arduino Uno the I2C interface is connected with SDA (serial Data) to Analog pin A4 and SCK (Serial Clock) to Analog pin A5. I also applied 5V power, via the USB port.
I checked out the Embedded Adventures document, but there is not any data on how to read data from the sensor.
For that we need to find the HIH-6130 datasheet.  Also, here is a technical note on using the HIH-6130.

I was trying to rig this up with an Arduino, so it was even better to find someone who has done this before.
There is also an arduino library here.

I downloaded the arudino library above and opened up the examples. When trying to upload the example it came up with the errors:

example:6: error: 'HIH61XX' does not name a type
example.ino: In function 'void loop()':
example:19: error: 'hih' was not declared in this scope

This turns out to be due to the difference in directory structure between Arduino IDE versions.
To solve this error I needed to move "HIH61XX.cpp" and "HIH61XX.h" from the "HIH61XX" folder and up one level to the "HIH" folder. This was a difference between IDE versions 1.0.3 and 1.0.5, apparently.

I set it running with a serial terminal open and started to get some data. This example has been set up to output the data both as raw and converted data as shown here:

Humidity: 0.57643 RH (9443)
Temperature: 17.39043 C (5698)

It then stops and monitors the serial line for commands. The commands are:

'h' = Humidity
't' = Temperature
'p' = Power pin (if you don't want to power the sensor all the time, you can power it from an output pin)
'u' = Update
'1' = Start
'0' = Stop

If you want the device to take new readings then first 'u' for update (to take a new reading) and then use 'h' and 't' to give humidity and temperature data back. When tested this worked well.

# Testing the module

I have wired up the MOD-1017 into a datalogger unit that is undergoing testing outdoors. The logger is shown below. I will post more details about this when I have a bit more data. It is based upon the dataduino unit, which I sell.

The sensors needs to measure outdoor humidity and temperature, hence the IC needs to be out in the air. I drilled a small hole in the base of the logger unit to allow sensing, but hopefully not allow any rain or too much moisture in.

Edit 11/2/14:

Here is some data from my workshop using the datalogger. Three parameters are shown: Temperature, Humidity and Battery Voltage. Its interesting to see the temperature change when I arrive into my workshop (around 9am) and the corresponding humidity drop. The temperature drops and the humidity rises when I have left my workshop (around 3.30pm). Battery voltage data is being collected to see battery lifetime in this application.

# Going further with the HIH-6130

To 'talk' to each sensor on the I2C bus, each device is given the standard address 0x27 (or 39 in decimal). This can be changed, but I didn't do that for this first test, as there are no other devices attached.
Data can be transferred at 100kbits/s or 400kbits/s in "fast mode". Just normal mode is good enough for us at the moment.

If you would like to change the address of the sensor (say you have more than one sensor, or the address clashes with another device) then here is some information on changing the EERPOM on the IC.

The sensor consumes around 0.7mA when powered up. It can be powered by an Arduino output pin (and that is how the Arduino library is written). The problem is that when the device is powered down, it can interfere with other I2C data transmission, so this can only be done when there is just the humidity sensor attached to the I2C bus.
I had a problem with that as I am also using a real time clock (RTC) on the I2C bus. This meant that when the MOD-1017 was powered down it would stop the communication with the RTC. This was solved by keeping the unit powered all the time, but this is a waste, especially when used in datalogging applications. Apparently the correct solution is to use some form of electronic switch to break the SDA connection to the device. This allows the other devices on the I2C bus to function correctly.
I will look into implementing this as saving 0.7mA over a long period of time would be very useful for this long-term remote stand-alone data-logging application.