HS1101 Humidity Sensor - C code
johnproko
Posts: 121
Hi all,
I have this sensor and want to put him to work.
I have read the pdf that is included (bs2) yet I am unable to understand the connection diagram and the code after modification is not showing a proper value.
Has anyone tried to write a C code? Could someone give me a picture of a plan english and for a dummy like me diagram for connection?
Thank you very much!
I have this sensor and want to put him to work.
I have read the pdf that is included (bs2) yet I am unable to understand the connection diagram and the code after modification is not showing a proper value.
Has anyone tried to write a C code? Could someone give me a picture of a plan english and for a dummy like me diagram for connection?
Thank you very much!
Comments
There are examples of spin code and Ard**n* C code in the Parallax HS1101 documentation.
Parallax, I have attached a copy of the pertinent page when I download (today) to my iMac. I have noticed the same problem on a lot of the older Nuts & Volts columns. Further info on request.
tc
You forgot to mention that you are using a Propeller.
Propeller C has an rc-time function that works similarly to the BS2 RCTIME command but the value that rc-time returns will not match the BS2 value since the Propeller is a lot faster than the BS2.
You should be able to use the same circuit as the BS2 but the 10M resistor may need to be changed depending on what values rc_time gives. The Linear Approximation formula was developed only for the BS2 so you will need to collect data points to come up with a Propeller formula.
For example running the shower for a while should close to 100% RH, while a very hot day in the desert will be near 0.
To come up with an accurate formula you will need some kind of reference for what the "true" RH is.
The more data points you have over a wider range, the better your approximation will be.
Excel or a scientific calculator will do Linear Regression and give you the slope and intercept value that you can then place in the program to get correct results.
This program builds in SimpleIDE but I don't have the sensor to test it.
To get data points I suggest you increase the pause value so you can record the rc_time value and then place a print statement after rc_time so you can see the raw rc_time value.
Good Luck!
I am trying to get the done but nothing.
All i get is 2709%. Currently using a BS2 because my propeller has no usb.
I copied the code from the sensors page pdf.
this is a photo of the wiring.
Hope it makes sense.
I used a 10M +- 10% parallel resistor and a 220 ohm resistor in series with I/O 7.
When I ran the program, I consistently got a "time" of just over 200. Multiplier by 10 yields just over 2000. Of course, when the correction factor of 12,000- odd is applied, the result goes negative and everything just gets worse from there on. And I got a humidity of 2300%, which is all wet.
I *do* think there is something wrong with Parallax's program or diagram or something.
I get a humidity from 2690 to 2718. I am trying to compare the result with the weather forecast.
Until now I am more confused than I was.
I measured RCTIME with values varying from 157 pF to 200 pF and got results varying from 1100 to 1370. I choose 1150 as corresponding to 0% humidity. So I plugged in 11500 for RHconstant and changed the divisor of 24 to 21 to get 100% to correspond to 200 pF.
I have used the Am2303 / DHT22 to measure humidity. Here is a link to a note I wrote using it with propellor.
Am2303 driver
I haven't tried it with BS2; I do not know if you can measure 50 usec pulses with BS2.