The AS5600 is a straightforward magnetic rotary position sensor featuring a high-resolution 12-bit analog or PWM output. It measures the absolute angle of a diametrically magnetized on-axis magnet without contact. Designed for contactless potentiometer applications, its durable build prevents interference from external homogeneous magnetic fields.
The industry-standard I²C interface allows easy programming of non-volatile parameters without a dedicated programmer. By default, the output covers 0 to 360 degrees, but a smaller output range can be set by programming a start (zero) and stop (maximum) angle.
Additionally, the AS5600 includes a smart low-power mode to automatically lower power consumption. An input pin (DIR) determines the output polarity based on rotation direction: connecting DIR to ground causes the output to increase clockwise, while connecting it to VDD causes it to increase counterclockwise.
Key Features
| Pin Name | Function | Description |
|---|---|---|
| VCC | Power Supply | Connect to 3.3V or 5V. |
| GND | Ground | Connect to establish common ground with your circuit. |
| SCL | I²C Clock | Serial clock line used for digital communication (0x36 fixed) address). |
| SDA | I²C Data | Serial data line for angle readings and configuration. |
| DIR | Direction | GND clockwise increases value; VCC = Counter-clockwise increases. |
| OUT | Output | Can provide an analog voltage or PWM signal proportional to the angle. |
| PGO | Program Option | Used for programming the sensor's non-volatile memory (OTP), which is usually left disconnected for standard applications' use. |
Critical Usage Notes
| AS5600 Pin | Arduino Pin (Uno/Nano) | Arduino Pin (Mega) |
|---|---|---|
| VCC | 5V (or 3.3V) | 5V (or 3.3V) |
| GND | GND | GND |
| SDA | A4 | Pin 20 |
| SCL | A5 | Pin 21 |
| DIR | GND (for clockwise) | GND (for clockwise) |
To read angle data from the AS5600 using an Arduino, the most reliable approach is to use the I²C interface. You can use a library like the Adafruit AS5600 Library or the Rob Tillaart AS5600 Library for simplified functions.
This code initializes the sensor and prints the angle in both raw units (0–4095) and degrees (0–360°) to the Serial Monitor.
#include "AS5600.h" #include "Wire.h" AS5600 as5600; void setup() { Serial.begin(115200); Wire.begin(); if (!as5600.begin()) { Serial.println("Error: AS5600 not detected. Check wiring!"); while (1); } // Set clockwise as the increasing direction as5600.setDirection(AS5600_CLOCK_WISE); Serial.println("AS5600 Initialized."); } void loop() { // Read raw 12-bit value (0-4095) uint16_t rawAngle = as5600.readAngle(); // Convert to degrees (360.0 / 4096.0) float degrees = rawAngle * (360.0 / 4096.0); Serial.print("Raw: "); Serial.print(rawAngle); Serial.print(" | Angle: "); Serial.print(degrees, 2); Serial.println("°"); delay(100); // Read every 100ms }
Key Functions
Troubleshooting
This page has been accessed for: Today: 3, Until now: 4