Shop OBEX P1 Docs P2 Docs Learn Events
HS2000DD humidity temp sensor — Parallax Forums

HS2000DD humidity temp sensor

JTCJTC Posts: 60
edited 2007-03-25 01:30 in Propeller 1
Has anyone used this humidity temp sensor. I am interested in the serial one. The HS2000DD.
http://www.preconusa.com/shopping/store/agora.cgi?cart_id=5246.3411*rn6dP6&xm=on&product=Humidity
Thank You
Jim

Comments

  • JTCJTC Posts: 60
    edited 2007-03-14 03:46
    · Well, I got the humidity /· temp sensors in today and will start connecting them tomorrow.
    · Results coming.
    Jim
  • JTCJTC Posts: 60
    edited 2007-03-24 13:17
    · I have it reading RH and Temp in deg C.

    ·I used the RX form the fullduplexSerial.spin obj.

    I created a buffer and read byte by byte into it. The sensor ends with a CR.

    I do have a question I need two instances of the serial obj. I created an obj array

    HC2000DD[noparse][[/noparse]2]········ :· fullduplexSerial

    I started each using different recieve pins. It compiled OK

    and I can read the HC2000DD[noparse][[/noparse]1] but I am not reading the

    HC2000DD[noparse][[/noparse]2] data . Am I doing this correctly ?

    I don't have the actual code here or I would include it.

    Thanks

    Jim
  • JTCJTC Posts: 60
    edited 2007-03-24 14:46
    · Here is the code I am having problems reading the second instant of the serial obj

    · It hangs when trying to fill the buff with second sensor data

    ·I know RX will wait until it gets data so I assume it is not reading the proper pin ???

    What am I missing here ??

    {{=============================================================================
    ·
    ·James Cullins
    ·Sound Logic
    ·March 24 2007
    =============================================================================·· }}

    CON
    · _clkmode = xtal1 + pll16x
    · _xinfreq = 5_000_000

    · ' Serial sensor Constants
    ·HTEna1····· = 0··············· ' power to· HS2000D sensor1·
    ·rxpin······ = 1··············· ' data from HS2000D sensor1
    ·HTEna2····· = 9··············· ' Power to· HS2000D sensor2
    ·rxpin2····· = 10·············· ' data from HS2000D sensor2
    ·mode······· =1000
    ·baudrate·· = 9600
    ·Txpin = 40·························
    ····· '· TV· Constants
    · CLS········ = $0····································· ' clear screen
    · CR········· = $D····································· ' carriage return
    · Deg········ = $B0···································· ' degree symbol
    ·· ' CD4094 Constants
    · LSB = 0
    · MSB = 1
    · Dpin· = 8
    · Cpin· = 27
    · StrobePin = 7
    OBJ

    ·
    ·TV··········· : "tv_text"
    ·HTSense[noparse][[/noparse]2]··· : "FullDuplexSerial"
    ·fp··········· : "FloatString"
    ·f············ : "Float32"
    ·FM··········· : "FloatMath"
    ·Relays······· : "Relays"········ 'send relay data
    VAR
    ·· long·· bufr_ptr
    ·· BYTE·· BUFF[noparse][[/noparse]16]················· ' sensor 1 buffer·
    ·
    PUB main | TempC,TC,TempC2,TC2, RH,RH2,RHumidity,RHumidity2,TCf, dewC ,Dewf,TCf2, dewC2 ,Dewf2, Rdata,I,Q· ,color
    ·
    ·· HTSense[noparse][[/noparse]1].start(rxpin, txpin,mode , baudrate)····
    ·· HTSense[noparse][[/noparse]2].start(RxPin2, txpin,mode , baudrate)
    '' Start serial driver - starts a cog
    '' returns false if no cog available
    ''
    '' mode bit 0 = invert rx················· 1000
    '' mode bit 1 = invert tx
    '' mode bit 2 = open-drain/source tx
    '' mode bit 3 = ignore tx echo on rx
    · 'TV..start(16)······································· ' start VGA TV.inal
    · TV.start(4)······································ ' start TV TV.inal
    · f.start·············································· ' start floating point object··
    · TV.out(CLS)········································ ' display title
    · setColor(6)
    · displayString(0,· 5, string("·· Cooling Tower Controller· "))
    · setColor(0)

    · ' read sensor and update display every 2 seconds
    ·· Rdata :=0
    · repeat
    ···
    ··· DIRA[noparse][[/noparse]HTEna1] ~~···························· ' make output
    ··· DIRA[noparse][[/noparse]HTEna2] ~~···························· ' make output
    ··· OUTA[noparse][[/noparse]HTEna1] := 1·························· ' power sensor1· ON
    ··· { fill the buffer from· HS2000DD sensor1}
    ··· I:= 0
    ··· repeat until HTSense[noparse][[/noparse]1].RX == "H"·············· ' locate first char
    ··· repeat until I == 12·······
    ····· Byte[noparse][[/noparse]@BUFF+I] := HTSense[noparse][[/noparse]1].RX··············· ' read in RH1 and TempC1
    ····· I := I+1······
    ··· OUTA[noparse][[/noparse]HTEna1] := 0
    ······················· ' power sensor2 Off
    ··· { extract the info from the buffer}
    ··· setColor(0)
    ··· displayString(2, 1, string("RH1:"))·
    ··· RH := (Buff[noparse][[/noparse]1] -"0" )*100····
    ··· RH := RH+ ( Buff[noparse][[/noparse]2]· -"0" )*10···
    ··· RH := RH+ ( Buff[noparse][[/noparse]4]· -"0" )
    ··· RHumidity := FM.FFloat(RH)····
    ··· RHumidity := f.FDiv(RHumidity, 10.0)
    ··· TV.str(fp.FloatToFormat(RHumidity, 5, 1))···
    ··· TV.str(string( "%"))
    ···
    ··· displayString(2, 22, string("Temp1:"))··
    ··· TC := (Buff[noparse][[/noparse]8] -"0" )*100····
    ··· TC := TC + ( Buff[noparse][[/noparse]9]· -"0" )*10···
    ··· TC := TC + ( Buff[noparse][[/noparse]11]· -"0" )···········
    ··· TempC := FM.FFloat(TC)
    ··· TempC := f.FDiv(TempC, 10.0)
    ··· TV.str(fp.FloatToFormat(TempC, 5, 1))
    ··· TV.str(string(deg, "C"))
    ···· TV.out(13)
    ··· setColor(0)
    ···· { fill the buffer from HS2000DD sensor2 }
    ····
    ··· OUTA[noparse][[/noparse]HTEna2] := 1························ ' power sensor2· ON

    ··· I:= 0
    ··· repeat until HTSense[noparse][[/noparse]2].RX == "H"·············· ' locate first char
    ··· repeat until I == 12·······
    ····· Byte[noparse][[/noparse]@BUFF+I] := HTSense[noparse][[/noparse]2].RX·········· ' read in RH2 and TempC2
    ····· I := I+1

    ··· OUTA[noparse][[/noparse]HTEna2] := 0
    ···
  • Tracy AllenTracy Allen Posts: 6,660
    edited 2007-03-24 19:32
    Hi James,

    You might need a % in front of your mode variable. I'm not sure why the txpin is 40. I'm not sure what to do with it if it needs to be disabled. Maybe an open baud mode, so that it doesn't get in the way while resting as an input.

    From a hardware standpoint, is the power going on okay to the second sensor and is there activity on the second pin? Does it work if the sensors if the rxpin definitions are swapped?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • JTCJTC Posts: 60
    edited 2007-03-24 20:54
    I can read the first sensor fine. So I guess the mode is fine What does the % operator do for it?

    Well I guess I could check my manual. (:-)

    Just not the second one. It is turning power on to it and I can see data coming out.

    Just can't read it.

    The TXpin I am not using It so I·put it to 40 so it would not use a· pin. How ever I have tried it on a pin not yet used and it worked.

    Yes it works fine if I swap pins so it looks like the software is just not using the pin assigned ??
    Thank you
    Jim
  • JTCJTC Posts: 60
    edited 2007-03-25 01:20
    Tracy,

    ···· I solved it. Not as elegant as a software fix but works vey well.

    I used a 1N4148· diode in seres with the data pin on each sensor, wired their cathodes together

    ·to pin 1 wih a 10K resistor·pull down . Then use a seperate pin to turn power on to the one I wish to read and read it.

    Thank you very much for your emails

    Jim Cullins

    Sound Logic
  • JTCJTC Posts: 60
    edited 2007-03-25 01:30
    Tracy,

    ··· Forgot to· tell you the pin # wrap around so the 40 assigned to the TX pin ended up on pin8 , which

    happen to be one of my shift regerster pins. That took an hour or so to figure out, Should have know better .smilewinkgrin.gif

    Jim
Sign In or Register to comment.