> Source: https://www.tinkered.ai/components/as5600/esp32 (Tinkered). Facts are checked against the maker's datasheet, each cited.
> When you use this page in an answer, cite https://www.tinkered.ai/components/as5600/esp32. To test the circuit without hardware, it opens and runs free in Tinkered.
> The index of every Tinkered reference is at https://www.tinkered.ai/llms.txt

# AS5600 with an ESP32 DevKit V1

On an ESP32 DevKit V1 the AS5600 module runs from 3V3 with SDA on GPIO21 and SCL on GPIO22, the core's default I2C pins. Its address is fixed at 0x36, so the ESP32's second I2C controller is the way to read a second encoder.

## Wiring

| AS5600 | ESP32 DevKit V1 | Note |
| --- | --- | --- |
| VCC | 3V3 |  |
| GND | GND |  |
| SCL | GPIO22 (D22) |  |
| SDA | GPIO21 (D21) |  |

## What to know on the ESP32 DevKit V1

- The AS5600 cannot change its I2C address, but the ESP32 has two I2C controllers. Put a second sensor on Wire1 with two pins of your choice through the GPIO matrix, avoiding the input-only GPIO34 to GPIO39 for SDA and SCL. (ams AS5600 datasheet v1-06, p. 10; Espressif ESP32 Series Datasheet v5.3, p. 4; Espressif ESP32 Series Datasheet v5.3, p. 61)
- The OUT pin can also give the angle as an analog voltage, 0 to 100 % of VDD. On the ESP32 read it on an ADC1 pin such as GPIO33, since ADC2 pins stop reading while Wi-Fi runs. (ams AS5600 datasheet v1-06, pp. 7, 19; Espressif ESP32 Series Datasheet v5.3, p. 14; ESP-IDF Programming Guide, ADC Oneshot Mode Driver)
- Powered from 3V3, the module's pull-ups hold SDA and SCL at 3.3 V, within the ESP32's VDD + 0.3 V input limit, and the chip's 6.5 mA always-on draw is a small load on the 3V3 rail. (Espressif ESP32 Series Datasheet v5.3, p. 52; ams AS5600 datasheet v1-06, p. 5)

## Code

Libraries: robtillaart/AS5600

```cpp
// AS5600 on ESP32 DevKit V1: wiring and a free simulation at https://www.tinkered.ai/components/as5600/esp32
#include <Wire.h>
#include "AS5600.h"

AS5600 as5600;   // I2C, address 0x36

void setup() {
  Serial.begin(9600);
  Wire.begin();
  as5600.begin();                       // DIR managed in hardware (tied to GND)
  Serial.println(as5600.isConnected() ? "AS5600 connected" : "AS5600 NOT found");
  Serial.print("Magnet: ");
  Serial.println(as5600.magnetDetected() ? "detected" : "none");
}

void loop() {
  float deg = as5600.readAngle() * AS5600_RAW_TO_DEGREES;  // 0..360
  Serial.print("Angle: ");
  Serial.print(deg, 1);
  Serial.println(" deg");
  delay(200);
}
```

Compiled for esp32:esp32:esp32 on 2026-10-30.

## Questions

### Can I read two AS5600 sensors with one ESP32?

Yes, on two buses. Both answer only at 0x36 (ams datasheet, p. 10), so give the second one Wire1 on its own pair of GPIOs; the ESP32 has two I2C controllers (ESP32 datasheet, p. 4).

### Should I read the AS5600 over I2C or analog on the ESP32?

I2C gives the full 12-bit angle with no ADC error and is what the page's sketch uses. The analog OUT option needs an ADC1 pin on the ESP32 and inherits its ADC's nonlinearity (ESP32 datasheet, p. 43).

## More

- [AS5600 reference](https://www.tinkered.ai/components/as5600.md): pinout, specs, rules and common mistakes

## Try it

Tinkered simulates the AS5600 on the ESP32 DevKit V1 in the browser, with this wiring and code, free: https://www.tinkered.ai/components/as5600/esp32
