20
Monitoring and steering a central heating pump Raspberry Pi, 433 Mhz transmitter, temperature sensors and Google Docs

central heating pump Monitoring and steering a and...The problem - house with central heating which runs under floor heating with allways on pump - when no heat is requested/provided,

  • Upload
    others

  • View
    5

  • Download
    1

Embed Size (px)

Citation preview

Page 1: central heating pump Monitoring and steering a and...The problem - house with central heating which runs under floor heating with allways on pump - when no heat is requested/provided,

Monitoring and steering a central heating pumpRaspberry Pi, 433 Mhz transmitter,

temperature sensors and Google Docs

Page 2: central heating pump Monitoring and steering a and...The problem - house with central heating which runs under floor heating with allways on pump - when no heat is requested/provided,

About myself

- Edward van Hazendonk, 43 years- ICT Specialist at I-bridge (a Randstad

company) RHCE, CLP- Hobbies:

- Photography- Electronics (things started to get interesting again

with Raspberry Pi and Arduino availability)- http://van-hazendonk.net- [email protected]

Page 3: central heating pump Monitoring and steering a and...The problem - house with central heating which runs under floor heating with allways on pump - when no heat is requested/provided,

The problem

- house with central heating which runs under floor heating with allways on pump

- when no heat is requested/provided, pump in floor heating system still keeps running which pushes cold water through the pipes, which cools down the floor

- pump of central heating is no way near feeder of hot pipe

- causes cold feet, I hate cold feet

Page 4: central heating pump Monitoring and steering a and...The problem - house with central heating which runs under floor heating with allways on pump - when no heat is requested/provided,

The workaround

- Raspberry Pi- 433 Mhz transmitter / receiver- pilight to the rescue- Rev/Ritter (klikaan/klikuit) mains switch- 2 temperature sensors, onewire- google docs (spreadsheet) as monitoring- Python script and a bit less cold feed- PiCobbler- bits and pieces joint together from Internet

Page 5: central heating pump Monitoring and steering a and...The problem - house with central heating which runs under floor heating with allways on pump - when no heat is requested/provided,

The parts

- Raspberry Pi- Running Raspian (Debian Wheezy with Raspberry

addons) http://www.raspbian.org/- pilight http://www.pilight.org/- gspread https://github.com/burnash/gspread- SDcard

Page 6: central heating pump Monitoring and steering a and...The problem - house with central heating which runs under floor heating with allways on pump - when no heat is requested/provided,

The sensors

- DS18B20- TO-92 housing- low cost- simple design- pull-up resistor 4k7 gpio

4 and 3v3- gpio 4 to pin 2 (TWI on

RPi)- multiple connected to

same wires, easy setup

Page 7: central heating pump Monitoring and steering a and...The problem - house with central heating which runs under floor heating with allways on pump - when no heat is requested/provided,

The transmitter

- cheap ASK 433Mhz transmitter/receiver- handmade antenna gets good results http:

//www.elektor.nl/Uploads/Forum/Posts/How-to-make-a-Air-Cooled-433MHz-antenna.pdf

- pilight makes it work the easy way

Page 8: central heating pump Monitoring and steering a and...The problem - house with central heating which runs under floor heating with allways on pump - when no heat is requested/provided,

Transmitter and receiver on RPi- 5 V for range- gpio 17 transmit- gpio 18 receive

- gpio 4 TWi for DS18B20

Page 9: central heating pump Monitoring and steering a and...The problem - house with central heating which runs under floor heating with allways on pump - when no heat is requested/provided,

The receiver

- Rev Ritter 433Mhz (klikaan/uit clone)- comes with own remote (needed for sniffing

the code)

Page 10: central heating pump Monitoring and steering a and...The problem - house with central heating which runs under floor heating with allways on pump - when no heat is requested/provided,

The code 1-wire# modprobe w1-gpio

# modprobe w1-therm

$ ls /sys/bus/w1/devices

10-00080201e1e3 10-00080201eed0 w1_bus_master1

$ cat /sys/bus/w1/devices/10-00080201eed0/w1_slave

25 00 4b 46 ff ff 05 10 5d : crc=5d YES

25 00 4b 46 ff ff 05 10 5d t=18437

“temperature is 18.4 degrees Celsius”- Used two sensors connected to the warm

and cold water pipes running through my house

Page 11: central heating pump Monitoring and steering a and...The problem - house with central heating which runs under floor heating with allways on pump - when no heat is requested/provided,

pilight setupFor info: http://www.pilight.org/getting-started/settings/cat /etc/pilight/settings.json

{

# important parts (if I remember correctly)

"mode": "server",

"send-repeats": 10,

"receive-repeats": 1,

"gpio-sender": 1,

"gpio-receiver": 0,

"hw-mode": "gpio",

Page 12: central heating pump Monitoring and steering a and...The problem - house with central heating which runs under floor heating with allways on pump - when no heat is requested/provided,

The code pilightGot raw code via pilight-debug command and clicking on remote http://wiki.pilight.org/doku.php/pdebug# 3 aan

sudo /usr/local/sbin/pilight-send -p raw -c "169 507 169 507 169 676 169 507 169 507 507 169 169 507 507 169 169 676 507 169 169 507 507 169 169 676 507 169 507 169 507 169 169 676 169 676 169 507 169 676 169 676 169 507 507 169 507 169 169 5746"

# 3 uit

sudo /usr/local/sbin/pilight-send -p raw -c "169 507 169 507 169 507 169 507 169 507 507 169 169 507 507 169 169 507 507 169 169 507 507 169 169 507 507 169 507 169 507 169 169 507 169 507 169 676 169 507 507 169 507 169 169 676 169 507 169 5746"

Page 13: central heating pump Monitoring and steering a and...The problem - house with central heating which runs under floor heating with allways on pump - when no heat is requested/provided,

Monitoring

Page 14: central heating pump Monitoring and steering a and...The problem - house with central heating which runs under floor heating with allways on pump - when no heat is requested/provided,

The code, WiP#!/usr/bin/python

import os, glob, time, gspread, sys, datetime

#Google account details

email = '@gmail.com'

password = ''

spreadsheet = 'Temperature' #the name of the spreadsheet already created

#attempt to log in to your google account

try:

gc = gspread.login(email,password)

except:

print('fail')

sys.exit()

onderwaarde = 24

bovenwaarde = 50

#open the spreadsheet

worksheet = gc.open(spreadsheet).sheet1

#initiate the temperature sensor

os.system('/usr/bin/sudo /sbin/modprobe w1-gpio')

os.system('/usr/bin/sudo /sbin/modprobe w1-therm')

#set up the location of the sensor in the system

device_folder = glob.glob('/sys/bus/w1/devices/10*')

device_file = [device_folder[0] + '/w1_slave', device_folder[1] + '/w1_slave']

def read_temp_raw(): #a function that grabs the raw temperature data from the sensor

f_1 = open(device_file[0], 'r')

lines_1 = f_1.readlines()

f_1.close()

f_2 = open(device_file[1], 'r')

lines_2 = f_2.readlines()

f_2.close()

return lines_1 + lines_2

def read_temp(): #a function that checks that the connection was good and strips out the temperature

lines = read_temp_raw()

while lines[0].strip()[-3:] != 'YES' or lines[2].strip()[-3:] != 'YES':

time.sleep(0.2)

lines = read_temp_raw()

equals_pos = lines[1].find('t='), lines[3].find('t=')

temp = float(lines[1][equals_pos[0]+2:])/1000, float(lines[3][equals_pos[1]+2:])/1000

return temp

Page 15: central heating pump Monitoring and steering a and...The problem - house with central heating which runs under floor heating with allways on pump - when no heat is requested/provided,

tijd = time.localtime()

rij = (((tijd[3] * 60 + tijd[4] ) / 5) + 10)

acell1 = "A" + str(int(rij))

acell2 = "B" + str(int(rij))

acell3 = "C" + str(int(rij))

acell4 = "D" + str(int(rij))

temp = read_temp() #get the temp

if temp[0] > onderwaarde and temp[0] < bovenwaarde:

pomp = "aan"

os.system('/home/pi/pompaan.sh')

else:

pomp = "uit"

os.system('/home/pi/pompuit.sh')

worksheet.update_acell('A2', datetime.datetime.now())

worksheet.update_acell('B2', temp[0])

worksheet.update_acell('C2', temp[1])

worksheet.update_acell('D2', pomp)

worksheet.update_acell(acell1, datetime.datetime.now())

worksheet.update_acell(acell2, temp[0])

worksheet.update_acell(acell3, temp[1])

worksheet.update_acell(acell4, pomp)

Page 16: central heating pump Monitoring and steering a and...The problem - house with central heating which runs under floor heating with allways on pump - when no heat is requested/provided,

Security

- Google docs two factor authentication- API password still covers whole account and

rights to all Google services- sudo for pilight commands- use a cronjob for switching your pump on

and off for 5..10 minutes every day to keep it from locking up in summer time

- protect pump for water which is too hot

Page 17: central heating pump Monitoring and steering a and...The problem - house with central heating which runs under floor heating with allways on pump - when no heat is requested/provided,

Todo

- calibrate better (room thermostat temperature and floor aren’t connected) how to combine under floor and plate heating

- exchange pump for lower energy consumption from 75W to 5..12W

- figure out how to connect to a modulating central heating thermostat to Raspberry Pi

- better graphs/code

Page 19: central heating pump Monitoring and steering a and...The problem - house with central heating which runs under floor heating with allways on pump - when no heat is requested/provided,

Solved issues

- broken antenna in wire isolation caused some split hairs and rebuild of circuits :(

Page 20: central heating pump Monitoring and steering a and...The problem - house with central heating which runs under floor heating with allways on pump - when no heat is requested/provided,

Questions ???