

The AS5048A is a high-resolution magnetic rotary encoder designed to provide precise absolute position feedback. With a 14-bit resolution, it can measure angular positions with exceptional accuracy. The encoder communicates via SPI or PWM interfaces, making it versatile and easy to integrate into a wide range of systems. Its robust design and high precision make it ideal for applications in robotics, automation, motor control, and industrial machinery.








| Parameter | Value |
|---|---|
| Resolution | 14-bit (16,384 steps per revolution) |
| Interface | SPI or PWM |
| Supply Voltage | 3.3V to 5.5V |
| Operating Current | 12 mA (typical) |
| Maximum Speed | 30,000 RPM |
| Operating Temperature | -40°C to +150°C |
| Magnetic Field Strength | 30 mT to 70 mT |
| Package | TSSOP-14 |
The AS5048A comes in a 14-pin TSSOP package. Below is the pinout and description:
| Pin Number | Pin Name | Description |
|---|---|---|
| 1 | VDD | Positive supply voltage (3.3V to 5.5V) |
| 2 | VSS | Ground |
| 3 | CSn | Chip Select (active low) for SPI communication |
| 4 | CLK | SPI Clock input |
| 5 | MISO | SPI Master-In-Slave-Out (data output) |
| 6 | MOSI | SPI Master-Out-Slave-In (data input) |
| 7 | PWM | PWM output for position feedback |
| 8-14 | NC | Not connected |
CSn, CLK, MISO, and MOSI pins to the corresponding SPI pins on your microcontroller.CSn pin is pulled low to enable communication.PWM pin to a microcontroller's input pin capable of reading PWM signals.#include <SPI.h>
// Define SPI pins for AS5048A
const int CSn = 10; // Chip Select pin
void setup() {
// Initialize Serial Monitor
Serial.begin(9600);
// Initialize SPI
SPI.begin();
pinMode(CSn, OUTPUT);
digitalWrite(CSn, HIGH); // Set CSn high to disable communication
}
uint16_t readAS5048A() {
uint16_t angle = 0;
// Start SPI communication
digitalWrite(CSn, LOW);
// Send command to read angle (0xFFFF is the command for angle read)
uint16_t command = 0xFFFF;
uint16_t response = SPI.transfer16(command);
// End SPI communication
digitalWrite(CSn, HIGH);
// Extract angle data (14-bit resolution)
angle = response & 0x3FFF; // Mask to keep only 14 bits
return angle;
}
void loop() {
// Read angle from AS5048A
uint16_t angle = readAS5048A();
// Convert angle to degrees (0-360)
float angleDegrees = (angle * 360.0) / 16384.0;
// Print angle to Serial Monitor
Serial.print("Angle: ");
Serial.print(angleDegrees);
Serial.println(" degrees");
delay(100); // Delay for readability
}
SPI.transfer16() function sends a 16-bit command and receives a 16-bit response.CSn pin is correctly configured for your setup.No Output or Incorrect Readings:
Noise in Readings:
PWM Output Not Detected:
Q: Can the AS5048A measure incremental positions?
A: No, the AS5048A provides absolute position feedback. For incremental measurements, you would need to calculate the difference between successive readings.
Q: What type of magnet should I use?
A: Use a diametrically magnetized magnet with a diameter of 6-8 mm and a field strength of 30 mT to 70 mT.
Q: Can I use the AS5048A with a 5V microcontroller?
A: Yes, the AS5048A supports a supply voltage range of 3.3V to 5.5V, making it compatible with 5V systems.
Q: What is the maximum distance between the magnet and the encoder?
A: The recommended distance is between 0.5 mm and 3 mm for accurate readings.
By following this documentation, you can effectively integrate the AS5048A encoder into your projects and achieve precise position feedback.