Robot with Qwiic Motor Driver Veering to Left

Hey guys, I got a Qwiic motor driver kit a while ago, as well as the jetbot frame. I assembled the jetbot frame, attached the motor, and wired them to the qwiic motor driver. My only problem is that the robot veers to the left, but my code says that both motors should be going at speed 255.

Here is my code:

#include <Arduino.h>

#include <stdint.h>

#include “SCMD.h”

#include “SCMD_config.h” //Contains #defines for common SCMD register names and values

#include “Wire.h”

SCMD myMotorDriver; //This creates the main object of one motor driver and connected peripherals.

void setup()

{

pinMode(8, INPUT_PULLUP); //Use to halt motor movement (ground)

Serial.begin(9600);

Serial.println(“Starting sketch.”);

//***** Configure the Motor Driver’s Settings *****//

// .commInter face is I2C_MODE

myMotorDriver.settings.commInterface = I2C_MODE;

// set address if I2C configuration selected with the config jumpers

myMotorDriver.settings.I2CAddress = 0x5D; //config pattern is “1000” (default) on board for address 0x5D

// set chip select if SPI selected with the config jumpers

myMotorDriver.settings.chipSelectPin = 10;

//initialize the driver get wait for idle//

while ( myMotorDriver.begin() != 0xA9 ) //Wait until a valid ID word is returned

{

Serial.println( “ID mismatch, trying again” );

delay(500);

}

Serial.println( “ID matches 0xA9” );

// Check to make sure the driver is done looking for peripherals before beginning

Serial.print(“Waiting for enumeration…”);

while ( myMotorDriver.ready() == false );

Serial.println(“Done.”);

Serial.println();

//Set application settings and enable driver//

//Uncomment code for motor 0 inversion

//while( myMotorDriver.busy() );

//myMotorDriver.inversionMode(0, 1); //invert motor 0

while ( myMotorDriver.busy() );

myMotorDriver.enable(); //Enables the output driver hardware

}

#define LEFT_MOTOR 0

#define RIGHT_MOTOR 1

void loop()

{

myMotorDriver.setDrive(LEFT_MOTOR,0,255);

myMotorDriver.setDrive(RIGHT_MOTOR,0,255);

}

Edit: I also checked the voltage of both sides with a multimeter and they are giving me the exact same voltage

One motor runs a little faster than the other. Try slowing the right hand side motor a bit.

I’ve tried that, but the amount that I have to lower it is a lot. I stopped trying when the right motor was at 255 and the left motor was at 180.

Does applying direct voltage to the individual motors produce similar results? (power + gnd to motor, see how fast it spins…compare it to the other…same speed?) If they do rotate at the same speed, it is likely something wrong in the assembly/alignment of the chassis/wheels…make sure they aren’t rubbing, crooked, or otherwise not turning freely

if they don’t turn @ same speed, the motor may be defective. Contact us here www.sparkfun.com/returns for replacement

It is definitely a problem with the motor driver because I ran it with the motors only connected to one output of the motor driver, and whilst there was still a veer, it was EXTREMELY small, and would definitely be able to be corrected in software.

Alrighty; go to www.sparkfun.com/returns/ and fill in the info (it helps if you put a link to this thread) and we’ll get a replacement sent out

Edit: I also checked the voltage of both sides with a multimeter and they are giving me the exact same voltage

That shows you have a mechanical issue rather than

a board issue. A new board is going to do the same thing.