> For the complete documentation index, see [llms.txt](https://docs.whale.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.whale.org/payload-release-engineering/software.md). Agents can also search and read this documentation through its [MCP server](https://docs.whale.org/~gitbook/mcp).

# Software

The release system uses two primary Python programs. `code.py` is the drone-side CircuitPython program that runs directly on the Feather RP2040 and controls the load cell, servos, SD-card logging, and radio communication. CircuitPython automatically runs `code.py` when the Feather powers on.

`ControllerSide.py` is the ground-side program used on the connected computer/controller to communicate with the release system over the 915 MHz radio link.

The `lib/` directory contains the CircuitPython libraries required by **`code.py`**. The contents of this folder must be copied into the `lib/` directory on the Feather's `CIRCUITPY` drive.

Find the software files [here](https://github.com/chriszadra/UAS-Entanglement-Response/tree/310c47f7eb234ff915c175e4ab05244600c13d34/Release%20Mechanism/Software).&#x20;

## Installation&#x20;

1. Connect the Feather RP2040 LoRa to the computer over USB.
2. Put the Feather into bootloader mode. Hold the BOOT/BOOTSEL button, press and release RESET, then release BOOT/BOOTSEL. A drive named `RPI-RP2` should appear.
3. Copy the provided CircuitPython `.uf2` file from the GitHub repository onto the `RPI-RP2` drive.
4. The Feather will automatically restart. The `RPI-RP2` drive will disappear and a new drive named `CIRCUITPY` will appear.
5. Copy `code.py` from the GitHub repository to the root of the **`CIRCUITPY`** drive.
6. Copy the provided `lib/` folder into the root of the `CIRCUITPY` drive.
7. Power-cycle or reset the Feather. CircuitPython automatically runs `code.py` whenever the board starts.

## Calibration & Serial Monitoring&#x20;

1. Clone the GitHub repo to you directory of choice.&#x20;
2. On a laptop, create the local Python virtual environment if it does not already exist, then activate.&#x20;

```
python -m venv my_env
my_env\Scripts\activate
```

3. Install required packages into the enviorment.

```
pip install -r requirements.txt
```

4. Connect the Feather to the laptop over USB and open a serial monitor.&#x20;
5. Apply known loads of 5 lb, 10 lb, and 15 lb and monitor the reported force through the serial output.
6. Adjust the calibration constants in `code.py`, save the file back to the `CIRCUITPY` drive, and repeat the test until the measured values agree with the known loads.
