Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use JGA25-371dc motor with encoder: Examples, Pinouts, and Specs

Image of JGA25-371dc motor with encoderDesign with JGA25-371dc motor with encoder in Cirkit Designer

Introduction

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.

Explore Projects Built with JGA25-371dc motor with encoder

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Arduino-Controlled DC Motor with Encoder Feedback and Adjustable Speed: A project utilizing JGA25-371dc motor with encoder in a practical application
Arduino-Controlled DC Motor with Encoder Feedback and Adjustable Speed

This circuit controls a gear motor with an integrated encoder using an L298N DC motor driver, which is interfaced with an Arduino Mega 2560 microcontroller. The motor's power is supplied by a 12V power source, which is also connected to an XL4015 DC Buck Step-down converter to provide a regulated 5V supply to the Arduino. The encoder outputs are connected to the Arduino for position or speed feedback, and the Arduino is programmed to manage the motor's speed and direction.

Open Project in Cirkit Designer
Image of STM32F407-Controlled Robotic System with Touch Interface and Motor Actuation: A project utilizing JGA25-371dc motor with encoder in a practical application
STM32F407-Controlled Robotic System with Touch Interface and Motor Actuation

This circuit is designed to control multiple DC motors using L298N motor drivers, which are interfaced with an STM32F407 Discovery Kit microcontroller. The microcontroller receives input from a rotary encoder, multiple touch sensors, a joystick module, and an IR sensor to determine the motors' behavior. A 12V power supply provides power to the motor drivers, which is regulated for other components by MT3608 step-up converters, and the entire system is powered by an AC supply connected to the 12V power supply unit.

Open Project in Cirkit Designer

Common Applications

Technical Specifications

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

Pin Configuration and Descriptions

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.

Usage Instructions

How to Use the JGA25-371 DC Motor with Encoder in a Circuit

  1. Power the Motor: Connect the red and black wires to a DC power supply or motor driver. Ensure the voltage matches the motor's rated voltage (e.g., 12V).
  2. Connect the Encoder:
    • Connect the blue wire to a 5V power source.
    • Connect the white wire to the ground of the power source.
    • Connect the yellow and green wires to the input pins of a microcontroller (e.g., Arduino) to read encoder signals.
  3. Use a Motor Driver: To control the motor's speed and direction, use an H-bridge motor driver (e.g., L298N or L293D). The motor driver will allow you to interface the motor with a microcontroller safely.

Important Considerations and Best Practices

Example Code for Arduino UNO

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
}

Notes on the Code

Troubleshooting and FAQs

Common Issues and Solutions

  1. Motor Does Not Spin

    • Cause: Insufficient power supply or incorrect wiring.
    • Solution: Verify the power supply voltage and current. Check the red and black wire connections.
  2. Encoder Signals Are Unstable

    • Cause: Electrical noise from the motor.
    • Solution: Add capacitors (e.g., 0.1 µF) across the motor terminals to suppress noise.
  3. Incorrect Encoder Readings

    • Cause: Miswiring or missing pull-up resistors.
    • Solution: Double-check the wiring of the encoder pins. Add pull-up resistors if necessary.
  4. Motor Driver Overheats

    • Cause: Motor driver is undersized for the motor's current.
    • Solution: Use a motor driver with a higher current rating.

FAQs

  1. Can I use the JGA25-371 motor with a 5V power supply?

    • While the motor may run at 5V, it will operate at reduced speed and torque. A 12V supply is recommended for optimal performance.
  2. How do I calculate the motor's speed in RPM using the encoder?

    • Count the number of encoder pulses in one second, divide by the encoder's PPR, and multiply by 60.
  3. Can I control this motor with PWM?

    • Yes, you can use PWM (Pulse Width Modulation) to control the motor's speed via a motor driver.
  4. What is the purpose of the encoder?

    • The encoder provides feedback on the motor's position and speed, enabling precise control in applications like robotics and automation.

By following this documentation, you can effectively integrate the JGA25-371 DC motor with encoder into your projects and troubleshoot common issues.