# MadgwickAHRS: an Arduino library for orientation from accelerometer and gyroscope

> MadgwickAHRS is an Arduino library that wraps the official implementation of Sebastian Madgwick's AHRS algorithm, giving an Arduino sketch object orientation computed from accelerometer and gyroscope readings. It is a small wrapper under the GPL v3, and its released versions stopped in 2016 even though the repository is still being pushed to.

**arduino-libraries/MadgwickAHRS** — Arduino implementation of the MadgwickAHRS algorithm 

- Repository: https://github.com/arduino-libraries/MadgwickAHRS
- Stars: 586 · Forks: 215
- Language: C++
- License: not declared
- Published: 2026-10-22 · Updated: 2026-10-22 · Language: en
- Canonical page: https://hysenlabs.com/projects/arduino-libraries-madgwickahrs

## Orientation from two sensors, and nothing more

MadgwickAHRS is described as an Arduino implementation of the MadgwickAHRS algorithm, and the library wraps the official implementation of that algorithm to get orientation of an object based on accelerometer and gyroscope readings.

The scope is narrow in a way that matters. Orientation is attitude: how the object is tilted and rotated relative to a reference frame. It is not position, it is not velocity, and it is not a heading derived from a magnetometer. For a board that has to know which way it is pointing, a filtered orientation estimate from an inertial measurement unit is exactly the right primitive, and for anything that needs to know where the object is, this library is only one component of a larger estimator.

The algorithm itself is not the project's work. The README states that this is the implementation of Madgwick's IMU and AHRS algorithms and links to the upstream open source AHRS and IMU algorithms page at x-io.co.uk, and the copyright line names Sebastian Madgwick and Arduino LLC. So the repository is a port and a packaging of somebody else's published filter into the shape the Arduino ecosystem expects.

That framing is the most useful thing to know before reading further. The question is not whether the mathematics is sound, since the author of the algorithm is the author of the mathematics, but whether the port is faithful, how it is configured, and whether it still fits the current Arduino toolchain.

## A wrapper, and what that means for the code you write

Because the library wraps an upstream implementation, the code you write is a call into a filter rather than a filter you own. That has consequences in both directions.

In your favour, the library handles the parts of the algorithm that are easy to get subtly wrong: the quaternion integration, the feedback terms and the normalisation, all of which are the sort of arithmetic that looks simple and is not. Using a tested upstream implementation instead of writing your own is the right call for almost any project that is not itself about attitude filtering.

Against that, a wrapper is only as configurable as the wrapper exposes. The README here is short. It describes what the library computes, it points at the upstream algorithm, and it states the licence. It does not document tuning parameters such as the feedback gains that such a filter normally needs, it does not show a usage example, and it does not say which sensor coordinate convention the library expects. Those are the questions a reader has to take to the upstream documentation or to the example sketch in the repository.

The repository does contain an example, `examples/Visualize101/`, which is the place to look for how the filter is driven and how its output is used, and the `src/` directory holds the implementation. A reader who wants to know the exact call sequence should read the example rather than the README, because the README does not carry it.

## The Arduino library layout is the packaging

The repository is laid out as an Arduino library, and that is where most of its engineering effort sits. At the top level there is `library.properties`, the metadata file that carries the library name, version, author, licence and the list of architectures it supports, and it is what allows the Arduino IDE's library manager to find and install the library. There is `keywords.txt`, the file that teaches the IDE about the class, method and constant names the library exposes, so that syntax highlighting and the reference documentation in the editor work without a separate plugin. There is `src/` for the implementation, `examples/` for the sketches, and `extras/` for the additional assets that some libraries ship alongside.

That layout is why the project lives under the `arduino-libraries` organisation rather than in a personal account, and it is why the library can be installed from the IDE rather than by copying files.

The continuous integration reflects the same focus. There are three workflows, each with a badge at the top of the README: a check that the library status is valid for Arduino, a job that compiles the examples, and a spell check job. The compile-examples workflow is the one that matters most for a port like this, because it proves the source still builds against the current Arduino toolchain, which is exactly the failure mode a port that nobody has touched in a decade would have.

The spell check is a small thing that says something about how the project is run. A `.codespellrc` configuration in the repository root controls it, and the check runs as a workflow rather than as a note in the contributing guide.

## Licence terms and the upstream attribution

The licence is the GNU General Public License version 3, and the notice is specific about who holds the copyright: Sebastian Madgwick, Arduino LLC. The notice is the standard GPL v3 text, granting redistribution and modification with the copyleft obligation that the derived work carries the same licence, and the documentation points at the GNU licence site for the full terms.

The licence field in the repository metadata is left empty, so the LICENSE statement in the README is the authoritative text here rather than a badge. For an Arduino sketch that is usually not a problem, since sketches are generally not distributed as products, but for anyone embedding the filter in a commercial firmware the copyleft terms are a real consideration to settle early.

The attribution side of the licence is a separate matter from the terms. The algorithm belongs to Sebastian Madgwick, the upstream open source AHRS and IMU algorithms page is the reference, and the Arduino port carries that attribution forward. A project that wants to use the filter in a product with a permissive licence has to decide what to do about that, and the answer is not obvious from the code alone.

There is also a practical point about versions that the licence text does not cover. The two published releases are 1.0.0, tagged as the initial release on 2015-12-17, and 1.1, tagged with the note about increasing efficiency on 2016-03-22. The repository is not archived and the last push was on 2026-09-27, so the default branch has moved a long way past the last tag, and anyone who installs from the library manager may get a different amount of code from anyone who builds from the branch.

## Where the project stands and what a reader should ask

The honest summary is that this is a small, old, still-touched port of a well-known algorithm, and the two halves of that sentence matter differently.

The oldness is a fact: the newest release is from 2016, and the library has been in the Arduino ecosystem long enough to have been installed on a great many boards. For an algorithm that has been published and studied for years, a port that has not been touched does not automatically mean a port that is wrong, since the mathematics does not change. What changes is the toolchain around it, and that is what the compile-examples workflow exists to check.

The continued pushing is the other fact, and the repository is not archived, with the last push on 2026-09-27. Whether that push stream is bug fixes, toolchain updates or dependency housekeeping is not something the README says.

So the questions a reader has to take elsewhere are the ones the README does not answer. What tuning parameters does the wrapper expose, and what are their defaults? What sensor coordinate convention and sample rate does it expect? Does the current branch still behave the same as the 1.1 release for an existing sketch, or has the efficiency work changed the output? Those answers live in the upstream documentation, in `examples/Visualize101/`, and in the diff between the last tag and the default branch, rather than in the repository description.

For a project that needs a known-good orientation estimate today, the safe path is to install the published version, read the example sketch to learn the call sequence, and treat the default branch as a development surface rather than a dependency.

## Conclusion

MadgwickAHRS suits an Arduino builder who needs a stable orientation estimate from an IMU and would rather not implement an attitude filter, and who is happy to work inside the Arduino library layout. It does not suit someone who needs position or heading from magnetometer data, since the library describes its scope as orientation from accelerometer and gyroscope readings, and it does not suit a project that needs a packaged release, because the newest tagged version is 1.1 from 2016-03-22 while the last push was on 2026-09-27. Before adopting, read the upstream page linked from the README for the algorithm itself, and check which version you are actually installing, since the two published releases predate everything now on the default branch.

## FAQ

### What does the MadgwickAHRS Arduino library compute?

It wraps the official implementation of the MadgwickAHRS algorithm to get orientation of an object based on accelerometer and gyroscope readings. It is an attitude filter, so the result is orientation rather than position or a magnetometer heading.

### Who owns the algorithm in MadgwickAHRS?

The README states that this is the implementation of Madgwick's IMU and AHRS algorithms and links to the upstream open source AHRS and IMU algorithms page at x-io.co.uk. The copyright notice names Sebastian Madgwick and Arduino LLC.

### How is the MadgwickAHRS library installed and checked?

The repository is laid out as an Arduino library, with library.properties, keywords.txt, src/, examples/ and extras/, so the Arduino library manager can install it. Continuous integration runs an Arduino status check, a job that compiles the examples, and a spell check, with a .codespellrc configuration in the repository root.

### What licence is MadgwickAHRS under?

The GNU General Public License version 3, as stated in the README with the copyright line naming Sebastian Madgwick and Arduino LLC. The licence field in the repository metadata is left empty, so the README text is the authoritative statement.

### How recent is the MadgwickAHRS release?

The two published releases are 1.0.0 from 2015-12-17 and 1.1 from 2016-03-22, while the last push to the repository was on 2026-09-27. The repository is not archived, so the default branch has moved well past the last tag.

## Sources

- [arduino-libraries/MadgwickAHRS on GitHub](https://github.com/arduino-libraries/MadgwickAHRS)
- [Issues](https://github.com/arduino-libraries/MadgwickAHRS/issues)
- [README](https://github.com/arduino-libraries/MadgwickAHRS/blob/master/README.md)
- [Releases](https://github.com/arduino-libraries/MadgwickAHRS/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/arduino-libraries-madgwickahrs
