Page 1 of 1

Home Fuel Oil Boiler/Furnace Monitor

Posted: Fri Aug 11, 2017 2:51 pm
by headcrash
The hardware for my current home heating system and environment monitor consists of a Phidgets 8/8/8 Interface connected to a Beagleboard xM single board computer.

The Beagleboard is running Ubuntu 16.04 Linux headless. It is accessible on my home network from computers running Windows 10.

At present there are 5 Phidgets temperature sensors and 1 Phidgets humidity sensor connected to the 8/8/8 Interface's analog inputs. The furnace's oil boiler burner is connected to an 115 volt AC relay, whose N.O. contacts feed a didgital input on the 8/8/8 Interface. A toggle switch is connected to another digital input for the purpose of stopping the monitoring program in an orderly fashion, i.e., closing files and the Phidgets module.

I'm monitoring the temperature and humidity in our main hallway, as well as the temperature in the attic, garage, outside and the temperature of the oil boiler[hot water].

The Python program running on the Beagleboard writes the value of these 6 analog sensors, the state of the oil boiler burner digital input along with the date and time under 3 conditions; (1) each time the oil boiler burner turn on or off (2) anytime the oil boiler temperature changes by more than 1 degree (3) at midnight each day.

The amount of burn time in seconds and amount of fuel oil in gallons are also written out each time the oil boiler burner turns off and at midnight each day.

The number of seconds for each burn time is in the range of 150-350 seconds, with a daily total of something in the range of 18,000 seconds per day in the middle of the winter here in New Hampshire.

The numbers of gallons for each burn time and daily period is calculated using the burner's .8 gallons per hour fuel orfice as a basis. For example, 18,000 / 60 / 60 = 5 hours x .8 = 4 gallons burned per day.

One of my objectives was to try different oil boiler settings to see if I could improve heating efficiency. Some experts say a hot water baseboard radiator system like I have runs more efficient at 190 degrees than a lower setting. I have found that to be true, although the difference is not dramatic.

My oil boiler furnace is located in my 1st floor garage, which stays around 57 degrees in the winter. I assumed it was because all the boiler's copper water lines running to the above rooms were bare and not insulated, so I insulated them. That did lower the temperature in the garage but only by about 1 degree.

It is summer right now, and I recently added a gable vent exhaust fan. Before the attic temperature was hitting 130 degrees on a 90 degree day. Now it stays below 115 degrees, which has to help my room air conditioners to some extent. I'd like to add a relay to the fan, so I can connect another Phidgets digital input and know when the fan is running.

Getting back to the project itself… the Beagleboard (under Linux/Python) has been running Phidgets 2.18 for about a year. Recently I updated Linux and decided to update the Phidgets software as well, not realizing 2.2 was more than a minor update. Shame on me for not reading about 2.2 first!

Anyway, after several frustrating hours, I backed 2.2 out and reloaded the latest 2.18. I still plan to update to 2.2 but not until I have plenty of time available.

As far as analyzing the data this project generates, I have a small laptop dedicated to running Microsoft SQL Server under Windows 10 upstairs in my office. Everyday at 1 minute past midnight, it goes out on my home network and gets the previous day's data file from the Beagleboard downstairs.

I should have mentioned the Beagleboard creates a new data file each day by including the date in the filename.

I have a few SQL Server queries I manually run on the data to do such things as compare fuel oil usage between days with the same average temperature. That way I can evaluate changes to the heating system.

I have also on occasion graphed the data using Excel to do such things as comparing fuel oil usage to outside temperature.

One thing I'm contemplating is actually controlling the oil boiler temperature depending on the outside temperature. Right now (it's summer) I have the high limit set to 160 since it's only heating hot water for showers, doing the laundry, etc.

Controlling the burner would definitely require some redundant safeguards. Although some years ago I was controlling a forced air gas furnace, as well as a gas stove using this same Phidgets Interface. In both of thoses case, the furnace and stove had independent high temperature shutoffs. This boiler also has a high temperature shutoff, but it's not independent.

[img]
fuelOilMonitor.jpg
[/img]

Code: Select all

import csv
import sys
import time
import datetime
from time import sleep
from Phidgets.Devices.InterfaceKit import InterfaceKit

interfaceKit = InterfaceKit()
interfaceKit.openPhidget(97505)

gallons = float(0)
galDay = float(0)
secDay = float(0)
indoorTemp = float(0)
outdoorTemp = float(0)
once = int(0)

## allow time for phidget interface to open
sleep(5)

## initialize boiler temp
iTemp2 = int(round(((((interfaceKit.getSensorValue(7))*.2222)-61.111)*9/5)+32))

## initialize burner status to off
wasOn = 'No'

## set filename for 24 hr period
def writeToLogf():
    global oilBurner
    doy = datetime.datetime.now()
    dayOfYear = datetime.date(doy.year, doy.month, doy.day)
    #oilBurner = '/mnt/windows/oilBurner' + str(dayOfYear) + '.csv'
    oilBurner = 'share/oilBurner' + str(dayOfYear) + '.csv'
    
## open log file for burner on/off
def writeToLoga(): 
    global out_file

    writeToLogf()
    out_file = open(oilBurner, 'a')
    out_file.writelines(str(elapsedTime))
    out_file.writelines(",")
    out_file.writelines(str(gallons))
    out_file.writelines(",")
    writeToLog()

## open log file for daily total seconds/gallons        
def writeToLogb():
    global out_file

    writeToLogf()   
    out_file = open(oilBurner, 'a')
    out_file.writelines(str(secDay))
    out_file.writelines(",")
    out_file.writelines(str(galDay))
    out_file.writelines(",")
    writeToLog()        

## open log file everytime boiler changes by more than 1 degree
def writeToLogc():
    global out_file

    writeToLogf() 
    out_file = open(oilBurner, 'a')
    out_file.writelines(",")
    out_file.writelines(",")
    writeToLog()

## Write sensors to Log File
def writeToLog():
    tod = datetime.datetime.now()
    timeOfDay = datetime.time(tod.hour, tod.minute, tod.second)
    doy = datetime.datetime.now()
    dayOfYear = datetime.date(doy.year, doy.month, doy.day)

    out_file.writelines(str(timeOfDay))
    out_file.writelines(",")
    out_file.writelines(str(dayOfYear))
    out_file.writelines(",")

    ## write garage temp to logfile
    iTemp=int(round(((((interfaceKit.getSensorValue(3))*.2222)-61.111)*9/5)+32))
    garageTemp=str(iTemp)
    out_file.writelines(garageTemp)
    out_file.writelines(",")

    ## write upstairs temp to logfile
    iTemp=int(round(((((interfaceKit.getSensorValue(4))*.2222)-61.111)*9/5)+32))
    indoorTemp=str(iTemp)
    out_file.writelines(indoorTemp)
    out_file.writelines(",")

    ## write outdoor temp to logfile
    iTemp=int(round(((((interfaceKit.getSensorValue(6))*.2222)-61.111)*9/5)+32))
    outdoorTemp=str(iTemp)
    out_file.writelines(outdoorTemp)
    out_file.writelines(",")

    ## write boiler temp to logfile
    iTemp=int(round(((((interfaceKit.getSensorValue(7))*.2222)-61.111)*9/5)+32))
    boilerTemp=str(iTemp)
    out_file.writelines(boilerTemp)
    out_file.writelines(",")

    ## write upstairs humidity to logfile
    rH=int(round(((interfaceKit.getSensorValue(5))*.1906)-40.2))
    humidity=str(rH)
    out_file.writelines(humidity)
    out_file.writelines(",")
    
    ## write attic temp to logfile
    iTemp=int(round(((((interfaceKit.getSensorValue(2))*.2222)-61.111)*9/5)+32))
    atticTemp=str(iTemp)
    out_file.writelines(atticTemp)
    out_file.writelines('\n')
    out_file.close()
    
while True:
    ## option for average boiler temp read
    iTemp = []
    
    for x in range(10):        
        iTemp = iTemp + [int(round(((((interfaceKit.getSensorValue(7))*.2222)-61.111)*9/5)+32))]
        sleep(.1)
    
    iTemp1 = sum(iTemp)/len(iTemp)
    
    ## option for single boiler temp read
    #iTemp1 = int(round(((((interfaceKit.getSensorValue(7))*.2222)-61.111)*9/5)+32))
    
    ## check & write to log file if boiler temp has changed 
    if iTemp1 > (iTemp2 + 1) or iTemp1 < (iTemp2 -1):
        iTemp2 = iTemp1
        writeToLogc()
           
    ## check oil burner status    
    if interfaceKit.getInputState(2) == True:        
        line_out = '1'
        interfaceKit.setOutputState(0,1)
        
    if interfaceKit.getInputState(2) == False:
        line_out = '0'
        interfaceKit.setOutputState(0,0)
        
    if line_out == '1':
        if wasOn == 'Yes':
            ## Loop1 - oil burner is still On
            pass
        else:
            ## Loop2 - oil burner just turned On
            startElapsedTime = float(time.time())
            gallons = 0
            elapsedTime = 0
            writeToLoga()
            wasOn = 'Yes'
    else:
        if wasOn == 'Yes':
            ## Loop3 - oil burner just turned Off
            stopElapsedTime = float(time.time())
            elapsedTime = round(stopElapsedTime - startElapsedTime, 1)
            secDay = round(secDay + elapsedTime, 1)
            gallons = round(elapsedTime/4500, 3)
            galDay = round(galDay + gallons, 3)
            writeToLoga()
            wasOn = 'No'
            
        else:
            ## Loop4 - oil burner is still Off
            pass

    ## post seconds and gallons used last 24 hrs to Log File at 23:59:00 AM
    chk = datetime.datetime.now()
    if datetime.time(chk.hour, chk.minute) == datetime.time(23, 59,):
        if once == 0:
            writeToLogb()
            secDay = 0
            galDay = 0
            once = 1

    if datetime.time(chk.hour, chk.minute) == datetime.time(0, 0,):
        once = 0
    
    ## check to see if program break switch has been activated
    brk = interfaceKit.getInputState(7)
    if brk == True:
        break

## make sure log file is closed
writeToLog() 
out_file.close()

## close phidget
interfaceKit.closePhidget() 

Re: Home Fuel Oil Boiler/Furnace Monitor

Posted: Wed Nov 08, 2017 6:01 pm
by LucasP
Great project. Thanks for sharing!

Have you updated to Phidget22 yet?