So one of the ways that I want to start using this blog is to record some of my experiments with coding, making, 3d scanning and printing and other odds and ends more generally. It’s not going to be academic in any way, shape or form (although I guess I am quite interested in maker spaces and maker communities from a teaching, learning and research perspective), but rather a handy record for me to use to reflect on what I’ve done and what I might want to do. As I’ve said before, I run this blog for my own benefit than in the forlorn hope that anyone else might read it.
So, here’s my first version of what that might look like. It’s for a project called the Beer Board, and it’s going to combine a few of the interests I’ve outlined above. I might even share some images of the final product or different iterations as it develops.
CONTEXT: As I get better and more efficient with home brewing, it would be useful to have a way of reminding and recording to myself at what stage I am for the brewing process. I have broken the main (active) part of the brewing process into the following steps:
- Heating the water in the Hot Liquor Tan
- Mashing in the grains
- Boiling the wort
Each of these processes takes a certain amount of time. Certainly the boiling part often requires a close eye to be kept on the time. In the past, I’ve used a stopwatch app on my phone, but it would be nice to have a more bespoke solution – ideally one that would talk to each part and give a visual reminder of what was happening.
PURPOSE: The purpose of the beer board is to act as a visual timer and representation of what I am doing in terms of my home-brewing set up. It needs to be able to have a countdown from a user-inputted variable, and also a visual representation (such as an LED) that demonstrates at what point in the brew process we are up to. It should also have a buzzer to indicate when the stopwatch reaches zero.
MATERIALS: I’ve played around with the idea of using Arduino, but I decided to stay away from that because of my relative unfamiliarity with C#. Instead, I figured I might be able to make it work with a Raspberry Pi, running Python (because I’ve been playing around with Python) a bit at the moment. I also planned to design the enclosure (using Tinkercad) and then print it out on the Lulzbot Mini 2.
CODE (Version 1):
import time
#import GPIO
from Adafruit_CharLCD import Adafruit_CharLCD # Importing Adafruit library for LCD
# instantiate lcd and specify pins
lcd = Adafruit_CharLCD(rs=26, en=19, d4=13, d5=6, d6=5, d7=21, cols=16, lines=2)
# instantiate leds
heat_led = LED(25)
mash_led = LED(8)
boil_led = LED(7)
# instantiate buttons
heat_button = button(21)
mash_button = button(22)
boil_button = button(23)
reset_button = button(24)
increment_button = button(19)
exit_button = button(18)
#instantiate buzzer
buzzer = Buzzer(20)
stopwatch_time: int = 0
# this function is meant to trigger at start up and welcome users.
def welcome_screen():
print("Hello and welcome to /n Heggart's Brew Board")
lcd.message("Hello and welcome to /n Heggart's Brew Board")
time.sleep(3)
print("This will time your /n boil, mash and brew.")
lcd.message("This will time your /n boil, mash and brew.")
time.sleep(3)
# this function gets the time through the increment button
def get_time():
# stopwatch_time = input("Enter your time in minutes: ")
print("Enter your time in minutes")
lcd.message("Enter your time in minutes")
while True:
if increment_button.ispressed():
stopwatch_time += 5
print(stopwatch_time, " minutes has been entered")
lcd.message(stopwatch_time, "minutes has been entered.")
elif reset_button.ispressed():
stopwatch_time = 0
print("Time has been reset")
lcd.message("Time has been reset to zero.")
elif exit_button.ispressed():
break
stopwatch_time_sec = stopwatch_time * 60
return stopwatch_time_sec
def select_func():
print("Select which feature you /n would like to use:")
lcd.message("Select whch feature you /n would like to use")
time.sleep(3)
print("Using the buttons below.")
lcd.message("Using the buttons below.")
time.sleep(3)
#brew_func: str = input("Enter boil, mash or brew.")
if heat_button.ispressed():
heat_led.on()
timer(set_timer)
if mash_button.ispressed():
mash_led.on()
timer(set_timer)
if boil_button.ispressed():
boil_led.on()
timer(set_timer)
def play_buzzer():
buzzer.beep(1, 1, 8)
buzzer.off
def timer(seconds):
start = time.time()
# time.time() returns the number of seconds since the unix epoch.
# To find the time since the start of the function, we get the start
# value, then subtract the start from all following values.
# time.clock()
# When you first call time.clock(), it just starts measuring
# process time. There is no point assigning it to a variable, or
# subtracting the first value of time.clock() from anything.
# Read the documentation for more details.
elapsed = 0
while elapsed < seconds:
elapsed = time.time() - start
# print("loop cycle time: %f, seconds count: %02d" % (time.clock() , elapsed))
print("Seconds passed: %02d" % (elapsed))
lcd.message("Seconds passed: %02d" % (elapsed))
time.sleep(1)
print("Timer has finished")
lcd.message("Timer has finished")
print("Playing Buzzer")
lcd.message("Playing Buzzer")
play_buzzer()
# 1. Welcome Screen
welcome_screen()
while True:
# select the timer and set it to a variable
set_timer = get_time()
print(set_timer) #this should print the stopwatch_time_sec
# select the brew type and start the timer
select_func()
# continue
lcd.message("Would you like to continue?")
time.sleep(3)
lcd.mesasge("Press increment to continue.")
time.sleep(3)
lcd.message("Press reset to stop.")
time.sleep(3)
if increment_button.ispressed():
heat_led.off()
mash_led.off()
boil_led.off()
stopwatch_time = 0
continue
elif reset_button.ispressed():
heat_led.off()
mash_led.off()
boil_led.off()
break