Grove - 12-bit Magnetic Rotary Position Sensor / Encoder (AS5600)
The Grove - AS5600 is a programmable 12-bit high-resolution contactless magnetic rotary position sensor. The Grove - AS5600 can work as a magnetic potentiometer or a magnetic encoder with excellent reliability and durability.
Compared with the traditional potentiometer/encoder, the Grove - AS5600 has significant advantages: high precision, non-contact, no rotation angle limitation. All those advantages making it suitable for non-contact angle measurement applications, such as the robot arm, tripod head, motor closed-loop control, machine tool axis positioning.
Feature
- Non-contact, no rotation angle limitation
- 12-bit high-resolution, 4096 positions per round
- Grove I2C, PWM/Analog Output
- Great flexibility on angular excursion: Maximum angle programmable from 18° up to 360°
Specification
Parameter | Value |
---|---|
Supply voltage | 3.3V / 5V |
Operating ambient temperature | -40 – 125℃ |
Input Current | -100-100mA |
Flexibility | Maximum angle programmable from 18°-360° |
Interface | I2C(Default I2C Address: 0x36) & Non-Changeable |
Output | Analog/PWM output |
Output Resolution | 12-bit DAC |
Working Principle
Grove - AS5600 is based on the Hall Effect, the build-in Hall sensor can detect changes in the direction of the magnetic field, thus there is also no rotation angle limit. The magnetic field direction information is amplified by the amplifier, with the help of the build-in 12-bit A/D, the AS5600 module can output 4096 positions per round. The output is selectable, you can either use the I2C interface to output the RAW data or output the PWM wave/Analog wave via the OUT pin. Meanwhile, the maximum angle is also programmable, you can set the maximum angle from 18° to 360°, which means that the measured angular accuracy is up to 18/4096.
The AS5600 has certain requirements for the magnetic field to be measured. Please use a magnet similar in size to the chip. The module should be measured as close as possible to the magnetic field and the AS5600 sensor center should be aligned with the center of the magnetic field. The vertical distance is preferably from 0.5 mm to 3 mm.
Hardware Overview
Platforms Supported
Arduino | Raspberry Pi | |||
---|---|---|---|---|
Getting Started
Play With Arduino
Materials required
Seeeduino V4.2 | Base Shield | Grove - 12-bit Magnetic Rotary Position Sensor / Encoder (AS5600) |
---|---|---|
Get ONE Now | Get ONE Now | Get ONE Now |
In addition, you can consider our new Seeeduino Lotus M0+, which is equivalent to the combination of Seeeduino V4.2 and Baseshield.
Hardware Connection
Step 1. Connect the Grove - 12-bit Magnetic Rotary Position Sensor / Encoder (AS5600) to the I2C port of the Base Shield.
Step 2. Plug Grove - Base Shield into Seeeduino.
Step 3 Connect the Seeeduino to PC via a USB cable.
Software
If this is the first time you work with Arduino, we strongly recommend you to see Getting Started with Arduino before the start.
- Step 1. Download the AS5600 Library from Github.
Refer How to install library to install library for Arduino.
- Step 2. Restart the Arduino IDE. Open readAngle example via the path: File → Examples → Seeed_AS5600-master → readAngle. Through this demo, we can read the angles from a magnet underneath the sensor.
The readAngle Example code is as follow:
#include <Wire.h>
#include <AS5600.h>
#ifdef ARDUINO_SAMD_VARIANT_COMPLIANCE
#define SERIAL SerialUSB
#define SYS_VOL 3.3
#else
#define SERIAL Serial
#define SYS_VOL 5
#endif
AMS_5600 ams5600;
int ang, lang = 0;
void setup()
{
SERIAL.begin(115200);
Wire.begin();
SERIAL.println(">>>>>>>>>>>>>>>>>>>>>>>>>>> ");
if(ams5600.detectMagnet() == 0 ){
while(1){
if(ams5600.detectMagnet() == 1 ){
SERIAL.print("Current Magnitude: ");
SERIAL.println(ams5600.getMagnitude());
break;
}
else{
SERIAL.println("Can not detect magnet");
}
delay(1000);
}
}
}
/*******************************************************
/* Function: convertRawAngleToDegrees
/* In: angle data from AMS_5600::getRawAngle
/* Out: human readable degrees as float
/* Description: takes the raw angle and calculates
/* float value in degrees.
/*******************************************************/
float convertRawAngleToDegrees(word newAngle)
{
/* Raw data reports 0 - 4095 segments, which is 0.087 of a degree */
float retVal = newAngle * 0.087;
ang = retVal;
return ang;
}
void loop()
{
SERIAL.println(String(convertRawAngleToDegrees(ams5600.getRawAngle()),DEC));
}
Step 3. Upload the demo. If you do not know how to upload the code, please check How to upload code.
Step 4. Open the Serial Monitor of Arduino IDE by click Tool-> Serial Monitor. Or tap the
ctrl
+shift
+m
key at the same time. Set the baud rate to 115200.Step 5. The result should be like this when it detected magnet underneath the sensor:
A calibrator is used here. The Calibrator 2D file is listed in Resources, so feel free to download and laser cut yourself!
FAQ
Q1# How to achieve maximum accuracy?
A1: Make sure the Grove - 12-bit Magnetic Rotary Position Sensor / Encoder (AS5600) sensor is at a fixed distance/position to the magnet. Rotate the magnet to get from angle 0 all the way to angle 360 at first time to ensure positioning is correct.
The AS5600 library also provides a full testing function to operate for the sensor.
Schematic Online Viewer
Resources
- [ZIP] Grove - 12-bit Magnetic Rotary Position Sensor / Encoder (AS5600) Schematic file
- [PDF] AS5600 Datasheet
- [DWG] Grove - 12 bit Magnetic Rotary Position Sensor(AS5600) Calibrator
Tech Support & Product Discussion
Thank you for choosing our products! We are here to provide you with different support to ensure that your experience with our products is as smooth as possible. We offer several communication channels to cater to different preferences and needs.