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...
This is a "pellet stove" - basically a wood-burning stove that burns these small pellets made from sawdust...
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:
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").split(" ") 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).
That's it for now. Next up: pull data from National Weather Service API to enrich data set....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.