Overview
Add rotational sensing - without a mechanical connection - with the Adafruit AS5600 Magnetic Angle Sensor. Featuring the classic ams AS5600, this board can sense a rotating N/S magnetic field up to 3mm away from the chip body. These sensors are often used to create 'frictionless' rotary encoders or potentiometers, without the risk of mechanical failure or noise. Magnetic angle sensors get the best of 'both worlds': like rotary encoders they can rotate freely 360 degrees around, and like potentiometers, they have absolute location detection.
All you need is a microcontroller or microcomputer with I2C - we have Arduino, Python and CircuitPython driver support. Then, identify the north and south of a magnet: we recommend a rare earth magnet. Note that many round magnets have the N/S on alternate 'coin face' sides, so you'll need to rotate it on the edge. Place the magnet near the middle of the chip and rotate it in place. The firmware will detect the magnetic field and report the angle from 0 to 359 with 0.1° precision and 0.4° accuracy.
To make usage plug-and-play, we added SparkFun qwiic-compatible STEMMA QT connectors for the I2C bus, so you don't even need to solder the I2C and power lines. Simply wire up to your favorite micro using a STEMMA QT adapter cable. The Stemma QT connectors also mean the AS5600 can be used with our various associated accessories. QT Cable is not included, but we have a variety in the shop.
Comes as a fully assembled breakout board a small bit of header. Some light soldering is required to attach the header for use on a breadboard.
Page last edited July 08, 2025
Text editor powered by tinymce.
Pinouts
The I2C address is 0x36.
Power Pins
- VIN - this is the power pin. It can be powered by 3V or 5V. Give it the same power as the logic level of your microcontroller - e.g. for a 5V micro like Arduino, use 5V.
- 3Vo - this is the 3.3V output from the voltage regulator, you can grab up to 100mA from this if you like.
- GND - common ground for power and logic.
I2C Logic Pins
- SCL - I2C clock pin, connect to your microcontroller's I2C clock line. This pin can use 3-5V logic, and there's a 10K pullup on this pin.
- SDA - I2C data pin, connect to your microcontroller's I2C data line. This pin can use 3-5V logic, and there's a 10K pullup on this pin.
- STEMMA QT - These connectors allow you to connect to development boards with STEMMA QT (Qwiic) connectors or to other things with various associated accessories.
PWM Output
- OUT - This is the analog/PWM output pin. In addition to reading data over I2C, you can read an analog or PWM output via this pin. In analog output mode, 0V corresponds to 0 degrees and VDD corresponds to 360 degrees. In PWM output mode, 0% duty cycle corresponds to 0 degrees and 100% duty cycle corresponds to 360 degrees.
Direction Jumper
- DIR - On the back of the board is the direction jumper, labeled DIR on the board silk. This pin determines the direction of the magnetic rotation measurement. By default, the jumper is tied to ground, which sets the direction to clockwise. You can cut this jumper to pull it high to set the direction to counter-clockwise.
Power LED and Jumper
- Power LED - In the upper left corner, above the STEMMA connector, on the front of the board, is the power LED, labeled on. It is a green LED.
- LED jumper - This jumper is located on the back of the board and is labeled LED on the board silk. Cut the trace on this jumper to cut power to the "on" LED.
PGO Pad
- PGO - On the back of the board, is a circular pad labeled PGO on the board silk. This is the program option pin and is used to calibrate and program the sensor. It is for advanced use only, since it changes the programming on the AS5600. More information on this pin and programming modes can be found in the datasheet, starting on page 22.
Page last edited July 08, 2025
Text editor powered by tinymce.
CircuitPython and Python
It's easy to use the AS5600 breakout with Python or CircuitPython, and the Adafruit_CircuitPython_AS5600 module. This module allows you to easily write Python code to read data from the AS5600 with a magnet.
You can use this driver with any CircuitPython microcontroller board or with a computer that has GPIO and Python thanks to Adafruit_Blinka, our CircuitPython-for-Python compatibility library.
CircuitPython Microcontroller Wiring
First wire up the breakout to your board exactly as follows. The following is the breakout wired to a Feather RP2040 using the STEMMA connector:
-
Board STEMMA 3V to breakout STEMMA VIN (red wire)
-
Board STEMMA GND to breakout STEMMA GND (black wire)
-
Board STEMMA SCL to breakout STEMMA SCL (yellow wire)
- Board STEMMA SDA to breakout STEMMA SDA (blue wire)
The following is the breakout wired to a Feather RP2040 using a solderless breadboard:
-
Board 3V to breakout VIN (red wire)
-
Board GND to breakout GND (black wire)
-
Board SCL to breakout SCL (yellow wire)
- Board SDA to breakout SDA (blue wire)
Python Computer Wiring
Since there are dozens of Linux computers/boards you can use, we will show wiring for Raspberry Pi. For other platforms, please visit the guide for CircuitPython on Linux to see whether your platform is supported.
Here's the Raspberry Pi wired with I2C using the STEMMA connector:
-
Pi 3V to breakout STEMMA VIN (red wire)
-
Pi GND to breakout STEMMA GND (black wire)
-
Pi SCL to breakout STEMMA SCL (yellow wire)
- Pi SDA to breakout STEMMA SDA (blue wire)
Here's the Raspberry Pi wired with I2C using a solderless breadboard:
-
Pi 3V to breakout VIN (red wire)
-
Pi GND to breakout GND (black wire)
-
Pi SCL to breakout SCL (yellow wire)
- Pi SDA to breakout SDA (blue wire)
Python Installation of AS5600 Library
You'll need to install the Adafruit_Blinka library that provides the CircuitPython support in Python. This may also require enabling I2C on your platform and verifying you are running Python 3. Since each platform is a little different, and Linux changes often, please visit the CircuitPython on Linux guide to get your computer ready!
Once that's done, from your command line run the following command:
pip3 install adafruit-circuitpython-as5600
If your default Python is version 3 you may need to run 'pip' instead. Just make sure you aren't trying to use CircuitPython on Python 2.x, it isn't supported!
CircuitPython Usage
To use with CircuitPython, you need to first install the Adafruit_CircuitPython_AS5600 library, and its dependencies, into the lib folder on your CIRCUITPY drive. Then you need to update code.py with the example script.
Thankfully, we can do this in one go. In the example below, click the Download Project Bundle button below to download the necessary libraries and the code.py file in a zip file. Extract the contents of the zip file, and copy the entire lib folder and the code.py file to your CIRCUITPY drive.
Your CIRCUITPY/lib folder should contain the following folders and file:
- adafruit_bus_device/
- adafruit_register/
- adafruit_as5600.mpy
Python Usage
Once you have the library pip3 installed on your computer, copy or download the following example to your computer, and run the following, replacing code.py with whatever you named the file:
python3 code.py
Example Code
If running CircuitPython: Once everything is saved to the CIRCUITPY drive, connect to the serial console to see the data printed out!
If running Python: The console output will appear wherever you are running Python.
# SPDX-FileCopyrightText: Copyright (c) 2025 Liz Clark for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""AS5600 Simple Test"""
import time
import board
import adafruit_as5600
i2c = board.I2C()
sensor = adafruit_as5600.AS5600(i2c)
while True:
# Read angle values
if sensor.magnet_detected:
if sensor.max_gain_overflow is True:
print("Magnet is too weak")
if sensor.min_gain_overflow is True:
print("Magnet is too strong")
print(f"Raw angle: {sensor.raw_angle}")
print(f"Scaled angle: {sensor.angle}")
print(f"Magnitude: {sensor.magnitude}")
else:
print("Waiting for magnet..")
print()
time.sleep(2)
First, the AS5600 sensor is recognized over I2C. Then, in the loop, it waits to sense a magnet. Take your magnet and rotate it over the sensor. Once it detects the magnet, you'll see the 12-bit raw angle, 12-bit scaled angle and magnitude readings printed out to the serial console.
Page last edited July 08, 2025
Text editor powered by tinymce.
Arduino
Using the AS5600 breakout with Arduino involves wiring up the breakout to your Arduino-compatible microcontroller, installing the Adafruit_AS5600 library, and running the provided example code. You'll need a magnet to use the sensor.
Wiring
Wire as shown for a 5V board like an Uno. If you are using a 3V board, like an Adafruit Feather, wire the board's 3V pin to the sensor VIN.
Here is an Adafruit Metro wired up to the sensor using the STEMMA QT connector:
-
Board 5V to breakout VIN (red wire)
-
Board GND to breakout GND (black wire)
-
Board SCL to breakout SCL (yellow wire)
- Board SDA to breakout SDA (blue wire)
Here is an Adafruit Metro wired up using a solderless breadboard:
-
Board 5V to breakout VIN (red wire)
-
Board GND to breakout GND (black wire)
-
Board SCL to breakout SCL (yellow wire)
- Board SDA to breakout SDA (blue wire)
Library Installation
You can install the Adafruit_AS5600 library for Arduino using the Library Manager in the Arduino IDE.
Click the Manage Libraries ... menu item, search for Adafruit_AS5600, and select the Adafruit AS5600 library:
If asked about dependencies, click "Install all".
If the "Dependencies" window does not come up, then you already have the dependencies installed.
/*!
* @file AS5600_basic.ino
*
* Basic example for the Adafruit AS5600 library
*
* Written by Limor Fried for Adafruit Industries.
* MIT license, all text above must be included in any redistribution
*/
#include <Adafruit_AS5600.h>
Adafruit_AS5600 as5600;
void setup() {
Serial.begin(115200);
while (!Serial)
delay(10);
Serial.println("Adafruit AS5600 Basic Test");
if (!as5600.begin()) {
Serial.println("Could not find AS5600 sensor, check wiring!");
while (1)
delay(10);
}
Serial.println("AS5600 found!");
as5600.enableWatchdog(false);
// Normal (high) power mode
as5600.setPowerMode(AS5600_POWER_MODE_NOM);
// No Hysteresis
as5600.setHysteresis(AS5600_HYSTERESIS_OFF);
// analog output
as5600.setOutputStage(AS5600_OUTPUT_STAGE_ANALOG_FULL);
// OR can do pwm!
// as5600.setOutputStage(AS5600_OUTPUT_STAGE_DIGITAL_PWM);
// as5600.setPWMFreq(AS5600_PWM_FREQ_920HZ);
// setup filters
as5600.setSlowFilter(AS5600_SLOW_FILTER_16X);
as5600.setFastFilterThresh(AS5600_FAST_FILTER_THRESH_SLOW_ONLY);
// Reset position settings to defaults
as5600.setZPosition(0);
as5600.setMPosition(4095);
as5600.setMaxAngle(4095);
Serial.println("Waiting for magnet detection...");
}
void loop() {
if (! as5600.isMagnetDetected()) {
return;
}
// Continuously read and display angle values
uint16_t rawAngle = as5600.getRawAngle();
uint16_t angle = as5600.getAngle();
Serial.print("Raw: ");
Serial.print(rawAngle);
Serial.print(" (0x");
Serial.print(rawAngle, HEX);
Serial.print(") | Scaled: ");
Serial.print(angle);
Serial.print(" (0x");
Serial.print(angle, HEX);
Serial.print(")");
// Check status conditions
if (as5600.isAGCminGainOverflow()) {
Serial.print(" | MH: magnet too strong");
}
if (as5600.isAGCmaxGainOverflow()) {
Serial.print(" | ML: magnet too weak");
}
Serial.println();
delay(50);
}
Upload the sketch to your board and open up the Serial Monitor (Tools -> Serial Monitor) at 115200 baud. You'll see the AS5600 recognized over I2C. Then, take a magnet and rotate it above the sensor. You'll see the raw angle and scaled angle printed out to the Serial Monitor, which are 12-bit values. If the magnet is too close or too far from the sensor, you'll see a warning printed to the Serial Monitor.
Page last edited July 08, 2025
Text editor powered by tinymce.
WipperSnapper
What is WipperSnapper
WipperSnapper is a firmware designed to turn any WiFi-capable board into an Internet-of-Things device without programming a single line of code. WipperSnapper connects to Adafruit IO, a web platform designed (by Adafruit!) to display, respond, and interact with your project's data.
Simply load the WipperSnapper firmware onto your board, add credentials, and plug it into power. Your board will automatically register itself with your Adafruit IO account.
From there, you can add components to your board such as buttons, switches, potentiometers, sensors, and more! Components are dynamically added to hardware, so you can immediately start interacting, logging, and streaming the data your projects produce without writing code.
If you've never used WipperSnapper, click below to read through the quick start guide before continuing.
First, wire up a AS5600 to your board exactly as follows. Here is an example of the AS5600 wired to an Adafruit ESP32 Feather V2 using I2C with a STEMMA QT cable (no soldering required)
-
Board 3V to sensor VIN (red wire on STEMMA QT)
-
Board GND to sensor GND (black wire on STEMMA QT)
-
Board SCL to sensor SCL (yellow wire on STEMMA QT)
- Board SDA to sensor SDA (blue wire on STEMMA QT)
Usage
Connect your board to Adafruit IO Wippersnapper and navigate to the WipperSnapper board list.
On this page, select the WipperSnapper board you're using to be brought to the board's interface page.
If you do not see your board listed here - you need to connect your board to Adafruit IO first.
On the device page, quickly check that you're running the latest version of the WipperSnapper firmware.
The device tile on the left indicates the version number of the firmware running on the connected board.
- If the firmware version is green with a checkmark - continue with this guide.
- If the firmware version is red with an exclamation mark "!" - update to the latest WipperSnapper firmware on your board before continuing.
Next, make sure the sensor is plugged into your board and click the I2C Scan button.
You should see the AS5600's default I2C address of 0x36 pop-up in the I2C scan list.
First, double-check the connection and/or wiring between the sensor and the board.
Then, reset the board and let it re-connect to Adafruit IO WipperSnapper.
With the sensor detected in an I2C scan, you're ready to add the sensor to your board.
Click the New Component button or the + button to bring up the component picker.
Adafruit IO supports a large amount of components. To quickly find your sensor, type AS6500 into the search bar, then select the AS6500 component.
On the component configuration page, the AS5600's sensor address should be listed along with the sensor's settings.
The Send Every option is specific to each sensor's measurements. This option will tell the Feather how often it should read from the AS5600 sensor and send the data to Adafruit IO. Measurements can range from every second to every 24 hours.
For this example, set the Send Every interval to every 5 seconds. You can update it later using the settings cog at the end of the component row on the device page.
Your device interface should now show the sensor components you created. After the interval you configured elapses, WipperSnapper will automatically read values from the sensor(s) and send them to Adafruit IO.
If your sensor only shows a value of null, then try looking at the serial monitor for your device (it writes debugging log information to a serial port), or using another magnet.
To view the data that has been logged from the sensor, click on the graph next to the sensor name.
Here you can see the feed history and edit things about the feed such as the name, privacy, webhooks associated with the feed and more. If you want to learn more about how feeds work, check out this page.
Page last edited July 08, 2025
Text editor powered by tinymce.
Downloads
Page last edited July 08, 2025
Text editor powered by tinymce.