Software
Sensing
In order for Meat Master to take the reading of the protein that it is cooking, we were using a thermocouple. I opted to take 20 samples of the temperature and take the average. This was done to make the readings that the thermocouple were outputting to be more consistent. When testing, we noticed that the fluctuations in temperature could be quite large and would trigger the done sequence to start prematurely.
Additionally, we have a timer that is running to let the user know when it is time to flip the protein.
Code
therm_sum = 0.0
therm_reading = []
# Take Samples
for k in range(20):
therm_reading.append(adc0.read())
therm_sum += therm_reading[k]
# Average Samples - calibration offset
therm_avg = (((therm_sum / 20000) - 1.25) / 0.005) - 0
print(" T = %3.3f deg C" % (therm_avg))Communication
To start Meat Master, the user would send a message to let it know what it is cooking and the doneness that the user wishes to achieve. Master would then interpret the message and choose the appropriate temperatures.
Code
# Define callback function to retrieve the message
temp = 0
message = ''
def sub_cb(topic, msg):
global message
global temp
message = msg.decode()
if "BEEF" in message:
if "MEDIUM-RARE" in message:
temp = 52
elif "MEDIUM-WELL" in message:
temp = 62
elif "RARE" in message:
temp = 49
elif "MEDIUM" in message:
temp = 55
else:
temp = 64
elif "CHICKEN" in message:
if "MEDIUM-WELL" in message:
temp = 62
elif "MEDIUM" in message:
temp = 57
else:
temp = 75
print(temp)
print(message)When the thermocouple determines that the protein should be either be flipped or is done cooking, Meat Master moves communication. Meat master has two methods of communication: Text and music.
Text is used to notify the user in the event that they walk away from the stovetop to do something else meanwhile.
Code
if therm_avg >= temp:
L1.duty(50)
print("Sent Done to AdaFruit")
mqtt.publish(feedName_done, sendDone)
print("Published {} to {}.".format(sendDone, feedName_done))
# Play Finish Sound
t1.init(period=75, mode=t1.PERIODIC, callback=grand_finale)
done = 1
elif flip_time == 0:
L1.duty(50)
print("Sent Flip to Adafruit")
mqtt.publish(feedName_flip, sendFlip)
print("Published {} to {}.".format(sendFlip, feedName_flip))
flip_time = 30
# Play Flip Sound
t1.init(period=10, mode=t1.PERIODIC, callback=annoying_flip_sound)Furthermore if the user does not have their phone, they could hear Meat Master playing a sound to let them know that it is done cooking. There are two different sounds that are played to let the user know which action should be done.
Full Code
Last updated