VNH5019 with Audrino Uno and 2 20.4:1 Metal Gearmotor 25Dx65L mm MP 12V with 48 CPR Encoder

Hello, I am beginner I am working on project, tying to connect VNH5019 Motor Driver Shield for Arduino (Item# 2507) to two Metal Gearmotor 25Dx65L mm MP 12V with 48 CPR Encoder(Item# 4863).

How to i need to make the connections between Motor and VNH5019

|Red|motor power (connects to one motor terminal) - M1A
|Black|motor power (connects to the other motor terminal) - M1B
|Green|encoder GND| - GND ? is this right?
|Blue|encoder Vcc (3.5 V to 20 V) - ? What should go here
|Yellow|encoder A output - ? is this M1INA? is this right?
|White|encoder B output - ? is this M1INB? is this right?

What should go to M1EN/DIAG and M1PWM ?
and what should the Blue (encoder Vcc ) connect to?

Any help is greatly appreciated.

Thanks.

Hello.

As you described, the red and black wires from the motor should go to the M1A and M1B motor output pins on the Dual VNH5019 Motor Driver Shield. The rest of the wires from the gearmotor are for the encoders, so the red and black wires are the only connections you need to drive the motor.

Please note that the VNH5019 shield does not have any special support for reading or processing encoders, but if you are mounting the Dual VNH5019 Motor Driver Shield on top of the Arduino (i.e. as a shield), you can use the pass-through headers to make the connections to the Arduino. First, you can power the encoders by connecting the green wire to one of the shield’s GND pins and the blue wire to the shield’s VDD pin. The yellow and white wires are the encoder signals; what pins you use to read these signals is up to you and should match your code, but you should not connect them to any of the pins already used by the shield (including the M1INA and M1INB pins). So, unless you know how to account for any potential conflicts it could cause, it would be best to avoid any of the pins called out in this diagram:


As far as reading the encoders, I recommend using an Arduino encoder library like this one that supports interrupts.

Brandon

Thank you Brandon. I used pins 3 and 5 for the encoder outputs. I connected the blue wire to the 5v pin and the green to the GND beside the 5v pin. I used 8 AA batteries to power the Motor. M1A and M1B are connected to the red and black wired, I used USB power for the Audrino Uno.

I used below code to test the motor. Nothing happened. Also, no LED lights were ON on the shield.

// Motor 1 pins
#define M1INA 2
#define M1INB 4
#define M1PWM 9
#define M1EN 6

// Motor 2 pins
#define M2INA 7
#define M2INB 8
#define M2PWM 10
#define M2EN 12

// Encoder pins for Motor 1
#define ENC1_A 3
#define ENC1_B 5

// Encoder pins for Motor 2
#define ENC2_A 11
#define ENC2_B 13

void setup() {
    // Motor pins setup
    pinMode(M1INA, OUTPUT);
    pinMode(M1INB, OUTPUT);
    pinMode(M1PWM, OUTPUT);
    pinMode(M1EN, OUTPUT);

    pinMode(M2INA, OUTPUT);
    pinMode(M2INB, OUTPUT);
    pinMode(M2PWM, OUTPUT);
    pinMode(M2EN, OUTPUT);

    // Encoder pins setup
    pinMode(ENC1_A, INPUT);
    pinMode(ENC1_B, INPUT);
    pinMode(ENC2_A, INPUT);
    pinMode(ENC2_B, INPUT);

    // Enable motors
    digitalWrite(M1EN, HIGH);
    //digitalWrite(M2EN, HIGH);
}

void loop() {
    // Example: Rotate Motor 1 forward at half speed
    digitalWrite(M1INA, HIGH);
    digitalWrite(M1INB, LOW);
    analogWrite(M1PWM, 128);

    // Example: Rotate Motor 2 backward at half speed
    //digitalWrite(M2INA, LOW);
    //digitalWrite(M2INB, HIGH);
    //analogWrite(M2PWM, 128);

    delay(2000);

    // Stop both motors
    analogWrite(M1PWM, 0);
    //analogWrite(M2PWM, 0);
    delay(1000);
}

I also tried the Demo Example in the library from GitHub - pololu/dual-vnh5019-motor-shield: Arduino library for the Pololu Dual VNH5019 Motor Driver Shield. No luck. No LED’s were ON on the shield.

What could be wrong? how to troubleshoot the issue? Any help, greatly appreciated.

Could you post some pictures of your setup that show all of your connections, including some close-up pictures of both sides of your dual VNH5019 motor shield?

Brandon

I have connected only 1 motor.







more pics of the shield