Magnetic Rotary Encoder

About the project

I've made a custom Magnetic Rotary Encoder using an AS5048A

Project info

Difficulty: Moderate

Platforms: ArduinoEspressif

Estimated time: 2 hours

License: GNU General Public License, version 3 or later (GPL3+)

Items used in this project

Hardware components

AS5048 Breakout Board AS5048 Breakout Board There are a few of these around. This one was a gift from a friend who had made a bunch. x 1

Story

I was using a mechanical rotary encoder for a project (the controller for my Asteroids game). The resolution on this wasn't really good enough - only 20 steps - 18-degree increments. So, I've built a custom high-resolution rotary encoder using an AS5048A sensor.

Details

I've been using a mechanical rotary encoder for my Asteroids game controller. The resolution it provides is pretty low. It's only got 20 steps which translates to 18 degrees per step.

In this project, I've created a high resolution magnetic rotary encoder using an AS5048A. To make this I cannibalised the mechanical rotary encoder and 3D printed a holder to hold everything together.

It works really well - I think it's sub 0.5 degrees accuracy and could be even better with a bit of averaging applied to the samples.

Code

Sample Source Code

Sample source code that shows the current angle on a HelTec OLED display.

Credits

Leave your feedback...