Created
November 30, 2014 14:57
-
-
Save rockfishon/0b9b96481429d4fe42be to your computer and use it in GitHub Desktop.
Raspberry Pi Wood Stove Data Logger
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import time | |
import serial | |
import array | |
import datetime | |
ser = serial.Serial("/dev/ttyACM0", baudrate=9600, timeout=7.0) | |
ser.isOpen() | |
command=ser.readline() | |
while 1: | |
command=ser.readline() | |
temp=command.split() | |
tempb=str(temp)[2:-2] | |
print(tempb) | |
file=open('stove.dat','a') | |
file.write('%s,%s\n' %(datetime.datetime.now(),str(tempb))) | |
file.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib2 | |
import json | |
import datetime | |
f = urllib2.urlopen('http://api.wunderground.com/api/(your code)/geolookup/conditions/q/MD/Crofton.json') | |
json_string = f.read() | |
parsed_json = json.loads(json_string) | |
location = parsed_json['location']['city'] | |
temp_f = parsed_json['current_observation']['temp_f'] | |
file=open('temp-gambrills.dat','a') | |
file.write('%s,%s\n' %(datetime.datetime.now(),temp_f)) | |
f.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html><body><h1>Wood Stove Controller</h1> | |
<p></p> | |
<p></p> | |
<meta http-equiv="refresh" content="300"/> | |
<img src="roomdata.jpeg"/> | |
<img src="stovedata.jpeg"/> | |
</body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
reset | |
set xdata time | |
set datafile separator "," | |
set xtics rotate | |
set term jpeg | |
set autoscale xy | |
set autoscale y2 | |
set timefmt "%Y-%m-%d %H:%M:%S" | |
set format x "%d %H:%M:%S" | |
set style data line | |
set xlabel "Date/Time" | |
set ylabel "Stove Temp in F" | |
set y2label "Outside Temp in F" | |
set y2tics | |
set output "stovedata.jpeg" | |
set title "Stove Data" | |
plot 'stove1.dat' using 1:2 axis x1y1 title 'Stove Temp',\ | |
'stove1.dat' using 1:3 axis x1y1 title 'Stove Set Point',\ | |
'temp-gambrills1.dat' using 1:2 axis x1y2 title 'Outside Temp',\ | |
'stove1.dat' using 1:8 title 'Room Temp' axis x1y2,\ | |
'stove1.dat' using 1:5 title 'Servo Setting' | |
set output "roomdata.jpeg" | |
set title "Room Data" | |
set y2label "Servo Position" | |
plot 'stove1.dat' using 1:7 title 'Room Temp Set Point',\ | |
'stove1.dat' using 1:8 title 'Room Temp',\ | |
'stove1.dat' using 1:5 title 'Servo Setting' axis x1y2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment