Skip to content

Commit e6f3f3b

Browse files
committed
Initial commit
1 parent 24c5feb commit e6f3f3b

9 files changed

Lines changed: 52349 additions & 0 deletions

File tree

PyPortal_EZ_Make_Oven/code.py

Lines changed: 519 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import time
2+
import json
3+
import board
4+
import busio
5+
import array
6+
import math
7+
import audioio
8+
import displayio
9+
import digitalio
10+
import terminalio
11+
from adafruit_pyportal import PyPortal
12+
from adafruit_bitmap_font import bitmap_font
13+
from adafruit_display_text import label
14+
from adafruit_button import Button
15+
import adafruit_touchscreen
16+
from adafruit_bus_device.i2c_device import I2CDevice
17+
from adafruit_mcp9600 import MCP9600
18+
19+
SENSOR_ADDR = 0X60
20+
21+
i2c = busio.I2C(board.SCL, board.SDA,frequency=200000)
22+
sensor = MCP9600(i2c,SENSOR_ADDR,"K")
23+
24+
oven = digitalio.DigitalInOut(board.D4)
25+
oven.direction = digitalio.Direction.OUTPUT
26+
27+
def oven_control(enable=False):
28+
#board.D4
29+
oven.value = enable
30+
31+
check_temp = 100
32+
print("This program will determine calibration settings for your oven ")
33+
print("to use with the EZ Make Oven Controller.\n\n")
34+
print("Calibration will start in 10 seconds...")
35+
time.sleep(10)
36+
print("Starting...")
37+
print("Calibrating oven temperature to ",check_temp)
38+
finish = False
39+
oven_control(True)
40+
maxloop=300
41+
counter = 0
42+
while not finish:
43+
time.sleep(1)
44+
counter += 1
45+
current_temp = sensor.temperature
46+
print(current_temp)
47+
if current_temp >= check_temp:
48+
finish = True
49+
oven_control(False)
50+
if counter >= maxloop:
51+
raise Exception("Oven not working or bad sensor")
52+
53+
print("checking oven lag time and temperature")
54+
finish = False
55+
start_time = time.monotonic()
56+
start_temp = sensor.temperature
57+
last_temp = start_temp
58+
59+
while not finish:
60+
time.sleep(1)
61+
current_temp = sensor.temperature
62+
print(current_temp)
63+
if current_temp <= last_temp:
64+
finish = True
65+
last_temp = current_temp
66+
67+
lag_temp = last_temp - check_temp
68+
lag_time = int(time.monotonic() - start_time)
69+
70+
print("** Calibration Results **")
71+
print("Modify config.json with these values for your oven:")
72+
print("calibrate_temp:", lag_temp)
73+
print("calibrate_seconds:",lag_time)

PyPortal_EZ_Make_Oven/config.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"sensor_address": 103,
3+
"profile": "sn63pb37",
4+
"calibrate_temp": 29.5625,
5+
"calibrate_seconds": 37
6+
}

0 commit comments

Comments
 (0)