-->
Page 1 of 1

Heat Pump monitor with email notification

PostPosted: Mon Apr 10, 2017 9:04 am
by Tom espbasic Sisk
I'm working on a project to monitor the health of heat pumps and air conditioners by monitoring their pressures and temperatures while running.
If they are not running efficiently, they send an email to the service provider. The attached code is used in testing on the bench.
It uses several bits of code from the forums to get the job done. This is running on an Adafruit Huzzah Feather and has the Branch 3 basic code.

Cheers,
Tom

Code: Select all' hvac monitoring system development, Apr 10/17
memclr

' allocate arrays

dim add1(8)
dim add2(8)
dim add3(8)
dim stat(5)
dim pres(5)

' initialize switching pattern
' for address decoder chip

add1(0)=0
add1(1)=1
add1(2)=0
add1(3)=1
add1(4)=0
add1(5)=1
add1(6)=0
add1(7)=1

add2(0)=0
add2(1)=0
add2(2)=1
add2(3)=1
add2(4)=0
add2(5)=0
add2(6)=1
add2(7)=1

add3(0)=0
add3(1)=0
add3(2)=0
add3(3)=0
add3(4)=1
add3(5)=1
add3(6)=1
add3(7)=1

' initialize variables

let A1_pin = 12
let A2_pin = 13
let A3_pin = 14
let A_EN = 15     ' ENABLE pin on address decoder
let statpin = 4   ' pin to detect digital status
let cycles=90     ' trigger one email soon after startup
                   
timer 5000,[adrloop]

' set address pins to initial state
io(po,A1_pin,0)
io(po,A2_pin,0)
io(po,A3_pin,0)
io(po,A_EN,0)

' create button on webpage

button "end", [getout]
wait



' run through address combinations

[adrloop]
 cycles=cycles+1   'increment to trigger email
 io(po,0,0)   ' use red LED as indicator

 for x=0 to 3    ' get Fan status', pressures
   io(po,A_EN,0)
   io(po,A1_pin,add1(x))
   io(po,A2_pin,add2(x))
   io(po,A3_pin,add3(x))
 delay 100  'let address settle
   io(po,A_EN,1)  'turn on ENABLE
 delay 100
' get status and pressures
   stat(x+1)=io(pi,statpin)
   pres(x+1)=io(ai)

 next x

   io(po,0,1)   'red LED as indicator

   io(po,A_EN,0)
   io(po,A1_pin,0)
   io(po,A2_pin,0)
   io(po,A3_pin,0)

io(po,2,1)
romcode = temp()   'uses one-wire on io 2
delay 100
tem1 = (temp("28e0e6dc060000b3")*1.8)+32
tem3 = (temp("28f5eddd060000fc")*1.8)+32
tem2 = (temp("280309dd060000f9")*1.8)+32
tem4 = (temp("2887dadd060000df")*1.8)+32

serialprint "temp1= "
serialprintln tem1
serialprint "temp2= "
serialprintln tem2
serialprint "temp3= "
serialprintln tem3
serialprint "temp4= "
serialprintln tem4
serialprintln " "
serialprintln romcode
serialprint stat(1)
serialprint "  "
serialprint stat(2)
serialprint "  "
serialprint stat(3)
serialprint "  "
serialprintln stat(4)
serialprint pres(1)
serialprint "  "
serialprint pres(2)
serialprint "  "
serialprint pres(3)
serialprint "  "
serialprintln pres(4)
'serialprintln "  "
serialprint "Cycles= "
serialprintln cycles
serialprintln "  "

if cycles > 100 then
  goto [mailcall]
end if
 wait

[getout]

end


[mailcall]
server = "mail.smtp2go.com"
port = "2525"
user = "tom@xxxxxxx.ca"
pw = "xxxxxxxx"
sendto = "yyy@myisp.com"
from = "www@xxxxxx.ca"
subject = "HVAC update"
body3 = "Information about system status apr8/2017"
spc = " "
'let xnum=1234
'let ynum=5678
body1 = str(tem1)
body2 = str(tem2)
body4 = str(pres(1))
body5 = str(pres(2))
body=body1&spc&body2&spc&body4&spc&body5
serialprintln body
setupemail server, port, user, pw

[SendEmail]
email sendto, from, subject, body
cycles = 0
wait


Re: Heat Pump monitor with email notification

PostPosted: Sat Apr 15, 2017 8:43 am
by heckler
Very nice! Tom,

I am planning on doing something similar to monitor freezer temperature and the freezer door.
Send an email when the temp rises too much or if the door is left open.

I'll post it here when I get it going.
thanks for sharing

dwight