Maybe I'm not understanding how to use the analog voltage reading from the Arduino with this sensor.
If 0 is 0 volts, and 1023 is 5 volts, it looks to me like this sensor would output a value between 0 and 765 from analogRead()
I'm getting that 765 number by taking the maximum voltage output according to the datasheet (3.75 volts at 25 degrees C and 100%ish RH on average), and dividing that my the 4.9mV per unit that the analogRead function is supposed to return.. So :
3750 / 4.9 = 765.30
If 765.30 is the max the sensor should return, then getting the RH% should be to divide the value from analogRead() by 765, and multiply by 100, correct?
It can't be, so I'm clearly doing something wrong
I have this setup in my office and the average reading is 265, which by my calculation would me 34.6% RH - but that seems REALLY low. Unfortunately I don't have any way to verify that number. Can someone help?
No, the analogRead() is storing a value in an int.
I did all the math outside the Arduino. Right now the sketch just reads from the analog pin and sends that value to the serial port.
For example, right now I'm getting a pretty steady "280" from the sensor.
Doing the math on that, that's about 36% RH - and I seriously doubt that is accurate since that is only slightly higher than the average RH of the Sahara Desert
Looks like you edited your original reply.. I was relying on the (lacking) knowledge of a co-worker. He insisted that 30% wasn't accurate so I trusted him on it.
hello, im trying to read this sensor and ive got a problem.. the datasheet says that to read the sensor at 25 degrees C you must do this (VOUT - 0.958)/0.0307 .For example at Vout = 2V you get
(2 - 0.958)/0.0307 = 33.9%RH but if you look at the graph in Vout = 2V you should get 40%RH. Wich one is the correct method to read this sensor?
Well, this doesn't completely answer your question, but
(2-.958)/.0307 = 33.94, not 62. You subtracted .0958, not .958.
That's closer to the 40% value indicated by the graph as well as by the equation up in Table 1, though far enough away that there must be something else going on.