pololu motor driver and dc motor

Hi guys

So I bought this pololu high power motor driver (18v15A) Pololu High-Power Motor Driver 18v15
I've soldered it up and connected it to my Arduino and I have it running, however the problem is that I cannot seem to adjust the speed using PWM on the Arduino!

Here are my connections:
Powersupply V+ connected to V+ on pololu driver
Powersupply com connected to ground on pololu driver
motor connected to out A and out B

pololu ground connected to Arduino ground
pololu driver dir connected to Arduino pin 11
pololu driver pwm connected to Arduino pin 12
(interestingly the pwm pin on the board is printed in white text as pwmH not pwm, just a side note)

The code I'm using moves the motor for 10 seconds at 150pwm and then stops it for 2 seconds and loops. I have tried varying values for pwm ranging from 1 through 250 and the speed does not seem to change and I cannot figure out why.
As far as I can see the power supply is supplying correct voltage and can provide more than enough current, and my connections are sound. I've checked the soldered joints and they are fine too.

Here's the code I am using:

int pwm = 9;
int dir = 10;
int val;
 
void setup()
{
  Serial.begin(9600);
  pinMode(pwm, OUTPUT);
  pinMode(dir, OUTPUT);
  digitalWrite(pwm, LOW);
  digitalWrite(dir, LOW);
}
 
void loop()
{
        digitalWrite(dir, HIGH);
        digitalWrite(pwm, 150);
        delay(10000);

        digitalWrite(dir, LOW);
        digitalWrite(pwm, LOW);

        delay(2000);

}

I can't figure it out, has anyone else managed to get this driver pwm to adjust motor speed working?

Thanks

On an Uno pin 12 is not a PWM pin.

...R

This is a mega, but I'll try using a different pin, thanks

Alexisa:
This is a mega, but I'll try using a different pin, thanks

You had not said. AFAIK pin 12 should work fine on a Mega. Don't change things when there is no need. It just confuses the debugging process.

Have you tried a very simple program that just starts the motor running with a single analogWrite(). Then change the program to change the analogWrite() value?

When that works you have a solid starting point from which to evolve the rest of the program.

...R

Hi,

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
It will be clearer to all, also a picture of your project so we can see your layout will help.

Thanks.. Tom.. :slight_smile: