Reading a Temperature
BlueZX#
Posts: 14
First post...
I am using a BS1 w/ a thermister for starters...I am using the therm.bas code trimmed to only the temp formula's...
While I was testing the concept it worked fine and had only a degree off of the actual temp...
So,·I went to the next step and tried it in the actual enviroment setting and with the right settings...
My problem is that this seems to only go down to a logged temp of 50F, not useable... I need to measure like·20F-120F, wide range I know...going by the book is says that you can extend the range as they only made it for 50-90.· So I tried to follow the directions and am a little confused...it says what they
·did but didn't give any samples...·
I did think of using another type of sensor but have concluded that any other one either uses too many pins or uses too much code (ei..dallas ones)·to read from it...
Help!!!!!· Thanks..
I only have can have two pins for two temp readings and need space for the rest of the program as its not completed yet...
I am using a BS1 w/ a thermister for starters...I am using the therm.bas code trimmed to only the temp formula's...
While I was testing the concept it worked fine and had only a degree off of the actual temp...
So,·I went to the next step and tried it in the actual enviroment setting and with the right settings...
My problem is that this seems to only go down to a logged temp of 50F, not useable... I need to measure like·20F-120F, wide range I know...going by the book is says that you can extend the range as they only made it for 50-90.· So I tried to follow the directions and am a little confused...it says what they
·did but didn't give any samples...·
I did think of using another type of sensor but have concluded that any other one either uses too many pins or uses too much code (ei..dallas ones)·to read from it...
Help!!!!!· Thanks..
I only have can have two pins for two temp readings and need space for the rest of the program as its not completed yet...
Comments
·· Where is this code you're referring to?· Could you attach the original code and perhaps a link to the document that you're referring to?
EDIT: I was informed you're referring to the BASIC Stamp 1 Application notes, so you don't need to send the code or link.· I don't have any code to do what you're trying to do, but you could use a DS1620 with probably no more overhead than what you're going to need for this conversion.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Post Edited (Chris Savage (Parallax)) : 6/8/2005 8:07:30 PM GMT
I also just pulled the req code lines off the app to do this and it takes a lot more to do almost the same thing...just more precise and not dependant·on a RC circuit which will be subject close to the same temps that I will be reading and there for not as stable...
Any more thoughts...?
Post Edited (BlueZX#) : 6/8/2005 8:46:05 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Thanks for the help!
Dave
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dave Andreae
Tech Support
dandreae@parallax.com
www.parallax.com
·
I have to order one then, just have to wait for it to be back in stock... I'll also have to check the rest of my code to make sure thats its bs2 complient...
Thanks,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
what I had when testing was a ds1620,filter cap, power ceramic resistor(heater) on a small bread board inside a small box,in the freezer. The cable was ~8-10ft long...
My question is: what is the point at which you might need some kinda line driver for such a device. I haven't done anything since then so I not sure as to Y it stoped...is that too long of a distance for it to push...
Post Edited (BlueZX#) : 6/24/2005 6:29:18 PM GMT
Just got back to this project and now have two sensors that don't work now...
I would really like to know what is causing them to stop working after a time of use...
Still using the above setup....
Any comments...TIA
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
I did notice that I do need to cange the code a little cause the after the temp drops below 32F the formula stops working the way it should, due to the fact that the formula changes the C to F and it doesn't monitor the negitve bit, but not the real issue here..
I have gone as far to just put the origanal DS1620 BS2 script in to see if it was a problem in the project code and that ended up only like giving a temp reading like every 1-2mins....I really think that it something to do with the actuall chip...its the SOIC one..
Thanks,
' {$STAMP BS2}
' {$PBASIC 2.0}
' {$PORT COM1}
'============================ Pin Defenations ==============================
' P0 - DS1620 CLK PIN, CONNECT TO ALL TEMP SENSORS (DONE)
' P1 - DS1620 DQ PIN, CONNECT TO ALL TEMP SENSORS (DONE)
' P2 - DS1620 RST PIN HD TEMP SENSOR (DONE)
' P3 - DS1620 RST PIN CASE TEMP SENSOR (DONE)
' P4 - DS1620 RST PIN AMP TEMP SENSOR (NOT DONE YET!!)
'
' P5 - HD HEATER (DONE)
' P6 - HD EXHUST SERVO (RANGE CW155-C630-CCW1105) (DONE)
' P7 - HD FAN (DONE)
' P8 - CASE FAN (NOT DONE YET!!)
' P9 - POWER SUPPLY FAN (NOT DONE YET!!)
'P10 - AMP FANS (NOT DONE YET!!)
'P11 - SCREEN POWER (NOT DONE YET!!)
'
'
'P12 -
'P13 - BATT STATUS (NOT DONE YET!!)
'P14 - CAR STATUS ON/OFF (NOT DONE YET!!)
'P15 - EMPTY
'
'
'================================== Temperature Varibles ================================
j VAR Byte
i VAR Nib
x VAR Word
remain VAR Word
slope VAR Word
degC VAR Word 'storage for celcius temp
degF Var Word 'storage for fareinehitt temp
TEMP_HD VAR Word 'storage for HD temp
'TEMP_CS VAR Word 'storage for CS temp
RST_SELECT VAR NIB 'hd/case temp select pin
CLKn CON 1 'DS1620 pin
DQn CON 0 'DS1620 pin
Loop Var byte
SERVO_STATUS VAR BIT 'servo status open/close
HTR_STATUS VAR BIT 'heater status on/off
HTR_CTRL CON 4 'heater control pin
SET_TEMP CON 410 'must be 3 digits( ie..95.3 would be 953)
sPin CON 16 'pin for temp logging
Baud CON 84 'Baud mode for a rate of 9600, 8-N-1
HD_SENSOR CON 2
CS_SENSOR CON 3
HD_FAN CON 6
'============================ main program loop =============================
GOSUB startup
'RST_SELECT = CS_SENSOR
'GOSUB CHECK_CONFIG
RST_SELECT = HD_SENSOR
GOSUB CHECK_CONFIG
CHECK_HD_SENSOR:
RST_SELECT = HD_SENSOR
GOSUB CHECK_TEMP
TEMP_HD = degF
'SEROUT sPin,Baud,[noparse][[/noparse]"DATA,TIME,",DEC TEMP_hd, ",",DEC temp_CS,",",DEC HTR_STATUS,13]
IF TEMP_HD <= 420 THEN ALARM
CHECK_CS_SENSOR:
' RST_SELECT = CS_SENSOR
' GOSUB check_temp
' TEMP_CS = degF
'SEROUT sPin,Baud,[noparse][[/noparse]"DATA,TIME,",DEC TEMP_hd, ",",DEC temp_CS,",",DEC HTR_STATUS,",",DEC SERVO_STATUS,13]
SEROUT sPin,Baud,[noparse][[/noparse]"DATA,TIME,",DEC TEMP_hd, ",",DEC HTR_STATUS,",",DEC SERVO_STATUS,13]
CHECK_STATUS:
GOSUB ADJ
' GOSUB BATT_STATUS
GOTO CHECK_HD_SENSOR
'=========================== STARTUP ==================================
STARTUP:
FOR loop = 1 TO 25
PULSOUT 5,630
PAUSE 20
NEXT
LOW HTR_CTRL
TEMP
'RETURN
'========================= FOR LOGGING ONLY ============================
PAUSE 1000 'Allow data communications to stabilize
SEROUT sPin,Baud,[noparse][[/noparse]13] 'Send a lone CR to ensure StampDAQ buffer is ready
PAUSE 50
' SEROUT sPin,Baud,[noparse][[/noparse]13,"LABEL,TIME,TEMP_HD,TEMP_CS,HTR_STATUS,SERVO_STATUS",13] 'Label 2 columns with TIME, TEMP
SEROUT sPin,Baud,[noparse][[/noparse]13,"LABEL,TIME,TEMP_HD,HTR_STATUS,SERVO_STATUS",13]
SEROUT sPin,Baud,[noparse][[/noparse]"CLEARDATA",13] 'Clear all data columns (A-J) in Excel
RETURN
'==================== CHECKING THE CONFIG OF TEMPERATURE SENSOR ===========
CHECK_CONFIG:
'DEBUG CLS,"CHECKING CONFIG"
'PAUSE 250
'DEBUG CLS,"CHECKING CONFIG."
'PAUSE 250
'DEBUG CLS,"CHECKING CONFIG.."
'PAUSE 250
'DEBUG CLS,"CHECKING CONFIG..."
PAUSE 1500
HIGH RST_SELECT
SHIFTOUT DQn,CLKn,LSBFIRST,[noparse][[/noparse]$AC]
SHIFTIN DQn,CLKn,LSBPRE,[noparse][[/noparse]x]
LOW RST_SELECT
IF x.BIT0=0 AND X.BIT1=0 THEN CONT
RETURN
CONT:
'DEBUG "CHANGING THE CONFIG..."
PAUSE 1500
HIGH RST_SELECT
SHIFTOUT DQn,CLKn,LSBFIRST,[noparse][[/noparse]$C,$3]
LOW RST_SELECT
PAUSE 100
RETURN
'==================== READ TEMPERATURE =====================
CHECK_TEMP: ' start a conversion
HIGH RST_SELECT
SHIFTOUT DQn,CLKn,LSBFIRST,[noparse][[/noparse]$EE]
LOW RST_SELECT
busy: ' wait for data to be ready (up to one second!)
HIGH RST_SELECT
SHIFTOUT DQn,CLKn,LSBFIRST,[noparse][[/noparse]$AC]
SHIFTIN DQn,CLKn,LSBPRE,[noparse][[/noparse]x]
LOW RST_SELECT
IF x.BIT7=0 THEN busy ' x.bit7 goes high when done
HIGH RST_SELECT ' request data byte and get it
SHIFTOUT DQn,CLKn,LSBFIRST,[noparse][[/noparse]$AA]
SHIFTIN DQn,CLKn,LSBPRE,[noparse][[/noparse]x\9]
LOW RST_SELECT
x.BYTE1 = -x.BIT8 ' extend sign
degC=x*5 ' compute to 10ths, +/- 0.5 degree C
HIGH RST_SELECT ' get the count remaining DS1620
SHIFTOUT DQn,CLKn,LSBFIRST,[noparse][[/noparse]$A0]
SHIFTIN DQn,CLKn,LSBPRE,[noparse][[/noparse]remain\9]
LOW RST_SELECT
HIGH RST_SELECT ' get the counts per degree
SHIFTOUT DQn,CLKn,LSBFIRST,[noparse][[/noparse]$A9]
SHIFTIN DQn,CLKn,LSBPRE,[noparse][[/noparse]slope\9]
LOW RST_SELECT
x=slope-remain*100/slope ' compute 1/100ths degree
degC=degC+550/10*100+x-5525 ' adjust temperature to 1/100ths
degF=(degc */ $01CC)+3200 'convert to F degree's
'DEBUG " C ",TAB," F "
'DEBUG CR,dec degC/100,".",DEC2 degC,TAB,dec degF/100,".",dec2 degF
PAUSE 700
degF = degF/10
RETURN
'==================== Adjust heater & venting ===================
ADJ:
IF TEMP_HD <= SET_TEMP AND HTR_STATUS = 0 THEN HTR_ON
IF TEMP_HD >= SET_TEMP AND HTR_STATUS = 1 THEN HTR_OFF
'PAUSE 970 'CHANGE TO 970
' SEROUT sPin,Baud,[noparse][[/noparse]"DATA,TIME,", DEC TEMP_hd, ",", DEC temp_CS,",", DEC HTR_STATUS,13]
IF TEMP_HD > 656 AND TEMP_HD < 820 AND SERVO_STATUS = 0 THEN EXH_OPEN
IF TEMP_HD < 500 AND SERVO_STATUS = 1 THEN EXH_CLOSE
IF TEMP_HD > 825 AND SERVO_STATUS = 1 THEN EXH_CLOSE
' IF temp_CS < 945 AND SERVO_STATUS = 1 THEN EXH_CLOSE
' IF temp_Cs > 947 AND SERVO_STATUS = 0 THEN EXH_CLOSE
RETURN
HTR_ON:
HIGH HTR_CTRL
HTR_STATUS = 1
GOTO CHECK_HD_SENSOR
HTR_OFF:
LOW HTR_CTRL
HTR_STATUS = 0
GOTO CHECK_HD_SENSOR
EXH_OPEN:
FOR loop = 1 TO 25
PULSOUT 5,315
PAUSE 20
NEXT
SERVO_STATUS= 1
HIGH HD_FAN
GOTO CHECK_HD_SENSOR
EXH_CLOSE:
FOR loop = 1 TO 25
PULSOUT 5,945
PAUSE 20
NEXT
SERVO_STATUS = 0
LOW HD_FAN
GOTO CHECK_HD_SENSOR
'================== CHECK BATTERY STATUS =========================
BATT_STATUS:
ALARM:
FREQOUT 7,20,2100,3000
GOTO CHECK_CS_SENSOR
degF=degC+10000 ** 11796 - 1480 ' F = C * 9/5 + 32
When things stop working, go back to a simpler version of the program, with just the sensor read and debug. Maybe the sensors lost their mode setting. Make sure they are in single shot CPU mode, otherwise they cannot be used for the high resolution stuff.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Seeing that no one has mentioned it, I take it that 8-12ft of wire between the bs2 & ds1620 shouldn't be a prob for the soic 1620..
if i just leave the setup on the desk w/ the 1620 on the prof board it works for hours, no probs, the prob doesn't seem to show up till i extend the 1620 to another board and place it in the freezer..
I will try this tonite and be back if still having probs
Thanks,
Post Edited (BlueZX#) : 9/1/2005 5:44:33 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com