

The T Encoder Pro by LillyGo is a high-precision rotary encoder designed to measure the position or speed of a rotating object. It converts the angular position of a shaft or axle into an analog or digital signal, making it an essential component in various applications such as robotics, industrial automation, and motor control systems.








| Parameter | Value |
|---|---|
| Supply Voltage | 3.3V - 5V |
| Operating Current | 10mA |
| Output Type | Quadrature (A and B channels) |
| Resolution | 20 pulses per revolution |
| Operating Temperature | -20°C to 85°C |
| Shaft Diameter | 6mm |
| Mounting Hole Size | 3mm |
| Pin Number | Pin Name | Description |
|---|---|---|
| 1 | VCC | Power supply (3.3V - 5V) |
| 2 | GND | Ground |
| 3 | A | Channel A output |
| 4 | B | Channel B output |
| 5 | SW | Switch output (optional) |
// Include the Encoder library
#include <Encoder.h>
// Define the pins for the encoder
#define ENCODER_PIN_A 2
#define ENCODER_PIN_B 3
// Create an Encoder object
Encoder myEncoder(ENCODER_PIN_A, ENCODER_PIN_B);
long oldPosition = -999;
void setup() {
// Initialize serial communication
Serial.begin(9600);
Serial.println("Basic Encoder Test:");
}
void loop() {
// Read the current position of the encoder
long newPosition = myEncoder.read();
// If the position has changed, print the new position
if (newPosition != oldPosition) {
oldPosition = newPosition;
Serial.println(newPosition);
}
}
No Output Signal:
Inaccurate Readings:
Mechanical Noise:
By following this documentation, users can effectively integrate the T Encoder Pro into their projects, ensuring accurate and reliable measurements of rotational position and speed.