diff --git a/config.py b/config.py index e49e716..53bd1e6 100644 --- a/config.py +++ b/config.py @@ -30,6 +30,14 @@ currency_type = "$" # Currency Symbol to show when calculating cost to run j ### Outputs gpio_heat = 23 # Switches zero-cross solid-state-relay +gpio_e_relay = 27 # pin 13; emergency cutoff relay + +# Note: `gpio_e_relay` is used to and a redundant mechanical relay in series with +# the SSR. Because SSRs normally fail closed (i.e. energized), this provides a +# way for the controller to shut off the kiln in the event that the SSR fails. +# It is designed to be used with the SSR input connected to the safety relay's +# Normally Open (NC) output; thus, the kiln can only heat when the RPi has +# energized the safety relay. ### Thermocouple Adapter selection: # max31855 - bitbang SPI interface diff --git a/lib/oven.py b/lib/oven.py index 0bc7d59..5754620 100644 --- a/lib/oven.py +++ b/lib/oven.py @@ -20,6 +20,7 @@ class Output(object): GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(config.gpio_heat, GPIO.OUT) + GPIO.setup(config.gpio_e_relay, GPIO.OUT) self.active = True self.GPIO = GPIO except: @@ -27,6 +28,14 @@ class Output(object): log.warning(msg) self.active = False + def safety_off(self): + '''Energizes the safety relay''' + self.GPIO.output(config.gpio_e_relay, self.GPIO.HIGH) + + def safety_on(self): + '''Deenergizes the safety relay''' + self.GPIO.output(config.gpio_e_relay, self.GPIO.LOW) + def heat(self,sleepfor): self.GPIO.output(config.gpio_heat, self.GPIO.HIGH) time.sleep(sleepfor) @@ -390,12 +399,14 @@ class RealOven(Oven): # call parent init Oven.__init__(self) + self.output.safety_off() # start thread self.start() def reset(self): super().reset() + self.output.safety_on() self.output.cool(0) def heat_then_cool(self):