HS 1101 Sensor
Klap
Posts: 65
I am using the HS 1101 Sensor with the Propeller chip.
I have everything hooked up and working as shown in figure 1 (minus the 220 ohm resister):
http://www.parallax.com/Portals/0/Downloads/docs/prod/sens/27920-HS1101-v1.0.pdf
But now I am not sure what RHconstant to use. Has anyone used this sensor and found a good RHconstant yet?
Using this equation: time := (phsa*10 - 12169)/24 #> 0
Here is all of my code:
The numbers I am getting are just too high. Am I using the right slope? Or do I just need to offset the numbers?
I have everything hooked up and working as shown in figure 1 (minus the 220 ohm resister):
http://www.parallax.com/Portals/0/Downloads/docs/prod/sens/27920-HS1101-v1.0.pdf
But now I am not sure what RHconstant to use. Has anyone used this sensor and found a good RHconstant yet?
Using this equation: time := (phsa*10 - 12169)/24 #> 0
Here is all of my code:
'' HS1101 '' -- Aaron Klapheck '' -- 7 July 2010 CON _clkmode = xtal1 + pll16x ' use crystal x 16 _xinfreq = 5_000_000 OBJ debug : "FullDuplexSerialPlus" PUB main | time 'Beep to initialize routine. ctra[noparse][[/noparse]30..26] := %00100 ctra[noparse][[/noparse]5..0] := 0 frqa := 112_367 dira[noparse][[/noparse]0]~~ waitcnt(clkfreq*2 + cnt) ctra := frqa := 0 waitcnt(clkfreq/2 + cnt) debug.start(31, 30, 0, 9600) debug.str(string(debug#CLS)) ' setup screen debug.str(string("Humidity")) ctra[noparse][[/noparse]30..26] := %01000 ' POS detect mode ctra[noparse][[/noparse]5..0] := 11 frqa := 1 repeat 'Charge RC circuit dira[noparse][[/noparse]11] := outa[noparse][[/noparse]11] := 1 waitcnt(clkfreq/100_000 + cnt) ' wait for 10 microsecond 'Start RC time decay measurement. phsa~ dira[noparse][[/noparse]11]~ waitcnt(clkfreq + cnt) ' wait for 1 second time := (phsa*10 - 12169)/24 #> 0 'Display Result debug.tx(debug#CRSRXY) debug.tx(1) debug.tx(1) debug.str(String("time = ")) debug.dec(time) waitcnt(clkfreq/2 + cnt)
The numbers I am getting are just too high. Am I using the right slope? Or do I just need to offset the numbers?
Comments
If thats the case I·think you could change the line.
·with
I am surprised that no one at Parallax has worked with this sensor before.
I found Tracy Allens site very helpful.
http://www.emesystems.com/BS2rct.htm
Edit:· I also adjusted for the difference in 5v and 3.3v charge times, So my formula·suggestions are most likey wrong.· I will·look at·my code after work today and see if I can·be more helpful.
Post Edited (agfa) : 7/6/2010 11:59:44 AM GMT
Apparently you don't need to divide or multiply by anything. I am not sure the slope of the line is right though. I am also getting reading that are fluctuating between 39% and 44%. I don't think there should be than much fluctuation from second to second.
The documentation describes using a RH gauge to create the plot.· The plot was used to get the RH constant and the divisor.· That is probably the best way to get it.
My code only·returned a value·for capacitance.· But there is enough information in the documentation to get a new constant.· You could use the plot to get a range of capacitance values by converting the RC times to actual time and using the RC discharge constant for the stamp then re-plot using the discharge constant for the prop. Then convert to the time units to 12.5 ns.
If you look at the plot, the constant is the time value for 0% RH multiplied by 10.· The divisor can be found by taking a·time value other than 0%RH subtracting the raw constant then dividing by that RH.
The link I gave will show you how to get the discharge constant and the RC constant.
That is the way I would do it.· When I get some more time I will do the conversion, out of curiosity.
I'm sure, if there is an easier way, someone else will chime in.
Sorry I couldn't be of more help.
agfa