Picaxe to Max6675 Thermocouple amp

ptribbey

New Member
This is an easy project to probe your wood stove for instance. Bells and whistles could easily be added. Alarms for time to add wood or whatever.
It works well and I'm just putting it out there for anyone interested.
Paul
Note: thermocouple wire is ample on ebay and all you have to do to use it is twist a few cm of one end together, then attach the other end to the max6675.
The variable Val is in degrees Celsius until its converted to F.
Code:
' Picaxe 18X to Max6675 thermocouple amp with C to F conversion.
' Good for a range of temperatures fron zero to about 1300 degrees f. Use type K or N thermocouple.
' Paul Tribbey Superior, WI 3-1-2009. Free to use for everyone.
' Some code inspired by PH Anderson.
' Connect thermocouple to pins 2 and 3 of Max6675.
' Using PH Anderson 118 serial LCD display on output 0. Easily modified for other display.

Symbol CS = Output4	' connect to pin 6 MAX6675
Symbol SCK = OutPut5	' connect to pin 5 MAX6675
Symbol MISO = Input1	' connect to pin 7 MAX6675
Symbol Val = W1
Symbol Dig = B4
Symbol I = B5
Symbol J = B6


Main:
     GoSub MeasTemp
     GoSub DisplayTemp
     Pause 1000		' allow Max6675 to finish
     Goto Main

MeasTemp:
     High CS		' deselect the 6675
     Low SCK
     Low CS			' start conversion
     Val = 0		' initialize temperature variable
     For I = 1 to 16	' serial clock in 16 bits
        High SCK
        Val = Val * 2 + MISO 'clock in the bits into a word
        Low SCK
     Next I
     High CS		' deselect the 6675
     Val = Val / 32	' use only the 11 most sig bits (val = deg Celsius)
     Val = Val * 9	' quick and dirty celcius
     Val = Val / 5	' to farenheight 
     Val = Val + 32	' conversion
     Return

DisplayTemp:
       Serout 0,t2400, ("?f")	' PH Anderson LCD #118 on output 0
       
       Dig = Val / 1000	' thousands
       Serout 0,t2400, (#Dig)
       Val = Val % 1000
       
       Dig = Val / 100	' hundreds
       Serout 0,t2400, (#Dig)
       Val = Val % 100

       Dig = Val / 10	' tens
       Serout 0,t2400, (#Dig)
       Val = Val % 10

       Dig = Val 		' units
       Serout 0,t2400, (#Dig)
       Return
 
Top