lamaPLC: AS5600 Magnetic Induction Angle Measurement Sensor Module

AS5600

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.

AS5600

Key Features

  • Resolution: 12-bit digital output, providing 4,096 positions per full 360° rotation (approximately 0.087° per step).
  • Multiple Output Modes: Supports I²C digital interface, PWM, and ratiometric Analog voltage output.
  • Programmable Range: While the default is 0° to 360°, users can program a custom maximum angle from 18° to 360° to apply full resolution to a smaller range.
  • Direction Control: A dedicated DIR pin allows you to set whether the output value increases with clockwise or counterclockwise rotation.
  • Low Power: Features smart low-power modes that automatically reduce consumption, making it suitable for battery-powered devices.

Technical Specifications

  • Operating Voltage: 3.3V to 5V
  • Interface: I²C (fixed address 0x36)
  • Temperature Range: -40°C to +125°C
  • Magnet Distance: Best performance within 0.5 mm to 3 mm air gap

AS-5600

AS5600 Pinout

Pin NameFunctionDescription
VCCPower SupplyConnect to 3.3V or 5V.
GNDGroundConnect to establish common ground with your circuit.
SCLI²C ClockSerial clock line used for digital communication (0x36 fixed) address).
SDAI²C DataSerial data line for angle readings and configuration.
DIRDirectionGND clockwise increases value; VCC = Counter-clockwise increases.
OUTOutputCan provide an analog voltage or PWM signal proportional to the angle.
PGOProgram OptionUsed for programming the sensor's non-volatile memory (OTP), which is usually left disconnected for standard applications' use.

Critical Usage Notes

  • Operating Voltage: When powering with 5V, make sure the module's onboard voltage regulator (if available) is used properly. For the raw chip, Pin 1 (VDD5V) and Pin 2 (VDD3V3) have specific wiring needs for 3.3V versus 5V operation.
  • Pull-up Resistors: The I²C lines (SDA/SCL) need pull-up resistors (typically 4.7kΩ) to VCC if they are not already present on your specific module.
  • DIR Pin Stability: It is strongly advised not to leave the DIR pin floating. Connect it to GND or VCC to avoid erratic position readings.
  • PGO Pin: Some modules include a resistor between PGO and GND that may disable the OUT pin. If the analog/PWM output isn't working, check this connection.

AS5600 Wiring

AS5600 Wiring

AS5600 Arduino Wiring (I²C Mode)

AS5600 PinArduino Pin (Uno/Nano)Arduino Pin (Mega)
VCC5V (or 3.3V)5V (or 3.3V)
GNDGNDGND
SDAA4Pin 20
SCLA5Pin 21
DIRGND (for clockwise)GND (for clockwise)

AS5600 Arduino example code

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

  • as5600.readAngle(): Returns the current 12-bit filtered angle.
  • as5600.getMagnetStatus(): Returns a status byte (0x20 = Magnet detected; 0x10 = Too weak; 0x08 = Too strong).
  • as5600.setDirection(): Allows you to flip the rotation direction in software if the DIR pin is left floating or controlled by an I/O pin.

Troubleshooting

  • Magnet Detection: If the serial monitor displays constant values, verify the magnet distance (0.5-3mm).
  • Address: The I²C address is fixed at 0x36 and cannot be modified.
  • Pull-up Resistors: Make sure your module has pull-up resistors on SDA/SCL, or add 4.7kΩ resistors to VCC if the I²C scan fails.

I²C topics on lamaPLC

PageDateTags
2025/05/31 21:56, , , , , , ,
2025/09/23 19:25, , , , , ,
2026/03/21 19:20, , , , , , ,
2026/02/15 20:33, , , , , , , , ,
2026/02/14 22:24, , , , , , , , , , , , ,
2026/03/28 22:07, , , , , , ,
2026/02/15 20:40, , , , , , , , , , , , , ,
2026/02/14 23:37, , , , , , , , , , ,
2026/02/14 22:40, , , , , , , , , ,
2026/03/21 22:25, , , , , , , , , , ,
2026/02/14 18:19, , , , , , , , , , ,
2026/02/14 18:11, , , , , , , ,
2025/05/31 21:32, , , , , , , ,
2026/02/14 19:29, , , , , , , , , , , , , ,
2025/11/21 23:07, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
2023/07/01 15:29, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
2026/03/22 00:26, , , , , , , , ,
2026/02/14 22:45, , , , , , , , ,
2026/02/14 22:09, , , , , , , , , , , , , , , ,
2026/02/14 17:26, , , ,
2026/02/14 21:54, , , , , , , , , , , , , , , , , , , , , , , , ,
2026/03/28 18:02, , , , , , , , , , , , , , , ,
2026/02/14 23:58, , , , , , , , , , ,
2026/02/14 17:27, , , , , , , , , ,
2026/02/14 23:38, , , , , , ,
2026/02/14 22:52, , , , , , , ,
2026/02/14 22:23, , , , , , , ,
2026/02/14 22:53, , , , , , , , , , , , ,
2026/02/15 20:27, , , , , , , , , , , , , , , ,
2026/02/15 20:29, , , , , , , , , , , , , ,
2026/02/14 22:47, , , ,
2026/02/14 22:51, , , , , ,
2026/02/14 17:26, , , ,
2026/02/14 22:22, , , , , , , , , , , , ,
2026/02/14 22:21, , , , , , , , , , ,
2026/02/14 22:22, , , , , , , ,
2026/03/05 20:19, , , , , , , , , , , , , , , , ,
2026/02/14 17:27, , , , , , ,




This page has been accessed for: Today: 3, Until now: 10