Skip to main content

Flight Controller Board Orientation

Every flight controller has an arrow printed on it, and the firmware assumes that arrow points at the nose. Mount the board any other way and every gyro and accelerometer reading arrives rotated — the aircraft believes it is tilting left when it is tilting forward, and no amount of tuning fixes that.

Airframes do not always cooperate. A stack that has to go in sideways to clear a battery strap, or upside down under a top plate, is a normal situation. The fix is to tell the firmware how the board actually sits.

Get this right before the first flight

Board orientation rotates the readings that the entire attitude estimate is built on. A wrong value does not produce a small error — it produces an aircraft that corrects in the wrong axis and flips on takeoff. Check it on the bench: tilt the aircraft nose-down and confirm the horizon in your ground station pitches the same way.

Board orientation is not compass orientation

These get confused constantly, and the consequences are very different.

Board orientationCompass orientation
Describeshow the flight controller is mountedhow an external magnetometer is mounted
Affectsgyro and accelerometer — the whole attitude estimateheading only
Symptom when wrongflips on takeoff, corrects in the wrong axisheading off by a constant angle, circling in position hold
ArduPilot parameterAHRS_ORIENTATIONCOMPASS_ORIENT
PX4 settingAutopilot OrientationMag Orientation

If the compass inside a GPS module is what you are trying to set, you want External Compass Orientation instead.

ArduPilot

The parameter is AHRS_ORIENTATION.

  1. Connect the flight controller in Mission Planner.
  2. Open the Full Parameter List and find AHRS_ORIENTATION.
  3. Set the value that matches how the board is mounted.
  4. Click Write Params.
  5. Power-cycle the flight controller and reconnect.

Setting AHRS_ORIENTATION in the Mission Planner full parameter list

The value is chosen from a list of named rotations. The common ones:

ValueNameBoard is…
0Nonemounted normally, arrow to the nose
2Yaw90rotated 90° clockwise
4Yaw180rotated 180°, arrow to the tail
6Yaw270rotated 270° clockwise
8Roll180upside down, arrow still to the nose
12Pitch180upside down, arrow to the tail

The full list also covers 45° steps (Yaw45, Yaw135 and so on) and combinations of roll, pitch and yaw. If none of them fit, ArduPilot provides two general custom rotations, set through CUST_ROT1_ROLL/PIT/YAW and CUST_ROT2_ROLL/PIT/YAW.

It takes effect at the next boot — and you must re-level

The change applies on reboot, not immediately. Afterwards, re-level the vehicle (Accel Calibration → Calibrate Level): the old level reference was measured in the old orientation and is now wrong.

PX4

  1. Connect the flight controller in QGroundControl.
  2. Open Vehicle Setup → Sensors.
  3. Click Orientations at the bottom of the sensor list.
  4. Set Autopilot Orientation to match how the board is mounted, and click Ok.

Setting Autopilot Orientation in QGroundControl's Sensors page

ROTATION_NONE means the board's arrow points in the direction of flight.

Autopilot Orientation and Mag Orientation are different settings

The same dialog can show Mag Orientation, which is for an external compass. They are unrelated: one rotates the IMU, the other rotates the magnetometer. Mag Orientation only appears when an external compass is connected, which is why the dialog looks different depending on what is plugged in.

INAV

INAV has a dedicated page with a 3D model, which makes it the easiest of the four to get right.

  1. Connect in the INAV Configurator.
  2. Open the Alignment Tool page.
  3. Adjust the roll, pitch and yaw sliders — or type values — until the on-screen model matches how the board actually sits in your aircraft.
  4. Click Save and Reboot.

The INAV Configurator Alignment Tool

The settings behind the sliders are align_board_roll, align_board_pitch and align_board_yaw.

Betaflight

  1. Connect in the Betaflight Configurator.
  2. Open the Configuration page.
  3. Under Board and Sensor Alignment, enter Roll Degrees, Pitch Degrees and Yaw Degrees.
  4. Click Save and Reboot.

Board and Sensor Alignment on the Betaflight Configurator Configuration page

The setting names are the same as INAV's — align_board_roll, align_board_pitch, align_board_yaw — which leads directly to the next section.

Easily confused points

INAV and Betaflight use the same setting names with different units. In the INAV CLI, align_board_yaw is in deci-degrees: 90° is entered as 900. In the Betaflight CLI the same setting is in whole degrees: 90° is 90. The INAV Configurator's Alignment Tool displays degrees and converts for you, so the trap only bites in the CLI — or when copying a value out of a forum post written for the other firmware.

Board orientation is not compass orientation. Different hardware, different symptom, different parameter.

The arrow is the reference, not the USB port. Boards do not all put the connector on the same edge relative to the arrow.

Nothing happens until you reboot. All four firmwares apply this at the next boot.

Re-level after changing it. The accelerometer's level reference was taken in the old orientation.

"Upside down" needs a roll or pitch value, not a yaw one. Yaw alone cannot describe an inverted board — Roll180 and Pitch180 differ by which way the arrow ends up pointing.

Checking your work

Do this on the bench before you fly, with propellers off:

  1. Set the aircraft level and confirm the artificial horizon reads level.
  2. Pitch the nose down — the horizon should pitch down too, by about the same amount.
  3. Roll right — the horizon should roll right.
  4. Yaw the aircraft — the heading should follow, in the same direction.

If any axis moves the wrong way, or two axes are swapped, the orientation value is wrong. Fix it, reboot, re-level, and check again.


Written and maintained by the Robofusion engineering team.