3 Temperature sensor, auto switch on Pond Water Heater

the old fart

Senior Member
Hi Guys,

Work in progress.

I'm so chuffed that this worked first time I must share it with you.

Measuring temperatures at, pond bottom, Pond surface, Air.

Any reading below 4C switches on the pond heaters.


using 20M2 picaxe and AXE134Y display.


Display will be seprate unit, plugged into controller via 2nd stereo plug. So I can use it on other projects.

Dave

Code:
;temp test 3


;b0 reading from sensor
;b1 ascii of b0 
;b2 ascii of b0
;b3 ascii of b0
;b4 "-" or "+"
;b5 WARNING FREEZING
;b6 line start address
;b7
;b8
;b9
;b10 read eeprom address
;b11 read eeprom data
;b12 eeprom start address of message
;b13 length of message to send


	
	eeprom 00,("   Air Temp ")
	eeprom 20,("   Top Temp ")
	eeprom 40,("Bottom Temp ")
	eeprom 60,("-WARNING FREEZING-")
	EEPROM 80,("..................")


symbol baud=N2400



low b.2	; Initialise OLED output 
pause 500 ; Waif for OLED to initialise

serout b.2,baud,(254,1)
pause 30


main: 
 
 b5=80  ;clear freezing message
 
 readtemp c.0, b0	; Read DS18B20 on pin C.0 
 b6=128 ; line 1
 b12=0 ; eprom 00
 b13=12 ;length of message
 gosub mainsub
 
 readtemp c.1, b0	; Read DS18B20 on pin C.1 
 b6=192 ;line 2
 b12=20 ; eprom 20
 b13=12
 gosub mainsub
 
 readtemp c.2, b0	; Read DS18B20 on pin C.2 
 b6=148
 b12=40
 b13=12
 gosub mainsub
 
 
 
 ; freezing message selection

 b6=212 ;line 4
 b12=b5 ; message
 b13=20 ; length
 gosub mess
 
 
 
 
 if b5=80 then low 7:else: high 7:endif
 
 
 
goto main 


mainsub:
 if b0>127 or b0<4 then let b5=60:end if ; select freezing eeprom message

 if b0>127 then let b4="-" let b0=b0-127:else:b4="+":endif ; select + or - sign
 
 bintoascii b0, b1,b2,b3	; Convert temperature to 3 ascii digits
 
 if b1=48 then let b1=32:end if  ; blank leading zeros
 if b1>48 then skip
 if b2=48 then let b2=32:end if
skip:
  
 gosub mess
 

 serout b.2, baud, (b4,b1,b2,b3,"C"); line data
 
 

return

; eeprom messages

mess:

       serout b.2, baud, (254,b6);line select 
       b13=b13+b12
       for b10 = b12 to b13	     	; start a loop
	  read b10,b11			; read value from EEPROM
	  serout b.2,baud,(b11)		; transmit to serial LCD module
	next b10				; next character
return
 
Last edited:
Top