Skip to content

An Arduino library for the AS5047P high-resolution rotary position sensor. Supporting also the following sensor types: AS5047D, AS5147, AS5147P, AS5247

License

Notifications You must be signed in to change notification settings

teamspatzenhirn/AS5047P

 
 

Repository files navigation

AS5047P - Arduino Library

GitHub Workflow Status (branch) GitHub Workflow Status (branch) GitHub release (latest by date) GitHub GitHub issues GitHub pull requests Maintenance

tl;dr

An Arduino library for the AS5047P high-resolution rotary position sensor. Supporting also the following sensor types: AS5047D, AS5147, AS5147P, AS5247

Contents

Supported Sensors

The following sensors of the AS5x47 series of rotary potion sensors are supported by this library:

You can get the AS5047P sensor preinstalled on a breakout board here.

Not supported are the following sensors:

Documentation

Documentation Deployment Status: GitHub deployments

Branch Link
Master Documentation
Develop Documentation

How to install this library

Install the library via the Arduino Library Manager

The easiest way to install this library is to use the build in Arduino Library Manager. Just search for AS5047P an install the latest version available. You can also upgrade the library to the newest release via the Arduino Library Manager. For detailed infomation please read the section Using the Library Manager of this tutorial. (Pleas keep in mind you need at least version 1.6.2 of the Arduino IDE in order to use the Arduino Library Manager)

Manually install a Arduino library

You can download the latest version of this library here as a zip file and follow the section Importing a .zip Library or Manual installation of this tutorial about How to Install a Library.

Install the library via the PlattformIO Library Manager

You can find this library here in the PlattformIO Library Manager. To add this library to your plattformIO project you can either use the library manager ui and search for this library or you can use the following platform io cli command: pio lib install "jonas-merkle/AS5047P"

How to connect the AS5047P to your Arduino

Connect to an Arduino Uno

AS5047P Pin Arduino Uno Pin Comment
GND GND -
VDD 5V -
VDD3V NC -
MOSI MOSI (Pin: 11) -
MISO MISO (Pin: 12) -
CLK SCK (Pin: 13) -
CSn 9 Can be any unused digital pin on the arduino as long as it's configured here AS5047P as5047p(<ChipSelectPort>);

Connect to an Arduino Mega

AS5047P Pin Arduino Mega Pin Comment
GND GND -
VDD 5V -
VDD3V NC -
MOSI MOSI (Pin: 51) -
MISO MISO (Pin: 50) -
CLK SCK (Pin: 52) -
CSn 9 Can be any unused digital pin on the arduino as long as it's configured here AS5047P as5047p(<ChipSelectPort>);

Connect to an Adafruit Feather M0

AS5047P Pin Adafruit Feather M0 Pin Comment
GND GND -
VDD 3V -
VDD3V 3V -
MOSI MOSI -
MISO MISO -
CLK SCK -
CSn 9 Can be any unused digital pin on the arduino as long as it's configured here AS5047P as5047p(<ChipSelectPort>);

Please note that the sensor can no longer be operated with 5V, but must be operated with 3.3V, otherwise there is a risk of damaging the Adafruit Feather M0 board!

Connect to Teensy Board

Connect to a Teensy 3.5

AS5047P Pin Teensy Pin Comment
GND GND -
VDD 3V -
VDD3V 3V -
MOSI MOSI0 (Pin: 11) -
MISO MISO0 (Pin: 12) -
CLK SCK0 (Pin: 13) -
CSn CS0 (Pin: 10) Can be any unused digital pin on the teenys as long as it's configured here AS5047P as5047p(<ChipSelectPort>);

Please note that the sensor can no longer be operated with 5V, but must be operated with 3.3V, otherwise there is a risk of damaging the Teensy board!

Connect to a Teensy 3.6

AS5047P Pin Teensy Pin Comment
GND GND -
VDD 3V -
VDD3V 3V -
MOSI MOSI0 (Pin: 11) -
MISO MISO0 (Pin: 12) -
CLK SCK0 (Pin: 13) -
CSn CS0 (Pin: 10) Can be any unused digital pin on the teenys as long as it's configured here AS5047P as5047p(<ChipSelectPort>);

Please note that the sensor can no longer be operated with 5V, but must be operated with 3.3V, otherwise there is a risk of damaging the Teensy board!

Connect to a Teensy 4.0

AS5047P Pin Teensy Pin Comment
GND GND -
VDD 3V -
VDD3V 3V -
MOSI MOSI (Pin: 11) -
MISO MISO (Pin: 12) -
CLK SCK (Pin: 13) -
CSn CS (Pin: 10) Can be any unused digital pin on the teenys as long as it's configured here AS5047P as5047p(<ChipSelectPort>);

Please note that the sensor can no longer be operated with 5V, but must be operated with 3.3V, otherwise there is a risk of damaging the Teensy board!

Connect to a Teensy 4.1

AS5047P Pin Teensy Pin Comment
GND GND -
VDD 3V -
VDD3V 3V -
MOSI MOSI (Pin: 11) -
MISO MISO (Pin: 12) -
CLK SCK (Pin: 13) -
CSn CS (Pin: 10) Can be any unused digital pin on the teenys as long as it's configured here AS5047P as5047p(<ChipSelectPort>);

Please note that the sensor can no longer be operated with 5V, but must be operated with 3.3V, otherwise there is a risk of damaging the Teensy board!

Project Status & ToDo's

Status Task / ToDo
Read functions for all registers implemented.
Doxygen comments added.
BasicReadAngle.ino successfully tested on an Arduino Mega & Adafruit Feather M0
BasicReadAngleAndDebugInfo.ino successfully tested on an Arduino Mega & Adafruit Feather M0
PrintAllSettings.ino successfully tested on an Arduino Mega & Adafruit Feather M0
Adding a CI pipline.
Build & deploy doxygen documentation for the library.
Sensor status output as string.
keywords.txt updated for main library functions.
Switch to unions...
Write functions for all registers implemented.
Parity check on incoming data.
Improve initSPI()
ToString() for Error_t
Adding Library to Arduino Library Manager 🥳
Adding Library to PlattformIO Library Manager 🥳
Documentation update.
keywords.txt updated for all library functions.
🚧 Readme.md update.
🚧 Test of all wirte functions
🚧 Test of all read functions
Porting the library to be compatible with the STM32 HAL
Additional examples.
Unit Tests?!
Implementation & test of programming the one time programmable register of the AS5047P.

About

An Arduino library for the AS5047P high-resolution rotary position sensor. Supporting also the following sensor types: AS5047D, AS5147, AS5147P, AS5247

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 98.3%
  • C 1.7%