# Firmware loading

If you just got your DryBox v2 PCBA and have finished all the assembly steps, now it's the time to load the firmware onto your board.

DryBox v2 has an online firmware updater that is based on ESPHome Web utility.\
You can also use Espressif online flash loader, ESPTool or any other tools that you are comfortable with.

> **WARNING: Existing Device Configuration Will Be Wiped**
>
> Due to how firmware upgrade works, currently it will not preserve any custom configuration data (ie. WiFi settings, PID settings, device name etc).\
> After the firmware upgrade, default values will be applied.\
> If you made any changes to these values (ie PID), please make a 'back up' and enter them once the firmware upgrade is complete.

> **NOTE: ESPHome Web!**
>
> This web flasher is using the Web Serial API, powered by [ESPHome Web](https://esphome.github.io/esp-web-tools/).

## 1. Preparing the hardware

In order to update firmware on your DryBox v2 you will need to put the device in the bootloader mode first.\
To do this you will need to:

1. Disconnect the power plug from your DryBox.
1. Disconnect the heater plug! You don't want it to turn on during firmware upgrade!
1. Press and hold BOOT button on your DryBox v2
1. Connect USB-C cable to DryBox v2
1. Note that all the LEDs should be off.
1. At this point your PC should register new Serial COM port

## 2. Loading new firmware

There are multiple ways to compile and load new firmware for DryBox v2.\
In order to make this process more convenient, latest version of the firmware can be loaded through web flasher tool.

To access the web flasher, you will need Google Chrome (or any other web browser that supports Web Serial API).

1. Place DryBox v2 in bootloader mode (see step #1.)
1. In Chrome open [DryBox v2 Firmware loader page](https://docs.sasakaranovic.com/firmware/drybox/index.html)
1. Click on Connect button
1. From the drop down menu select the COM port that corresponds to your DryBox v2 and click Connect
1. Click on `Install DryBox v2` and then confirm by clicking on `Install` button
1. Erasing and then flashing will start. This may take a minute or two
1. After flashing is complete, you can disconnect DryBox v2 by removing USB-C cable
1. Power cycle the PCBA (by completely removing power)
1. Your DryBox v2 is now flashed with the latest firmware version

## Why no OTA??

Probably even before reaching this part of the guide, you have thought that OTA (Over-The-Air) firmware upgrade would be very convenient. And I agree.\
However OTA is a huge security risk and is intentionally disabled by default in favor of keeping the device more secure.

> **WARNING: More secure is not the same as not secure!**
>
> DryBox v2 does not use encryption or authentication!\
> This means this device should **never** be exposed to the internet or the non-trusted network!

______________________________________________________________________

Now that the latest firmware has been loaded onto your board, we have to run the [Firmware Safety Check](https://docs.sasakaranovic.com/drybox/safety-check/index.md).
