The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here

Heating a Vermont house with Pi and Pellets - Part 1

sgenzersgenzer Administrator, Moderator, Employee-RapidMiner, RapidMiner Certified Analyst, Community Manager, Member, University Professor, PM Moderator Posts: 2,959 Community Manager
edited November 2018 in Knowledge Base

Greetings Community,

  

As many of you may know, I live in a beautiful place called Vermont where the leaves are gorgeous in the fall, and there is plenty of snow and cold in the winter.  Hence the cost and logistics of heating your house is a frequent topic of conversation up here and, as an avid data geek, I am always striving to get the maximum BTUs out of my heating system.  In this series of blog posts, I am going to share my new journey of turning my heating system into a wicked-amazing IoT optimization system using a Raspberry Pi, a bunch of sensors, and of course RapidMiner to do the heavy lifting.

 

This is my house in various times of year...

IMG_2943.jpgScott's house - summer

IMG_3525.jpgScott's house - early winter IMG_3600.jpgScott's house - late winter

 

 

 

 

 

 

 

 

 

This is a "pellet stove" - basically a wood-burning stove that burns these small pellets made from sawdust...

IMG_3937.JPGmy pellet stoveIMG_3941.JPGa handful of douglas fir wood pelletsIMG_3938.JPGpellet stove controller to be replaced by piIMG_3940.JPGpellets come down the chute via a stepper-motor controlled auger into this burn pot and are ignitedIMG_3942.JPGburning pellets

 

 Phase 1: Setup and Data Collection

 

I get my Pi going with the standard RaspbianOS, install a MySQL database that will store sensor data, and hook up two sensors to get started: temperature (in the room) and an infrared "flame" sensor:

IMG_3935.JPGPi3 and breadboardIMG_3936.JPGinfrared (flame) sensorScreen Shot 2017-08-28 at 12.04.26 PM.pngcapturing data into mysql table

 

 

I am probably the worst programmer on the face of the earth - thank goodness for Google.  Here's the Python code for grabbing sensor data and storing into mysql:

 

import time
import datetime
import RPi.GPIO as GPIO
import MySQLdb as mdb

GPIO.setmode(GPIO.BCM)
GPIO.setup(17,GPIO.IN)

db = mdb.connect("localhost","pisensor","<pwd>","pelletdb")
curs = db.cursor()

while 1:
tempfile = open ("/sys/bus/w1/devices/28-051691a25bff/w1_slave")
thetext = tempfile.read()
tempfile.close()
tempdata = thetext.split("\n")[1].split(" ")[9]
temperature = float(tempdata[2:])
temperature = temperature /1000
flame=GPIO.input(17)
curs.execute ("INSERT INTO pisensor VALUES (NOW(),%s,%s)",(temperature,flame))
db.commit()
print temperature
print flame
time.sleep(5)

The 5-second delay is a compromise that may need to be tweaked later...I'm worried about storage in my little Pi.  So I want to pull the data off the pi and store it in my RapidMiner local repository (actually it's a Google Drive repository that RM thinks is local).

Screen Shot 2017-08-28 at 12.21.34 PM.pngRM process to retrieve data from Pi and store in RM local (Google Drive) repository

 

 

chart.pngproof that things are working  

 

 

 

 

 

 

 

 

 

 

That's it for now.  Next up: pull data from National Weather Service API to enrich data set....

Answers

Sign In or Register to comment.