AS5047P
AS5047P copied to clipboard
An Arduino library for the AS5047P high-resolution rotary position sensor. Supporting also the following sensor types: AS5047D, AS5147, AS5147P, AS5247
AS5047P - Arduino Library
tl;dr
An Arduino library for the AS5047P high-resolution rotary position sensor. Supporting also the following sensor types: AS5047D, AS5147, AS5147P, AS5247
Contents
-
AS5047P - Arduino Library
- tl;dr
- Contents
- Supported Sensors
- Documentation
-
How to install this library
- Install the library via the Arduino Library Manager
- Manually install a Arduino library
- Install the library via the PlattformIO Library Manager
-
How to connect the AS5047P to your Arduino
- Connect to an Arduino Uno
- Connect to an Arduino Mega
- Connect to an Adafruit Feather M0
-
Connect to Teensy Board
- Connect to a Teensy 3.5
- Connect to a Teensy 3.6
- Connect to a Teensy 4.0
- Connect to a Teensy 4.1
- Project Status & ToDo's
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:
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 information 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 teensy 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 teensy 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 teensy 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 teensy 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. |