Hi,
I plan to add some advanced gyro/IMU based protections to my board .
This should work in similar way as Fliteboard protection - which detects board angle and acceleration to decide whether you are still on board ![]()
The plan is to either add it to Bremote V2 or make it independent small brick which you could install in any board.
But maybe this was already implemented somewhere ? ( I could not find )
For reference - some of AI hints for it:
IMU-Based Kill Algorithm for e-Foil (Summary)
Goal
Instantly stop the motor only during a real crash or wipeout, while allowing:
- prone (belly) starts
- standing up on foil
- aggressive carving and pumping
No leash, no magnetic lanyard.
The IMU acts as an independent safety judge.
1. Core Concept (How the algorithm thinks)
Do NOT kill based on board angle.
Angle alone is unreliable in foiling.
Instead, detect loss of controlled motion, characterized by:
- sudden, high rotational speed
- unstable gravity vector
- violent acceleration changes
- persistence over a short time window
A real crash looks like chaos, not a clean maneuver.
2. Signals Used from the IMU
Minimum required:
- Gyroscope (ωx, ωy, ωz) → angular velocity
- Accelerometer (ax, ay, az)
Derived values:
gyro_magnitude= overall rotational speedacc_norm= magnitude of acceleration vector (≈ 1 g when stable)jerk= rapid change in acceleration over time
3. State Machine (Very Important)
The system is state-based, not just threshold-based.
States
- IDLE / SAFE
Motor not armed or throttle = 0 - ARMING GRACE
Short grace period after throttle > 0
Allows prone start + standing up - RUN
Normal riding, crash detection active - KILLED (LATCHED)
Motor forcibly stopped until reset conditions are met
4. Grace Period (Critical for Prone Starts)
When throttle first becomes active:
- Ignore crash detection for ~1.5–3.0 seconds
- This prevents false kills while:
- lying on the board
- transitioning to standing
- stabilizing on foil
5. Crash Detection Logic (Key Part)
Event Indicators
Typical starting thresholds (to be tuned):
- E1 – High rotation
- Very fast angular motion
- E2 – Gravity instability
- Acceleration magnitude far from ~1 g
- (near free-fall or hard impact)
- E3 – High jerk
- Sudden acceleration change (violent motion)
Decision Rule
A crash is declared if:
At least 2 of the 3 events
persist for ~80–150 milliseconds
This filters out:
- carving (usually high rotation only)
- pumping (acceleration spikes without chaos)
- normal foil dynamics
6. Why This Works (Carving vs Crash)
Controlled Maneuvers
- Rotation is smooth and mostly on one axis
- Gravity vector remains stable
- Acceleration changes are gradual
- Events do not persist together
Real Crash
- Rotation on multiple axes
- Gravity vector collapses or spikes
- Sharp acceleration changes
- Chaotic signal persists briefly
The algorithm detects loss of control, not movement itself.
7. Kill Action and Latching
When a crash is detected:
- Immediately assert KILL output to the motor controller
- Ignore throttle commands completely
- Stay latched in KILL state
Reset Conditions
Motor can only re-arm when:
- Throttle = 0
- Board motion is stable
- Acceleration ≈ 1 g
- Rotation is low
- Stability persists for ~1–2 seconds
This prevents accidental re-engagement.
8. Recommended Hardware Architecture
Best practice:
IMU + small MCU → Motor Controller KILL input
- IMU runs independently of the remote
- Does not interfere with normal throttle control
- Overrides everything only during a crash
- Safe for ESC (no battery power cuts)
9. IMU Selection Guidance (Summary)
Best characteristics:
- Low gyro noise
- Good vibration tolerance
- High sample rate (≥200 Hz)
- Raw gyro + accelerometer access
Preferred types:
- Modern InvenSense or Bosch IMUs
- Avoid relying on absolute angle estimation
- Raw dynamics matter more than orientation
10. What This Achieves
- Works with prone starts
- No leash or magnet required
- No false kills during carving
- Immediate shutdown during wipeouts
- Behavior comparable to commercial e-foils (Flite-style)