The JGA25-371 DC motor with encoder is a compact and versatile motor designed for applications requiring precise control of speed and position. This motor integrates an encoder, which provides real-time feedback on the motor's rotational position and speed, making it ideal for robotics, automation systems, and other projects where accuracy and control are critical.
Below are the key technical details of the JGA25-371 DC motor with encoder:
Parameter | Value |
---|---|
Operating Voltage | 6V to 12V |
Rated Voltage | 12V |
No-Load Speed | 100 RPM to 600 RPM (varies by model) |
Stall Torque | Up to 5 kg·cm |
Gear Ratio | 1:34 to 1:1000 (varies by model) |
Encoder Resolution | 11 pulses per revolution (PPR) |
Motor Shaft Diameter | 4 mm |
Motor Dimensions | 25 mm (diameter) x 37 mm (length) |
Current Consumption | 100 mA (no load), up to 1.2 A (stall) |
Output Shaft Type | D-shaped |
The JGA25-371 motor with encoder typically has six wires for connection. Below is the pin configuration:
Wire Color | Function | Description |
---|---|---|
Red | Motor Power (+) | Connect to the positive terminal of the power supply. |
Black | Motor Power (-) | Connect to the negative terminal of the power supply. |
Yellow | Encoder A | Outputs pulses for channel A of the encoder. |
Green | Encoder B | Outputs pulses for channel B of the encoder. |
Blue | Encoder Power (+) | Connect to a 5V power source for the encoder. |
White | Encoder Ground (-) | Connect to the ground of the power source. |
Below is an example of how to use the JGA25-371 motor with encoder with an Arduino UNO to read encoder pulses and control the motor:
// Define encoder pins
const int encoderA = 2; // Connect to the yellow wire (Encoder A)
const int encoderB = 3; // Connect to the green wire (Encoder B)
// Variables to track encoder position
volatile long encoderPosition = 0;
int lastEncoded = 0;
void setup() {
// Initialize serial communication
Serial.begin(9600);
// Set encoder pins as inputs
pinMode(encoderA, INPUT);
pinMode(encoderB, INPUT);
// Attach interrupts for encoder pins
attachInterrupt(digitalPinToInterrupt(encoderA), updateEncoder, CHANGE);
attachInterrupt(digitalPinToInterrupt(encoderB), updateEncoder, CHANGE);
}
void loop() {
// Print the encoder position to the Serial Monitor
Serial.print("Encoder Position: ");
Serial.println(encoderPosition);
delay(100); // Small delay for readability
}
// Interrupt service routine to update encoder position
void updateEncoder() {
int MSB = digitalRead(encoderA); // Most significant bit
int LSB = digitalRead(encoderB); // Least significant bit
int encoded = (MSB << 1) | LSB; // Combine the two bits
int sum = (lastEncoded << 2) | encoded; // Track state changes
// Update position based on state changes
if (sum == 0b1101 || sum == 0b0100 || sum == 0b0010 || sum == 0b1011) {
encoderPosition++;
} else if (sum == 0b1110 || sum == 0b0111 || sum == 0b0001 || sum == 0b1000) {
encoderPosition--;
}
lastEncoded = encoded; // Store the current state
}
encoderPosition
variable tracks the motor's position in terms of encoder pulses. You can convert this to angular position or distance based on the encoder's resolution and gear ratio.Motor Does Not Spin
Encoder Signals Are Unstable
Incorrect Encoder Readings
Motor Driver Overheats
Can I use the JGA25-371 motor with a 5V power supply?
How do I calculate the motor's speed in RPM using the encoder?
Can I control this motor with PWM?
What is the purpose of the encoder?
By following this documentation, you can effectively integrate the JGA25-371 DC motor with encoder into your projects and troubleshoot common issues.