The Adafruit I2C QT Rotary Encoder is a versatile and user-friendly electronic component that enables precise tracking of rotary position and movement. It is designed to be interfaced with microcontrollers such as the Arduino UNO via the I2C communication protocol. This rotary encoder is ideal for applications such as user interfaces, menu navigation in projects, and volume control, among others.
Pin Number | Name | Description |
---|---|---|
1 | VCC | Power supply (3.3V to 5V) |
2 | GND | Ground connection |
3 | SCL | I2C clock line |
4 | SDA | I2C data line |
5 | INT | Interrupt pin (optional use) |
To use the Adafruit I2C QT Rotary Encoder with an Arduino UNO, follow these steps:
Connect the Encoder to the Arduino:
Install the Adafruit Library:
Adafruit Seesaw
library, which is required to interface with the encoder.Programming the Arduino:
#include <Wire.h>
#include <Adafruit_Seesaw.h>
Adafruit_Seesaw encoder;
void setup() {
Serial.begin(9600);
if (!encoder.begin(0x36)) { // Default I2C address is 0x36
Serial.println("Encoder not found");
while (1);
}
Serial.println("Encoder found!");
}
void loop() {
int16_t position = encoder.encoderRead();
Serial.print("Position: ");
Serial.println(position);
delay(100);
}
Wire.setClock()
function to adjust the I2C clock speed if necessary.Q: Can I change the I2C address of the encoder? A: Yes, the I2C address can be changed by soldering the address jumpers on the back of the encoder.
Q: Is the encoder compatible with 3.3V systems? A: Yes, the encoder can operate at 3.3V, but ensure that the logic levels are compatible with the microcontroller.
Q: How do I use the button feature of the encoder?
A: The button state can be read using the encoder.readButton()
function in the Adafruit Seesaw library.
For further assistance, consult the Adafruit I2C QT Rotary Encoder datasheet and the Adafruit Seesaw library documentation.