G2 Dual High Power 24v14 Motor Driver M1 not responding

Using a Spektrum DX6e RC transmitter and AR620 receiver, Arduino MEGA 2560, and Dual G2 High Power 24v14 driver. I modified a Sparkfun code. When I run the code and using the toggle on the transmitter (right toggle, up/down) only M2 operates properly. I am new to coding and can’t figure out if the code is written incorrectly. I have changed out the motor driver to ensure it wasn’t a bad board or that my novice soldering wasn’t the problem but I got the same result. I verified my wires were in the correct pins and used different wires to make sure there wasn’t a short of some kind…but same result. Also, when I have the SLP pins connected, I get no motion out of either motor. So, I removed them. The only other attached wire (not in the code) is GND (on left side of motor driver) to GND on Arduino. I have attached the code I’m running. This is for my senior design project so any help will be greatly appreciated.

// controller pins
const int CH_4_PIN = 11;

// motor driver pins
const int M1SLP = 10;
const int M1DIR = 2;
const int M1PWM = 5;
const int M2SLP = 9;
const int M2DIR = 7;
const int M2PWM = 6;

// parameters
const int deadzone = 20;  //anything between -20 and 20 is stop

void setup() {

  //configure pins
  pinMode(M1SLP, OUTPUT);
  pinMode(M1DIR, OUTPUT);
  pinMode(M1PWM, OUTPUT);
  pinMode(M2SLP, OUTPUT);
  pinMode(M2DIR, OUTPUT);
  pinMode(M2PWM, OUTPUT);

  //Enable motor driver
  digitalWrite(M1SLP, HIGH);
  digitalWrite(M2SLP, HIGH);


void loop() {

  //read pulse width from receiver
  int ch_4 = pulseIn(CH_4_PIN, HIGH, 25000);

  // convert to PWM value (-255 to 255)
  ch_4 = pulseToPWM(ch_4);

  // drive motor
  drive(ch_4, ch_4);


// postive for forward, negative for reverse
void drive(int speed_a, int speed_b)  {

  //limit speed between -255 and 255
  speed_a = constrain(speed_a, -255, 255);
  speed_b = constrain(speed_b, -255, 255);

  // set direction for M1
  if ( speed_a == 0)  {
    digitalWrite(M1SLP, LOW);
  } else if (speed_a > 0){
    digitalWrite(M1DIR, LOW);
  } else  {
    digitalWrite(M1DIR, HIGH);

  // set direction for M2
  if (speed_b == 0) {
    digitalWrite(M2SLP, LOW);
  } else if (speed_b > 0) {
    digitalWrite(M2DIR, LOW);
  } else {
    digitalWrite(M2DIR, HIGH);
  // set speed
  analogWrite(M1PWM, abs(speed_a));
  analogWrite(M2PWM, abs(speed_b));

//Convert RC pulse value to motor PWM value
int pulseToPWM(int pulse) {

  //If we're receiving numbers, convert them to motor PWM
  if (pulse > 1000) {
    pulse = map(pulse, 1000, 2000, -500, 500);
    pulse = constrain(pulse, -255, 255);
  } else {
    pulse = 0;
  //anythinig in deadzone should stop the motor
  if (abs(pulse) <= deadzone) {
    pulse = 0;

  return pulse;



I moved your post to the “Motor controllers/driver and motors” section of our forum since it seemed more appropriate.

Are you using the Arduino shield version of our 24v14 high-power motor driver? Based on your connections, it sounds like you are not mounting it on your Arduino (like a shield typically would). If that is easy for you to do, you could try removing the RC connections in your setup and using the “Demo.ino” example code from our Arduino library for the Pololu Dual G2 High Power Motor Driver Shields to see if you get the same behavior.

If our demo code still has the same results of one motor not responding, can you post pictures of your setup that show all of your connections, as well as some close-up pictures of both sides of your high-power motor driver board?

By the way, you should not need to toggle the sleep pin whenever the speed is 0 to stop the motor; you just sending a low (0V) signal to the PWM pin should be fine.


Hi Brandon,
Thanks for letting me know about the move. I ran the Pololu demo and it worked fine. I am going to make the changes you suggested and see how that goes. One thing I didn’t mention in the earlier post is that I am eventually going to be using 6 motors (3 motor drivers) and a Teensy 3.2 and Tall-dog breakout board. Will the demo work the same on the Teensy? Also, is there a way to streamline the driver board connections (ie connect one to another) so that a single signal wire from the Arduino/Teensy is sent to all three drivers?

Thanks again,

I have not tried the Arduino library for the Pololu Dual G2 High Power Motor Driver Shields with the Teensy, so I cannot say for sure if it will work. Since it is not supported in the library, it will not be configured to use 20kHz PWM as the supported Arduino boards, but it might still work at the default analogWrite frequency on a Teensy.

With a quick search, it looks like you could probably make an addition to your sketch (or a small modification to the library) to call analogWriteFrequency(pin, frequency) if you want to specify a higher frequency. According to PJRC’s website, that should work with the Teensy 3.x.

As far as controlling multiple drivers, if you do not need independent control of all 6 motors, you could split the PWM and DIR signals to multiple drivers. This would essentially give you 2 sets of 3 motors (for example, 3 motors on each side of a robot), which you could also accomplish with only one driver board by connecting 3 motors in parallel to each channel. If you need all 6 of them to be independently controlled, you will need separate control signals for each.