Questions about 1000:1 Motor

Hi,

I have question about the code driving 1000:1 HPCB 12V Micro motor.
The motor has Pololu’s magnetic encoder connected to Pololu’s A4990 Dual motor driver carrier.
The board is Arduino Uno Wifi.

I am using this DRV8835 library GitHub - pololu/drv8835-motor-shield: Arduino library for the Pololu DRV8835 Dual Motor Driver Shield for Arduino http://www.pololu.com/product/2511
(Yes, I also have DRV8835 and 298:1 Motor and noticed that the code is working for A4990 and 1000:1 motor)

The motor is moving but after experiments with the positive code speed in the first and second for cycle - e.g I changed value of delay(), lowered initial value of int speed from 400 to 5, 10, 20 etc the motor got hot, something must have been burned and now the positive speed (the first two for cycles) moves only in one direction (and not forwards and backwards).

The negative speed (second two for cycles) looks to be working correctly -the motor moves forwards and backwards.

My questions are:

  1. Are the values correct for my motor 1000:1? (from 0 to 400 and from -400 to 0. The API for DV8835 says to use them)

2)Am I risking damaging my motor, driver, board by using library for DRV8835 when in fact I am using A4990?

#include <DRV8835MotorShield.h>

/*
 * This example uses the DRV8835MotorShield library to drive each motor with the
 * Pololu DRV8835 Dual Motor Driver Shield for Arduino forward, then backward. 
 * The yellow user LED is on when a motor is set to a positive speed and off when
 * a motor is set to a negative speed.
 */

#define LED_PIN 13
#define MODE 12

DRV8835MotorShield motors;

void setup()
{
  digitalWrite(MODE, HIGH);
  pinMode(LED_PIN, OUTPUT);
  
  // uncomment one or both of the following lines if your motors' directions need to be flipped
  //motors.flipM1(true);
  //motors.flipM2(true);
}

void loop()
{
  
  // run M1 motor with positive speed
  
  digitalWrite(LED_PIN, HIGH);

  for(int speed = 400; speed >= 0; speed--)
  {
    motors.setM1Speed(speed);
    delay(2);
  }

  for(int speed = 0; speed <= 400; speed++)
  {
    motors.setM1Speed(speed);
    delay(2);
  }
  
  
  // run M1 motor with negative speed
  
  digitalWrite(LED_PIN, LOW);
  
  for (int speed = 0; speed >= -400; speed--)
  {
    motors.setM1Speed(speed);
    delay(2);
  }
  
  for(int speed = -400; speed <= 0; speed++)
  {
    motors.setM1Speed(speed);
    delay(2);
  }

  delay(500);
}

Thanks in advance

Hello.

Our DRV8835 library only supports the PHASE/ENABLE mode on the #2511 DRV8835 Dual Motor Driver Shield. Unfortunately, the A4990 uses an IN/IN interface. So, you will not get the correct behavior using that library. You can find more information about the A4990’s IN/IN interface in the driver’s datasheet under the “Resources” tab of the carrier’s product page.

By the way, it looks like you are powering your encoder from the VIN pin on your motor driver; the encoder outputs are pulled-up to the VCC voltage, so you should make sure that voltage is being kept at a level that is safe for your Arduino. Instead of powering the encoder from your motor power supply, you might consider powering them from your Arduino’s 5V output directly.

Brandon