I'm using the HIH-4030 relative humidity sensor with an Arduino Uno an Ethernet shield and feeding the data to Cosm.com. The values that the sensor is returning don't make sense. It's been ranging from 600-800. I found some sample code on a website that Sparkfun linked to where they used a fix temperature value to calculate the relative humidity. Below I've included that code in the Code 1 section.

In the section Code 2 below that's the code I'm currently using to stream data to Cosm. How can I combine the fixed temperature value from Code 1 to the code in Code 2? If someone would be willing to explain I'd greatly appreciate it.

/*** Cosm Arduino sensor client example.** This sketch demonstrates connecting an Arduino to Cosm (https://cosm.com),* using the new Arduino library to send and receive data.** Requirements* * Arduino with Ethernet shield or Arduino Ethernet (board must use the* Wiznet Ethernet chipset)* * Arduino software with version >= 1.0* * An account at Cosm (https://cosm.com)** Optional* * An analog sensor connected to pin 2 (note we can still read a value from* the pin without this)** Created 8th January, 2013 using code written by Adrian McEwen with* modifications by Sam Mulube** Full tutorial available here: https://cosm.com/docs/quickstart/arduino.html** This code is in the public domain.*/

void loop() {// main program loopif (millis() - lastConnectionTime > connectionInterval) {// read a value from the pinint sensorValue = analogRead(sensorPin);// send it to CosmsendData(sensorValue);// read the datastream back from CosmgetData();// update connection time so we wait before connecting againlastConnectionTime = millis();}}

Krodal

I didn't check your code, sorry.But I think there is some confusion.The Honewell sensor returns the RH (Relative Humidity), regardless of the temperature. If you look at the datasheet, at figure 4, you see that the RH is a little different for 0 degrees and 70 degrees, but not that much.

I think that the bildr article is confusing.All you have to do is convert the raw analog value to a voltage, and the voltage to a RH.

When you want to know the dew point or something else, that is when some calculations are needed.

float GET_HUMIDITY(byte analogPin){/*[Voltage output (2nd order curve fit)] Vout=0.00003(sensor RH)^2+0.0281(sensor RH)+0.820, typical @ 25 ºC and 5VDC supplythe equation was found on http://www.phanderson.com/hih-4000.pdf and a better / more ledigible typical output curve can be found at http://sensing.honeywell.com/index.php/ci_id/51625/la_id/1/document/1/re_id/0

as an example, assume Vout = 2.0 volts, (sensor RH) would then equal 40.9002 %looking at the ledigible typical output curve, it can be seen that at 2.0 volts the best linear fit curve is just a little more than 40% indicating the calculation is correct*/