
The circuit consists of two rotary encoders (Kalamoyi P3022-V1-CW360) connected to two STG adapters. Each encoder's VCC, OUT, and GND pins are connected to the corresponding STG adapter, facilitating signal transmission and power supply management.

A rotary encoder, specifically the incremental type with a side mount, is an essential component in the realm of electronics for precise position tracking. It is an electromechanical device that translates the angular position or motion of a shaft into an analog or digital output signal. This type of encoder is particularly useful in applications that require accurate monitoring of rotational movement, such as in robotics, CNC machines, and various industrial control systems. The side mount design allows for convenient installation on the side of equipment, making it easily accessible for maintenance and integration.

The circuit consists of two rotary encoders (Kalamoyi P3022-V1-CW360) connected to two STG adapters. Each encoder's VCC, OUT, and GND pins are connected to the corresponding STG adapter, facilitating signal transmission and power supply management.

This circuit is designed to interface multiple rotary encoders with an Arduino Mega 2560 microcontroller. Each encoder's DT (data) and CLK (clock) pins are connected to specific digital input pins on the Arduino, allowing the microcontroller to read their rotational position changes. The encoders are powered by the Arduino's 5V output and share a common ground, suggesting that the circuit may be used for input devices in a user interface or control system.

This circuit features an Arduino Mega 2560 and two Arduino Nano microcontrollers interfacing with two rotary encoders for input. The system is powered by an AC-DC PSU board converting 220V AC to 5V DC, and the microcontrollers communicate with each other via serial connections. The setup is designed for reading rotary encoder inputs and potentially processing or transmitting the data.

This circuit features an RP2040 Zero microcontroller interfaced with a rotary encoder. The encoder's clock, data, and switch pins are connected to the microcontroller's GPIO pins 29, 28, and 27, respectively, allowing the microcontroller to read the encoder's state and print it to the serial monitor.
| Pin Number | Description | Notes |
|---|---|---|
| 1 | Ground (GND) | Connect to system ground |
| 2 | Supply Voltage (Vcc) | Typically 5V DC |
| 3 | Output A | Quadrature output A |
| 4 | Output B | Quadrature output B |
| 5 | Index (Optional) | Pulse per revolution (if present) |
Note: The pin configuration may vary slightly depending on the manufacturer. Always refer to the datasheet of the specific model you are using.
// Define the connections to the Arduino
const int pinA = 2; // Output A
const int pinB = 3; // Output B
// Variables to hold the current and last encoder state
volatile int encoderPos = 0;
int lastEncoded = 0;
void setup() {
pinMode(pinA, INPUT);
pinMode(pinB, INPUT);
digitalWrite(pinA, HIGH); // Enable pull-up resistor
digitalWrite(pinB, HIGH); // Enable pull-up resistor
attachInterrupt(digitalPinToInterrupt(pinA), updateEncoder, CHANGE);
attachInterrupt(digitalPinToInterrupt(pinB), updateEncoder, CHANGE);
Serial.begin(9600);
}
void loop() {
// The main loop can handle other tasks while the encoder position is updated
// via interrupts.
Serial.println(encoderPos);
delay(1000);
}
void updateEncoder() {
// Function to be called by the interrupt service routine
int MSB = digitalRead(pinA); // MSB = most significant bit
int LSB = digitalRead(pinB); // LSB = least significant bit
int encoded = (MSB << 1) | LSB; // Converting the 2 pin value to single number
int sum = (lastEncoded << 2) | encoded; // Adding it to the previous encoded value
if(sum == 0b1101 || sum == 0b0100 || sum == 0b0010 || sum == 0b1011) encoderPos++;
if(sum == 0b1110 || sum == 0b0111 || sum == 0b0001 || sum == 0b1000) encoderPos--;
lastEncoded = encoded; // Store this value for next time
}
Note: The above code uses interrupts to monitor the state changes of the encoder outputs, which allows the main program to run without waiting for the encoder to turn. This is a simple example and does not handle the index signal.
Q: Can I use this encoder with a 3.3V system? A: Yes, but ensure that the encoder is compatible with 3.3V logic levels. Check the datasheet for voltage ratings.
Q: How can I increase the resolution of my encoder readings? A: You can increase resolution by using an encoder with a higher PPR specification or by implementing software interpolation techniques.
Q: What is the purpose of the index signal? A: The index signal provides a single pulse per revolution, which can be used as a reference point for absolute positioning.
For further assistance, consult the manufacturer's datasheet and technical support resources.