# Firmware Safety Check

DryBox v2 comes with certain built-in firmware safety features but the one responsible for preventing heater thermal runaway is probably the most important one.

> **DANGER: Fire hazard!**
>
> Please note that heated dry box is a fire hazard and you should **never** leave your dry box unattended!\
> Same way it's never a good idea to turn on the oven and leave the house, you should also never leave the dry box on when you are not around!\
> This is a DIY kit for a filament dry box that has the ability to potentially melt or cause fire.\
> You are responsible for using the filament dryer safely.\
> If you ever notice damage, overheating or smoke coming from your dry box, disconnect power immediately!

## Panic mode

![Panic mode](https://docs.sasakaranovic.com/drybox/images/placeholder.png)

*Figure: Panic Mode LED pattern*

Once the firmware detects an 'undesired' state of the dry box, it will enter a `panic mode`.\
In this mode the LED on the DryBox v2 PCBA board will start to blink rapidly (`~5x a second`), the heater will turn off and the dry box will become completely unresponsive (UI and WebAPI will stop working).

This is by design for two reason;

- DryBox should never enter this mode under normal operation
- We want to make sure we 'catch' this event by making sure it can't go away on its own (other than losing power)

In order to get out of the `panic mode` the end user has to power-cycle or reset the DryBox v2.

> **NOTE: PID tuning**
>
> The DryBox v2 firmware has a couple of other undesired states that once detected completely disable the dry box.\
> If you are tuning your PID parameters or modifying settings, you can reset the board and re-tune these parameters.\
> The safety features are active only if the heater is turned on.

## Check the heater safety feature

In order to check the firmware safety feature of the dry box, we can simulate two scenarios

Both tests must end in panic mode. If either does not, see "If a safety check fails below".

### 1. Temperature probe completely disconnected

Power on the dry box by setting the target inside temperature slightly above the current reading (ie if internal temperature is `28C`, you can set the target to `35C`).\
Then set the maximum heater temperature to `45C`.\
Finally click on Turn On button.

The dry box should now be on.

Wait a couple of seconds and confirm that the heater temperature reading is steadily increasing up to the target temperature (`45C`).

![Probe disconnected](https://docs.sasakaranovic.com/drybox/images/drybox-safety-disconnect-ntc.png)

*Figure: Heater probe disconnected*

Now disconnect the heater temperature probe terminal plug from the DryBox v2 PCBA.\
Within a couple of second dry box should enter `panic mode`.

![Probe disconnected](https://docs.sasakaranovic.com/drybox/images/drybox-ui-safety-unreachable-neg-temp.png)

*Figure: UI when probe disconnected*

> **NOTE: Negative temperature value reading**
>
> If the UI refreshed just before the DryBox entered the `panic mode`, the heater temperature reading in the UI should be a very large negative value (ie `-273C`). This is expected value when the probe is disconnected.

### 2. Temperature probe not attached to heater

Power on the dry box by setting the target inside temperature slightly above the current reading (ie if internal temperature is `28C`, you can set the target to `35C`).\
Then set the maximum heater temperature to `45C`.\
Finally click on Turn On button.

The dry box should now be on.

![Probe detached](https://docs.sasakaranovic.com/drybox/images/drybox-safety-ntc-not-attached.png)

*Figure: Heater Probe Detached*

Without disconnecting the terminal plug, separate the heater sensor from the heater so that it is no longer in contact with the heater and can not measure heater temperature.\
In the UI heater temperature reading should start to go down closer towards the ambient temperature while the heater power should stay at `100%`.

![Probe detached](https://docs.sasakaranovic.com/drybox/images/drybox-ui-safety-heater-detached.png)

*Figure: UI When Heater Probe Detached*

After a minute dry box should detect that heater temperature is not increasing while heater power being constantly at `100%` and it should enter a `panic mode`.

## If a safety check fails

> **DANGER: Do not use the dry box if either test fails**
>
> If the dry box does **not** enter `panic mode` within the times above:
>
> 1. Disconnect the 12V power immediately.
> 1. Do not use the dry box for drying.
> 1. Check that the heater sensor is the 100K 3950 NTC and is seated in the 2-pin terminal.
> 1. Re-flash the latest firmware (see [Firmware loading](https://docs.sasakaranovic.com/drybox/firmware-update/index.md)) and repeat both tests.
> 1. If it still fails, your setup might have a hardware and/or setup issue that needs to be resolved.

______________________________________________________________________

Now that you have verified firmware safety features are working as expected, it's time to get familiar with the [WebUI](https://docs.sasakaranovic.com/drybox/web-ui/index.md).
