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...
Scott's house - summer
Scott's house - early winterScott's house - late winter
This is a "pellet stove" - basically a wood-burning stove that burns these small pellets made from sawdust...
my pellet stovea handful of douglas fir wood pelletspellet stove controller to be replaced by pipellets come down the chute via a stepper-motor controlled auger into this burn pot and are ignitedburning 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:
Pi3 and breadboardinfrared (flame) sensorcapturing 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 RPi.GPIO as GPIO
import MySQLdb as mdb
db = mdb.connect("localhost","pisensor","<pwd>","pelletdb")
curs = db.cursor()
tempfile = open ("/sys/bus/w1/devices/28-051691a25bff/w1_slave")
thetext = tempfile.read()
tempdata = thetext.split("\n").split(" ")
temperature = float(tempdata[2:])
temperature = temperature /1000
curs.execute ("INSERT INTO pisensor VALUES (NOW(),%s,%s)",(temperature,flame))
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).
RM process to retrieve data from Pi and store in RM local (Google Drive) repository
proof that things are working
That's it for now. Next up: pull data from National Weather Service API to enrich data set....