Automated CLimate Control
Hello, i want to make a project which will conttrol temperature
i have the source code but i don't have a connection diagram, and i want to eliminate cooler
I also don`t know how to use PLX-DAQ to send results to excel sheet in my PC. Do you have any idea/suggestions how can i do that?
Thanx a lot!
i have the source code but i don't have a connection diagram, and i want to eliminate cooler
I also don`t know how to use PLX-DAQ to send results to excel sheet in my PC. Do you have any idea/suggestions how can i do that?
Thanx a lot!

Comments
1) Try to contact the people who did this project. They may have a writeup that they're willing to share.
2) Complex projects like this one are built up a piece at a time. Parallax has many of the pieces you'd need and they have examples and documents for each of these separate sensors, etc.
3) Look through the Nuts & Volts Columns and the tutorials, particularly Column #91. From Parallax's main webpage, click on the Resources tab to get to the Columns and click on the Downloads button to get to the Tutorials page. In particular, you might want to look at the Process Control tutorial, the Industrial Control tutorial, and the Smart Sensors tutorial.
4) Download PLX-DAQ from the Stamp Software page via the Downloads page. There's a manual included that describes how to use it.
I have experimented some with what your looking for it think
monitoring temp & humidity , and displaying and controlling them tru a webpage served by the wizet
maybe you should check the old post on that
I have a :
Basic stamp 2 development board.
a BS2-IC module rev J
a PC brushless fan 12 V , 0.56 Amps
a SHT15 temp&humid sensor
and i don`t know which relays are good for powering my fan. i found in stores Solid state relays but are to expensive. I want to use electromagnetic because are cheaper. Can i use that instead?
and still, i don`t know how to link PLX-DAQ with the sensor to send my temp&humid readings to excel sheet. i red the help file, but i`m a bit confused.
do you know how could i do that?
I see that you used a propeller board, which is quite different than mine, and you bought a website module from wizet which stores the data on a website.
But i don`t need that. i only want to save data on excel sheet.
Thank you
I dont know if the stamp is up to all that , I only have some experience with the propeller , it has 8 cores . so you can kinda say its 8 stamps in one ,, to better suit the job .
There is no data being stored on a website , the wiznet acts as a small server itself and hosts this webpage , tru the webpage you could see the actual data that is being read by the sensor
at some point i decided to put all the html code out of the propeller and onto my server that I have running at home cause the html was stored on eerprom and was eating large chunks of memory , I was running out of space .So was forced to
I could have put the sd card in and solve it by putting all the code on the sd card ant let the prop send it to the wiznet , but i just didnt want to implement it for the function it had . maybe for you a better idea to use a sd card , you need it anyway if you want to save the data you record ,.
, I used a sht-11 (probably not alot different then yours) .
At the time I bought it at mouser because it was new and there warent any drivers andso for it . Now day you have a verry good start sourcecode of Mike G for the wiznet . and there is a quickstartboard expansion of the wiznet , so ist a snap on and your ready to go (quistart i see is out of stock , maybe you could get a second hand one orso ).
Thats if you want it to have net connectivity and be monitored and controlled via any browser in the network .
You could always just ad a sd-card to the prop , and let it store all the data on there and import it later to the excel sheet
I have to say i struggled with the PLX-DAQ myself without understanding it and gave up and went for this approach , so I cant help you with that
if you want to monitor via network and let the microcontroller do the monitoring and controlling then I think you will need a prop anyway ,
I my situation the 8 cores were used like below
4 cores to run the wiznet and keep communications with the network
1 core that continuasly monitors the sensores .
1 core that runs the main program ( flowchart - if this then that )
1 core to run a display on the prop and interface tru a few buttons
can be optiized of course , and i havent looked at it for a while
but it does work verry nicely
if its a scool project , 1 thing I knoow , If you can let the teacher take his/her smartphone out of his pocket , go to a website ,. .login . see the graps running and be able to controll it . He wil be SOLD ! .
Claiudiu,
What you want to do sound exactly what is talked about in Industrial Control and Product Control both of which can be downloaded from the Parallax website. These books use a different sensor hooked up to an Analog-to-Digital-Converter (ADC) and the small 12V fan is control by a Transistor and data is recorded and graphed using a program called StampPlot. In Industrial Control the goal is to keep the temperature consistent in an incubator but a computer case is similar. You of course know that there are PC cooling kits that you can buy that have fan controllers and some even have fancy digital displays.
Brian
Photos:
http://i.imgur.com/Mdzg0q8.jpg
http://i.imgur.com/diyxPpY.jpg
http://i.imgur.com/PQlyG1E.jpg
http://i.imgur.com/KcZtREa.jpg
and source code:
http://dfiles.eu/files/7gw8a1czm
' ============================================================================== ' ' {$STAMP BS2e} ' ' ============================================================================== ' ------------------------------------------------------------------------------ ' I/O Definitions ' ------------------------------------------------------------------------------ ShtData CON 6 ' bi-directional data Clock CON 8 cnt VAR Word '-----Constant declarations------ '**************Variables for light sensor********************* S0 CON 0 'Sensitivity selection pins S1 CON 1 IN CON 2 'TSL230 output pin input to controller OUT CON 3 'Output to LED1 LED1 CON 4 'Output to LED2 LED2 CON 5 'Output To LED3 relay CON 7 'Connection to fan through relay relay1 CON 9 'relay for cooling equipment relay2 CON 12 'relay for humnidifier humid_fan CON 13 'relay for dehumidifier '*************Variables for tmp/hum sensor******************** ShtTemp CON %00011 ' read temperature ShtHumi CON %00101 ' read humidity ShtStatW CON %00110 ' status register write ShtStatR CON %00111 ' status register read ShtReset CON %11110 ' soft reset (wait 11 ms after) Ack CON 0 NoAck CON 1 No CON 0 Yes CON 1 MoveTo CON 2 ' for DEBUG control ClrRt CON 11 ' clear DEBUG line to right DegSym CON 186 ' degrees symbol for DEBUG ' ------------------------------------------------------------------------------ ' Variables ' ------------------------------------------------------------------------------ ioByte VAR Byte ' data from/to SHT1x ackBit VAR Bit ' ack/nak from/to SHT1x toDelay VAR Byte ' timeout delay timer timeOut VAR Bit ' timeout status soT VAR Word ' temp counts from SHT1x tC VAR Word ' temp - celcius tF VAR Word ' temp - fahrenheit soRH VAR Word ' humidity counts from SHT1x rhLin VAR Word ' humidity; linearized rhTrue VAR Word ' humidity; temp compensated status VAR Byte ' SHT1x status byte tempthresh VAR Word ' temp Threshold humiditythresh VAR Word ' Humidity Threshold lightthresh VAR Word ' Light Threshold counter VAR Nib ' ------------------------------------------------------------------------------ ' EXCEL VARIABLES ' ------------------------------------------------------------------------------ sPin CON 16 'Serial Pin - P16, Programming port Baud CON 84 'Baud mode for a rate of 9600, 8-N-1 ' ------------------------------------------------------------------------------ ' EEPROM Data ' ------------------------------------------------------------------------------ ' ------------------------------------------------------------------------------ ' Initialization ' ------------------------------------------------------------------------------ LOW S0 'Set sensitivity pins (S0,S1) to x10 HIGH S1 Initialize: GOSUB SHT_Connection_Reset ' reset device connection PAUSE 250 ' let DEBUG window open ' ------------------------------------------------------------------------------ ' Program Code ' ------------------------------------------------------------------------------ 'SEROUT sPin,Baud,["CELL,SET,B4,",DEC cnt,CR] 'Send Current Light to Excel Sheet MAIN: SEROUT sPin,Baud,[CR] 'Send a lone CR to ensure PLX-DAQ buffer is ready '******************************************LCD DISPLAY********************************************** SEROUT 10, 84, [22, 12, 17] 'PORT #10 SEROUT 10, 84, [128, "TEMP HUMID LGHT", 148, DEC (tC / 10), ".", DEC1 tC, 154, DEC (rhTrue / 10), ".", DEC1 rhTrue, "%", 161, DEC cnt] '*************************************TEMPERATURE SENSOR******************************************** GOSUB SHT_Measure_Temp DEBUG MoveTo, 0, 3 DEBUG "TEMPERATURE ", CR DEBUG "soT...... " DEBUG SDEC soT, ClrRt, CR DEBUG "tC....... " DEBUG SDEC (tC / 10), ".", SDEC1 tC, DegSym, ClrRt, CR SEROUT sPin,Baud,["CELL,SET,B2,",SDEC (tC / 10), ".", SDEC1 tC,CR] 'Send Current temprature (C) to Excel Sheet DEBUG "tF....... " DEBUG SDEC (tF / 10), ".", SDEC1 tF, DegSym, ClrRt, CR SEROUT sPin,Baud,["CELL,GET,B1,",CR] ' Read Temprature Threshold from the Excel Database SERIN sPin, Baud,200,Timeout1,[SDEC tempthresh] ' Set Threshold Value to the read value DEBUG "tempthresh...", tempthresh, CR, CR MAIN3: tempthresh = ((tempthresh*10) + 400)*10 SEROUT sPin,Baud,["CELL,SET,C7,",SDEC tempthresh,CR] 'Send Set temprature (C) to Excel Sheet for verification 'Comparing Temperature Threshold Values IF (soT < tempthresh) THEN high_hot_fan IF ((soT > tempthresh) & (soT < (tempthresh+100))) THEN low_cool_fan IF (soT > (tempthresh+100)) THEN high_cool_fan MAIN1: '**************************************HUMIDITY SENSOR********************************************* GOSUB SHT_Measure_Humidity 'humiditythresh = 400 DEBUG MoveTo, 0, 8, CR DEBUG "HUMIDITY ", CR DEBUG "soRH..... " DEBUG DEC soRH, ClrRt, CR DEBUG "rhLin.... " DEBUG DEC (rhLin / 10), ".", DEC1 rhLin, "%", ClrRt, CR DEBUG "rhTrue... " DEBUG DEC (rhTrue / 10), ".", DEC1 rhTrue, "%", ClrRt SEROUT sPin,Baud,["CELL,SET,B6,",DEC (rhTrue / 10), ".", DEC1 rhTrue,CR] 'Send Current Humidity to Excel Sheet SEROUT sPin,Baud,["CELL,GET,B5,",CR] ' Read Humidity Threshold from the Excel Database SERIN sPin, Baud,200,Timeout2,[DEC humiditythresh] ' Set Threshold Value to the read value MAIN4: SEROUT sPin,Baud,["CELL,SET,C9,",DEC humiditythresh,CR] 'Send Current Humidity to Excel Sheet SEROUT sPin,Baud,["CELL,SET,B6,",DEC (rhTrue / 10), ".", DEC1 rhTrue,CR] 'Send Current Humidity to Excel Sheet 'Comparing the humidity Threshold Values IF (rhTrue < (humiditythresh*10)) THEN HIGH_RELAY2 IF (rhTrue > ((humiditythresh*10)+20)) THEN LOW_RELAY2 MAIN2: '****************************************LIGHT SENSOR*********************************************** DEBUG MoveTo, 0, 13, CR COUNT IN, 100, cnt 'COUNT on P2 FOR 100 ms, store value in cnt SEROUT sPin,Baud,["CELL,SET,B4,",DEC cnt,CR] 'Send Current Light to Excel Sheet SEROUT sPin,Baud,["CELL,GET,B3,",CR] ' Read Light Threshold from the Excel Database SERIN sPin, Baud,200,Timeout3,[DEC lightthresh] ' Set Threshold Value to the read value MAIN5: SEROUT sPin,Baud,["CELL,SET,C8,",DEC lightthresh,CR] 'Send Set light to Excel Sheet for verification 'Comparing the light Threshold Values IF (cnt < lightthresh) THEN LED_HIGH1 'If Intensity very low, turn on all LEDs IF (cnt > lightthresh & cnt < (lightthresh+10)) THEN LED_HIGH2 'If Intensity low, turn on only one LED IF (cnt > (lightthresh+10) & cnt < (lightthresh+40)) THEN LED_HIGH3 'If Intensity low, turn on only one LED IF (cnt > (lightthresh+40)) THEN LED_LOW 'If Intensity really High, turn off all LEDs GOTO MAIN ' ------------------------------------------------------------------------------ ' Subroutines ' ------------------------------------------------------------------------------ ' connection reset: 9 clock cyles with ShtData high, then start sequence ' SHT_Connection_Reset: SHIFTOUT ShtData, Clock, LSBFIRST, [$FFF\9] ' generates SHT1x "start" sequence ' _____ _____ ' ShtData |_______| ' ___ ___ ' Clock ___| |___| |___ ' SHT_Start: INPUT ShtData ' let pull-up take line high LOW Clock HIGH Clock LOW ShtData LOW Clock HIGH Clock INPUT ShtData LOW Clock RETURN ' measure temperature ' -- celcius = soT * 0.01 - 40 ' -- fahrenheit = soT * 0.018 - 40 ' SHT_Measure_Temp: GOSUB SHT_Start ' alert device ioByte = ShtTemp ' temperature command GOSUB SHT_Write_Byte ' send command GOSUB SHT_Wait ' wait until measurement done ackBit = Ack ' another read follows GOSUB SHT_Read_Byte ' get MSB soT.HIGHBYTE = ioByte ackBit = NoAck ' last read GOSUB SHT_Read_Byte ' get LSB soT.LOWBYTE = ioByte ' Note: Conversion factors are multiplied by 10 to return the ' temperature values in tenths of degrees tC = soT / 10 - 400 ' convert to tenths C tF = soT ** 11796 - 400 ' convert to tenths F RETURN ' measure humidity ' SHT_Measure_Humidity: GOSUB SHT_Start ' alert device ioByte = ShtHumi ' humidity command GOSUB SHT_Write_Byte ' send command GOSUB SHT_Wait ' wait until measurement done ackBit = Ack ' another read follows GOSUB SHT_Read_Byte ' get MSB soRH.HIGHBYTE = ioByte ackBit = NoAck ' last read GOSUB SHT_Read_Byte ' get LSB soRH.LOWBYTE = ioByte ' Conversion factors are multiplied by 10 and then rounded to ' return tenths ' rhLin = (soRH ** 26542) rhLin = rhLin - ((soRH ** 3468) * (soRH ** 3468) + 50 / 100) rhLin = rhLin - 40 ' Conversion factors are multiplied by 100 to improve accuracy and then ' rounded off. ' rhTrue = ((tC / 10 - 25) * (soRH ** 524 + 1) + (rhLin * 10)) + 5 / 10 RETURN Timeout1: GOTO MAIN3 Timeout2: GOTO MAIN4 Timeout3: GOTO MAIN5 LED_HIGH1: 'Turn ON all LEDs DEBUG "Light Intensity Lowest...." DEBUG DEC5 cnt , ClrRt, CR 'Display value of cnt, as a decimal HIGH OUT HIGH LED1 HIGH LED2 RETURN LED_HIGH2: 'Turn ON 2 LEDs DEBUG "Light Intensity Medium1...." DEBUG DEC5 cnt , ClrRt, CR 'Display value of cnt, as a decimal LOW OUT HIGH LED1 HIGH LED2 RETURN LED_HIGH3: 'Turn ON 1 LEDs DEBUG "Light Intensity Medium2...." DEBUG DEC5 cnt , ClrRt, CR 'Display value of cnt, as a decimal LOW OUT LOW LED1 HIGH LED2 RETURN LED_LOW: 'Turn OFF all LEDs DEBUG "Light Intensity Highest...." DEBUG DEC5 cnt , ClrRt, CR 'Display value of cnt, as a decimal LOW OUT LOW LED1 LOW LED2 RETURN high_cool_fan: DEBUG "Turning Cooler ON....", CR HIGH relay1 LOW relay GOTO MAIN1 low_cool_fan: DEBUG "Turning Fans OFF....", CR LOW relay LOW relay1 GOTO MAIN1 high_hot_fan: DEBUG "Turning Heater ON....", CR HIGH relay LOW relay1 GOTO MAIN1 HIGH_RELAY2: DEBUG "Turning on Humidifier....", CR HIGH relay2 LOW humid_fan GOTO MAIN2 LOW_RELAY2: DEBUG "Turning off Humidifier....", CR LOW relay2 HIGH humid_fan GOTO MAIN2 SHT_Write_Status: GOSUB SHT_Start ' alert device ioByte = ShtStatW ' write to status reg command GOSUB SHT_Write_Byte ' send command ioByte = status GOSUB SHT_Write_Byte RETURN ' returns "status" ' SHT_Read_Status: GOSUB SHT_Start ' alert device ioByte = ShtStatW ' write to status reg command GOSUB SHT_Read_Byte ' send command ackBit = NoAck ' only one byte to read GOSUB SHT_Read_Byte RETURN ' sends "ioByte" ' returns "ackBit" ' SHT_Write_Byte: SHIFTOUT ShtData, Clock, MSBFIRST, [ioByte] ' send byte SHIFTIN ShtData, Clock, LSBPRE, [ackBit\1] ' get ack bit RETURN ' returns "ioByte" ' sends "ackBit" ' SHT_Read_Byte: SHIFTIN ShtData, Clock, MSBPRE, [ioByte] ' get byte SHIFTOUT ShtData, Clock, LSBFIRST, [ackBit\1] ' send ack bit INPUT ShtData ' release data line RETURN ' wait for device to finish measurement (pulls data line low) ' -- timeout after ~1/4 second ' SHT_Wait: INPUT ShtData ' data line is input FOR toDelay = 1 TO 250 ' give ~1/4 second to finish timeOut = INS.LOWBIT(ShtData) ' scan data line IF (timeOut = No) THEN SHT_Wait_Done ' if low, we're done PAUSE 1 NEXT SHT_Wait_Done: RETURN ' reset SHT1x with soft reset ' SHT_Soft_Reset: GOSUB SHT_Connection_Reset ' reset the connection ioByte = ShtReset ' reset command ackBit = NoAck ' only one byte to send GOSUB SHT_Write_Byte ' send it PAUSE 11 ' wait at least 11 ms RETURNAttachements :
http://i.imgur.com/Mdzg0q8.jpg
http://i.imgur.com/diyxPpY.jpg
http://i.imgur.com/PQlyG1E.jpg
http://i.imgur.com/KcZtREa.jpg
Source code:
http://dfiles.eu/files/pfg46mfyb
http://dfiles.eu/files/7gw8a1czm
What should i do next?
Thank you
I made the fan to run(used transistor BD411 instead of relay), but now i don`t know how should i connect it to microcontroller, so that when the SHT15 will detect the temperature above 26 degrees C, it will start my cooling fan, and after the temp reaches 24 degrees, it will stop it.
any ideas?
Thanx a lot
'*************************************TEMPERATURE SENSOR********************************************
GOSUB SHT_Measure_Temp
DEBUG MoveTo, 0, 3
DEBUG "TEMPERATURE ", CR
DEBUG "soT...... "
DEBUG SDEC soT, ClrRt, CR
DEBUG "tC....... "
DEBUG SDEC (tC / 10), ".", SDEC1 tC, DegSym, ClrRt, CR
SEROUT sPin,Baud,["CELL,SET,B2,",SDEC (tC / 10), ".", SDEC1 tC,CR] 'Send Current temprature (C) to Excel Sheet
DEBUG "tF....... "
DEBUG SDEC (tF / 10), ".", SDEC1 tF, DegSym, ClrRt, CR
SEROUT sPin,Baud,["CELL,GET,B1,",CR] ' Read Temprature Threshold from the Excel Database
SERIN sPin, Baud,200,Timeout1,[SDEC tempthresh] ' Set Threshold Value to the read value
DEBUG "tempthresh...", tempthresh, CR, CR
MAIN3:
tempthresh = ((tempthresh*10) + 400)*10 'This converts value from degree to analog value from temp sensor.
SEROUT sPin,Baud,["CELL,SET,C7,",SDEC tempthresh,CR] 'Send Set temprature (C) to Excel Sheet for verification
'Comparing Temperature Threshold Values
IF (soT < tempthresh) THEN high_hot_fan 'If sensor temp is less than threshold then run this routine.
IF ((soT > tempthresh) & (soT < (tempthresh+100))) THEN low_cool_fan 'If sensor temp value is between threshold and threshold+100 then run this routine.
IF (soT > (tempthresh+100)) THEN high_cool_fan 'If sensor temp value is more than threshold+100 the run the cooling fan routine.
high_cool_fan:
DEBUG "Turning Cooler ON....", CR
HIGH relay1
LOW relay
GOTO MAIN1
low_cool_fan:
DEBUG "Turning Fans OFF....", CR
LOW relay
LOW relay1
GOTO MAIN1
high_hot_fan:
DEBUG "Turning Heater ON....", CR
HIGH relay
LOW relay1
GOTO MAIN1
Exercise 2 of Chapter 5 of Industrial Control sounds similar to what you want to do. Omit all the DEBUG commands that start with "!abcd.." since you don't want to use StampPlot. They use an LM34 connected to an ADC0831 so you can substitute your SHT15 code. By the way Parallax doesn't sell the SHT15 but they do sell the SHT11 and both devices are on the same datasheet. In Industrial Control they turn a heater on and off similar to what you want to do with your fan.
http://youtu.be/imJc_reASCE
I'm glad you got your circuit and program to work. I can understand you're excited about it but it's not nice (IMO) to post a link to your video in multiple old threads about the Sensirion sensor.
here your project detail Click here
Sounds very interesting and helpful! Thanks for sharing Claiudiu.
thanks our moderator Mike Green. great Teacher.
Howdy.
Oh, I liked how your method used the light in the room to active the fan. I've been trying to figure out how I'd want a system in our house to work. I'm not sure if I'd want just the light to be the trigger.
I imagine each room would have its own set of rules of acceptable temperature ranges. I'd like to add some sort of speech recognition to each room so I could verbally instruct the controller on when I want the cooling or heat turned on.
I thought it odd the linked paper didn't have a date (at least not one I could find). When was your project submitted?
Thanks Duane