Shop OBEX P1 Docs P2 Docs Learn Events
Newbie - Thermostat help — Parallax Forums

Newbie - Thermostat help

ColtColt Posts: 24
edited 2008-01-20 05:31 in BASIC Stamp
··· Pretty simple question for most of you guys, most of yall are way out of my league, almost feel stuipd for posting· LOL


··· Here's what I got....·· Using a BS2, I'm trying make a thermostat to control a small travel refrigerator.. I keep my meds in it ( insulin ), during the summer it can run all the time no problem since I only see a 30 degree Delta - T from it. In the house I use a 400W power supply from a computer to run it.· During the winter though, the heat setting will get way to hot..·· I just need to maintain around 36-60 degree's or so, insulin isnt too temp sensitive other than it cant freeze, nor can it get to hot..

··· So here's what I started with, but I'm stuck....··· I using a thermistor, and BS2 to run RCtime, I could care less about the actual temp, I'm just using resistance readings basicly..· That part works great, at room temp I get a reading of 180, at 90 degree's it reads 60, so as the temp gets cooler the number goes higher...··· What I cant figure out is how to control I/O pins based on the RCtime reading..·

··· When I called it quits last night I was thinking that using LOOKUP and LOOKDOWN would be the way to do it..·· But will it work like this?? ( just a general code, I'll revise it when I figure out what I'm actually doing LOL )........· I'd like to be able to cycle the frig on and off at a certain temp, and also beable to switch from heat to cool, so when the temps get below lets say 36 degree's it would shut off, unless the temp falls below 34 degree's..· Like I said, I could care less about temp reading, doing it by RCtime..

··· IF IN2 < 100 THEN
··· LOW 4
···
··· IF IN2 > 100 THEN
··· HIGH 4

··· In that example I'd basicly be turning the fridge off if the reading is less than 100, or turning it on if greater than 100..·· If using LOOKDOWN, would it work like that??·· Thats ofcourse just a rough code, once I know whats going on then I'll make my changes...

·· I know there are several easier ways to go about doing this, like the DS1620 for example.. I'm a transport refrigeration tech, so needless to say coming up with a cheap T-stat to do what I want would be easy..· But I dont learn much doing it like that...···Really I dont care what the fridge does, it stays on cool all the time and I dont worry about it, it's just a project to·help me learn out to control I/O pins using a index· I'd appreciate any help you guys can give me smile.gif

Comments

  • ColtColt Posts: 24
    edited 2008-01-20 02:54
    ·· Nevermind, I think I've figured it out......··· Once I write the code and see if it all works like I want it to I'll post back for future reference...
  • ColtColt Posts: 24
    edited 2008-01-20 05:31
    ··· Ok I got it, I looked at "Industrial Control·", and it has a code simliar what I was wanting.. The code is to control a water heater.. But I modified it to what I needed, took about 15 mins once it clicked in my head what I needed to do.. Although I'm not done with it yet, where it's at now would do what I want in a simple form.. When it's done it will control 3 outputs, 2 to control a relay to heat or cool depending on conditions, the other will shut off·the power supply to the cooler. Simple enough..· I dont know when I'll take it from the bench to the cooler, I'll make up a harness so all I have to do is plug the BS2 into it and load the code.. Like I said, it's just something to play with..


    ·· Here's the source code I have now, not the full control I wanted at this point, but a good starting point for someone else...

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    LED1· VAR· OUT4····· 'Defines LED As OUTPUT 4
    RC··· CON· 2············ 'RCTIME At PIN 2
    TEMP· VAR· Word····· 'TEMP is the variable
    OUTPUT 4
    LED1 = 1
    MAIN:
    GOSUB READTEMP
    GOSUB CHECKTEMP
    PAUSE 3000
    GOTO MAIN

    READTEMP:
    HIGH RC
    PAUSE 10
    RCTIME RC, 1, TEMP
    TEMP = TEMP
    DEBUG "TEMP = ", DEC TEMP, CR
    RETURN
    CHECKTEMP:
    IF (TEMP >100) OR (LED1 = 1) THEN CHECKOFF· ' If temp is greater than 100, then turn LED ON
    LED1 = 1
    DEBUG " Temp below 100, LED is on", CR

    CHECKOFF:
    IF (TEMP <100) OR (LED1 = 0) THEN CHECKDONE· 'If temp is less than 100, then turn LED OFF
    LED1 = 0
    DEBUG " Temp above 100, LED is off", CR
    CHECKDONE:
    RETURN
Sign In or Register to comment.