# 7. Power & Fault Handling

## Overview
Farms are harsh environments with unstable power. The ASF system is designed to handle brownouts and sudden power losses gracefully.

## Brownout & Power Loss Management
The system monitors the input voltage and takes immediate action if it drops below a safe threshold.

| Feature | Implementation |
| :--- | :--- |
| **Brownout Detect** | Set at 3.0 V |
| **ISR Action** | Set a "Power Loss" flag and immediately flush critical buffers to NVS/SD. |
| **Recovery** | Perform a clean reboot once power is stable. |

## Hardware Recommendations for Resilience
To further improve reliability in the field, the following hardware additions are recommended:

*   **Supercapacitor:** Provides 1–2 seconds of additional runtime after power loss, allowing for a graceful shutdown and data flush.
*   **External RTC Battery:** Ensures the system clock remains accurate even during extended power outages, which is critical for time-stamped logging.

By anticipating power issues, the system prevents data corruption and ensures a predictable recovery process.
