Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions killSite.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
sudo pkill python
echo Killing website
6 changes: 6 additions & 0 deletions website.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
cd website
sudo python3 coolerControl.py &
sudo python3 saveTempData.py &
sudo python3 tempLogger.py &
sudo python3 homepage.py &
10 changes: 10 additions & 0 deletions website/PIN/pinRead.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import RPi.GPIO as GPIO
import time
import numpy as np

GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
while True:
pin = int(input("Choose a pin: "))
GPIO.setup(int(pin),GPIO.OUT)
print(str(GPIO.input(pin)))
16 changes: 16 additions & 0 deletions website/PIN/writePin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import RPi.GPIO as GPIO
import time
import numpy as np

GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
while True:
pin = int(input("Choose a pin: "))
GPIO.setup(int(pin),GPIO.OUT)
print("Pin " + str(pin) + " status:"+str(GPIO.input(pin)))
if (GPIO.input(pin) == 0):
print("Turning it on")
GPIO.output(pin,GPIO.HIGH)
else:
print("Turning it off")
GPIO.output(pin,GPIO.LOW)
18 changes: 18 additions & 0 deletions website/__pycache__/PIN/writePin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import RPi.GPIO as GPIO
import time
import tempRead
import target
import numpy as np

GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
while True:
pin = int(input("Choose a pin: "))
GPIO.setup(int(pin),GPIO.OUT)
print("Pin " + str(pin) + " status:"+str(GPIO.input(pin)))
if (pin == 0):
print("Turning it on")
GPIO.output(pin,GPIO.HIGH)
else:
print("Turning it off")
GPIO.output(pin,GPIO.LOW)
Binary file modified website/__pycache__/ai.cpython-37.pyc
Binary file not shown.
Binary file modified website/__pycache__/readData.cpython-37.pyc
Binary file not shown.
Binary file modified website/__pycache__/target.cpython-37.pyc
Binary file not shown.
Binary file modified website/__pycache__/tempRead.cpython-37.pyc
Binary file not shown.
Binary file modified website/__pycache__/think.cpython-37.pyc
Binary file not shown.
41 changes: 29 additions & 12 deletions website/coolerControl.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,47 @@
import RPi.GPIO as GPIO
import time
import tempRead
import target
import numpy as np

import target
import tempRead
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
pumps = 14
peltier = 15
pumps = 24
peltier = 25
GPIO.setup(pumps,GPIO.OUT)
GPIO.setup(peltier,GPIO.OUT)
recentlyCycled = False
coolers = False
while True:

try:
tempTarget = target.readTarget()
tempTarget = float(tempTarget)

try:
tempTarget = target.readTarget()
tempTarget = float(tempTarget)
except:
tempTarget = 3
print("Something went wrong, could not read TempTarget")
time.sleep(0.01)
#print("\n\n")

#print(tempTarget)
#print("ok")
#print(GPIO.input(pumps))
try:
actualTemp = tempRead.get_temp()
except:
print("Could not read temp")
actualTemp = 5
#print(actualTemp)
#print("her")
#actualTemp = tempRead.read_temp()
actualTemp = tempRead.get_temp()
if tempTarget > actualTemp + 0.5 and GPIO.input(pumps) == 1:
#actualTemp = tempRead.get_temp()
if tempTarget > float(actualTemp) + 0.5 and GPIO.input(pumps) == 1:
print("Turning OFF coolers")
GPIO.output(pumps,GPIO.LOW)
GPIO.output(peltier,GPIO.LOW)
recentlyCycled = False
elif tempTarget< actualTemp and GPIO.input(pumps) == 0:
elif tempTarget < actualTemp and GPIO.input(pumps) == 0:
print("Turning ON coolers")
GPIO.output(pumps,GPIO.HIGH)
GPIO.output(peltier,GPIO.HIGH)
Expand All @@ -34,10 +50,11 @@
GPIO.output(pumps,GPIO.HIGH)
GPIO.output(peltier,GPIO.HIGH)
print("Cycling hot water")
time.sleep(2)
time.sleep(5)
GPIO.output(pumps,GPIO.LOW)
GPIO.output(peltier,GPIO.LOW)
recentlyCycled = True

'''except Exception as e:
print("Failed to do it")
print(e)
Expand All @@ -47,6 +64,6 @@
print("Failed to do it")
#exit()'''
except:
a = 2
print("\n\nSomething went terribly wrong!!!\n\n")


57 changes: 57 additions & 0 deletions website/coolerControl.py.save
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import RPi.GPIO as GPIO
import time
import numpy as np

GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
pumps = 24
peltier = 25
GPIO.setup(pumps,GPIO.OUT)
GPIO.setup(peltier,GPIO.OUT)
recentlyCycled = False
coolers = False
while True:

try:
# print("FUCK")
tempTarget = target.readTarget()
tempTarget = float(tempTarget)
time.sleep(0.01)
#print("\n\n")
print(tempTarget)
print(GPIO.input(pumps))
actualTemp = tempRead.get_temp()
print(actualTemp)
print("\n\n")
#actualTemp = tempRead.read_temp()
#actualTemp = tempRead.get_temp()
if tempTarget > actualTemp + 0.5 and GPIO.input(pumps) == 1:
print("Turning OFF coolers")
GPIO.output(pumps,GPIO.LOW)
GPIO.output(peltier,GPIO.LOW)
recentlyCycled = False
elif tempTarget< actualTemp and GPIO.input(pumps) == 0:
print("Turning ON coolers")
GPIO.output(pumps,GPIO.HIGH)
GPIO.output(peltier,GFOPIO.HIGH)
recentlyCycled = False
elif tempTarget < actualTemp + 0.2 and GPIO.input(pumps) == 0 and recentlyCycled == False:
GPIO.output(pumps,GPIO.HIGH)
GPIO.output(peltier,GPIO.HIGH)
print("Cycling hot water")
time.sleep(5)
GPIO.output(pumps,GPIO.LOW)
GPIO.output(peltier,GPIO.LOW)
recentlyCycled = True
'''except Exception as e:
print("Failed to do it")
print(e)
print(type(tempTarget))
print(type(actualTemp))
print(type(GPIO.input(14)))
print("Failed to do it")
#exit()'''
except:
a = 2


58 changes: 58 additions & 0 deletions website/coolerControl.py.save.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import RPi.GPIO as GPIO
import time
import numpy as np
import target
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
pumps = 24
peltier = 25
GPIO.setup(pumps,GPIO.OUT)
GPIO.setup(peltier,GPIO.OUT)
recentlyCycled = False
coolers = False
while True:

try:

tempTarget = target.readTarget(
tempTarget = float(tempTarget)
time.sleep(0.01)
#print("\n\n")
print("ok")
print(tempTarget)
print(GPIO.input(pumps))
actualTemp = tempRead.get_temp()
print(actualTemp)
print("\n\n")
#actualTemp = tempRead.read_temp()
#actualTemp = tempRead.get_temp()
if tempTarget > actualTemp + 0.5 and GPIO.input(pumps) == 1:
print("Turning OFF coolers")
GPIO.output(pumps,GPIO.LOW)
GPIO.output(peltier,GPIO.LOW)
recentlyCycled = False
elif tempTarget< actualTemp and GPIO.input(pumps) == 0:
print("Turning ON coolers")
GPIO.output(pumps,GPIO.HIGH)
GPIO.output(peltier,GFOPIO.HIGH)
recentlyCycled = False
elif tempTarget < actualTemp + 0.2 and GPIO.input(pumps) == 0 and recentlyCycled == False:
GPIO.output(pumps,GPIO.HIGH)
GPIO.output(peltier,GPIO.HIGH)
print("Cycling hot water")
time.sleep(5)
GPIO.output(pumps,GPIO.LOW)
GPIO.output(peltier,GPIO.LOW)
recentlyCycled = True
'''except Exception as e:
print("Failed to do it")
print(e)
print(type(tempTarget))
print(type(actualTemp))
print(type(GPIO.input(14)))
print("Failed to do it")
#exit()'''
except:
a = 2


Binary file modified website/data10Sec.npz
Binary file not shown.
Binary file modified website/data3Min.npz
Binary file not shown.
19 changes: 15 additions & 4 deletions website/homepage.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(14,GPIO.OUT)
GPIO.setup(24,GPIO.OUT)

s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80))
Expand All @@ -24,11 +24,11 @@
@app.route('/',methods = ['GET'])
@app.route('/send',methods = ['GET','POST'])
def send():
return render_template('age.html', ip=s.getsockname()[0])
return render_template('age.html', ip="ecbeer.dk")#=s.getsockname()[0])

@app.route('/admin',methods = ['GET','POST'])
def admin():
return render_template('admin.html', ip=s.getsockname()[0])
return render_template('admin.html', ip="ecbeer.dk")#ip=s.getsockname()[0])

@app.route('/images',methods = ['GET','POST'])
def images():
Expand Down Expand Up @@ -60,7 +60,7 @@ def charts():
@app.route('/readTarget',methods = ['GET','POST'])

def readTarget():
list ={'target':[target.readTarget()],'status':[str(GPIO.input(14))]}
list ={'target':[target.readTarget()],'status':[str(GPIO.input(24))]}
return jsonify(list) #Returns JSON with list


Expand All @@ -78,7 +78,18 @@ def estimate():
list ={'estimate':[ai.estimate()]}
return jsonify(list) #Returns JSON with list

@app.route('/turnOff',methods = ['GET','POST'])
def turnOff():
os.system("sudo shutdown -h now")

@app.route('/reboot',methods = ['GET','POST'])
def reboot():
print("Rebooting")
os.system("sudo reboot")

if __name__ == '__main__':
app.run(debug=False,port=80,host='0.0.0.0')




Binary file added website/oldLogs/data10Sec00.npz
Binary file not shown.
Binary file added website/oldLogs/data10Sec01.npz
Binary file not shown.
Binary file added website/oldLogs/data10Sec02.npz
Binary file not shown.
Binary file added website/oldLogs/data10Sec03.npz
Binary file not shown.
Binary file added website/oldLogs/data10Sec04.npz
Binary file not shown.
Binary file added website/oldLogs/data10Sec05.npz
Binary file not shown.
Binary file added website/oldLogs/data10Sec06.npz
Binary file not shown.
Binary file added website/oldLogs/data10Sec07.npz
Binary file not shown.
Binary file added website/oldLogs/data10Sec08.npz
Binary file not shown.
Binary file added website/oldLogs/data10Sec09.npz
Binary file not shown.
Binary file modified website/oldLogs/data10Sec10.npz
Binary file not shown.
Binary file added website/oldLogs/data10Sec11.npz
Binary file not shown.
Binary file added website/oldLogs/data10Sec12.npz
Binary file not shown.
Binary file added website/oldLogs/data10Sec13.npz
Binary file not shown.
Binary file added website/oldLogs/data10Sec14.npz
Binary file not shown.
Binary file added website/oldLogs/data10Sec15.npz
Binary file not shown.
Binary file added website/oldLogs/data10Sec16.npz
Binary file not shown.
Binary file added website/oldLogs/data10Sec17.npz
Binary file not shown.
Binary file added website/oldLogs/data10Sec18.npz
Binary file not shown.
Binary file added website/oldLogs/data10Sec19.npz
Binary file not shown.
Binary file added website/oldLogs/data10Sec20.npz
Binary file not shown.
Binary file added website/oldLogs/data10Sec21.npz
Binary file not shown.
Binary file added website/oldLogs/data10Sec22.npz
Binary file not shown.
Binary file added website/oldLogs/data10Sec23.npz
Binary file not shown.
12 changes: 12 additions & 0 deletions website/pinRead.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import RPi.GPIO as GPIO
import time
import tempRead
import target
import numpy as np

GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
while True:
pin = int(input("Choose a pin: "))
GPIO.setup(int(pin),GPIO.OUT)
print(str(GPIO.input(pin)))
Binary file modified website/static/pictures/IMG_20200301_112325.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified website/static/pictures/IMG_20200301_112328.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified website/static/pictures/IMG_20200620_150024.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified website/static/pictures/IMG_20200620_162213.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified website/static/pictures/IMG_20200620_162217.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified website/static/pictures/IMG_20200620_162220.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified website/static/pictures/IMG_20200620_162427.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified website/static/pictures/IMG_20200620_164453.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified website/static/pictures/IMG_20200620_164501.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified website/static/pictures/IMG_20200620_164503.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified website/static/pictures/IMG_20200620_164507.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified website/static/pictures/IMG_20200621_180701.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified website/static/pictures/IMG_20200628_204354.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified website/static/pictures/IMG_20200628_204401.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified website/static/pictures/IMG_20200701_143437.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified website/static/pictures/IMG_20201229_113529938.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified website/static/pictures/MVIMG_20200620_162433.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified website/static/pictures/V1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified website/static/pictures/v2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified website/target.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion website/targetTemp.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3
10
2 changes: 1 addition & 1 deletion website/tempData.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
17.75;28.625
19.437;33.125
2 changes: 1 addition & 1 deletion website/tempDataMain.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.312
5.375
5 changes: 3 additions & 2 deletions website/tempRead.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ def read_temp():
file.close()
return(parsedTemp,f[:f.find(";")],f[f.find(";")+1:])
def get_temp():
#print("OK")
parsedTemp = parse_temp(temp_sensor0)
f = open("tempDataMain.txt","w")
f.write(str(parsedTemp))
f.close()
return parsedTemp
print(get_temp())
return parsedTemp # parsedTemp
#print(get_temp())
Binary file modified website/tempRead.pyc
Binary file not shown.
Loading