Reefwing AHRS Arduino Library for Drones — Part 1

David Such
11 min readAug 8, 2023

The Reefwing AHRS library provides an Attitude and Heading Reference System (AHRS) class for use with Arduino compatible boards. The library has been tested with the Arduino Nano, Nano 33 BLE, Nano 33 BLE SENSE (REV 1 and REV 2), Nano 33 IoT, MKR Vidor 4000, Portenta H7 and the Seeed XIAO nRF52840 Sense boards.

An Attitude and Heading Reference System (AHRS) takes information from the Inertial Measurement Unit (IMU) and processes it to provide reliable roll, pitch and yaw angles (Figure 1). Our library can be downloaded using the Arduino IDE Library Manager, or directly from the Reefwing GitHub Repository.

Figure 1. Attitude and Heading Reference System (AHRS)

The initial version of this library was released in February 2022. It is now time for a substantial update!

We wrote about the sensor changes in the Nano 33 BLE revision 2 boards in an earlier article. Version 2 of the Nano 33 BLE Sense, replaces the LSM9DS1 9 axis IMU with a combination of two IMUs, the BMI270, a 6 axis gyro & accelerometer and the BMM150, a 3 axis magnetometer. In order to support the new hardware, it makes sense to separate the sensor processing from the sensor fusion algorithms.

--

--

David Such

Reefwing Software · Embedded Systems Engineer · iOS & AI Development · Robotics · Drones · Arduino · Raspberry Pi · Flight Control