How to Set Up a Geofence
I. Principles
Geofence is a virtual flight boundary defined by flight controller software. Once the aircraft exceeds the set distance or altitude range, the flight controller automatically executes protective actions (such as Auto Return to Home (RTL), Guided mode, etc.) to prevent the aircraft from being lost or causing danger.
The main types of geofences include:
Maximum Altitude Limit: Limits flight altitude;
Circular Fence: Limits the maximum flight radius with the takeoff point as the center;
Polygon Fence: Defines more complex boundaries;
Minimum Altitude Fence: Prevents the aircraft from flying too low.
The flight controller calculates the aircraft's position in real-time via GPS and monitors whether it triggers the set geofence boundaries, thereby improving flight safety.
II. Equipment Preparation
1) Flight Controller: Any of the SpeedyBee F405 WING APP / SpeedyBee F405 WING MINI / CoreWing F405 WING V2 flight controllers are applicable to this tutorial.
2) GPS Module (Required)
3) Ground Control Station: Mission Planner.
III. Specific Operations
1. Basic Parameter Settings (Taking Circular Fence as an Example)
- Connect the flight controller to the computer using a data cable, open the Mission Planner ground station, go to the Config/Debug page, enter All Parameter Tables, and modify the following parameters:
| Parameter Name | Recommended Value | Description |
|---|---|---|
| FENCE_ENABLE | 1 | 1-Enable geofence, 0-Disable |
| FENCE_TYPE | 2 | Fence type (1-Altitude, 2-Circular, 3-Polygon, 4-Minimum Altitude) |
| FENCE_ALT_MAX | 100 | Set maximum flight altitude, unit: meters |
| FENCE_RADIUS | 300 | Set maximum flight radius, unit: meters |
| FENCE_ACTION | 1 | Protective action triggered when fence is breached (0-No action, 1-Auto Return to Home, recommended to use 1) |

2. Explanation of Settings for Different Geofence Types
Type 1: Altitude Fence (Maximum Altitude Limit)
Set
FENCE_TYPE = 1, and setFENCE_ALT_MAX.After the aircraft exceeds this altitude, the protective action will be triggered automatically.
Example:
FENCE_ALT_MAX = 120(Unit: meters), meaning the aircraft automatically triggers the protective action after exceeding 120 meters.
Type 2: Circular Fence (Recommended)
Set
FENCE_TYPE = 2, and simultaneously set:If the aircraft exceeds the set radius or altitude, the protective action is triggered.
Example:
Radius: 500 meters (
FENCE_RADIUS=500)Maximum Altitude: 120 meters (
FENCE_ALT_MAX=120)
Type 3: Polygon Fence Settings (Advanced)
Enter Mission Planner → "PLAN" interface.
Right-click on the map, select
Draw Polygon, and manually draw the polygon fence area.After the polygon is drawn, right-click and select
GeoFence→Uploadto upload the fence to the flight controller.On the parameter page, confirm that
FENCE_TYPE = 3is enabled to activate the polygon fence function.
3. Verifying Geofence Functionality
Conduct a test flight in an open and safe area.
After takeoff, slowly approach the fence boundary to ensure that the flight controller automatically executes the set protective action (such as returning home) after exceeding the radius or altitude.
If triggered successfully, it indicates that the geofence settings are correct.
IV. Q&A
Technical Support QR Code
