Motor PWM problem

I have a big problem with a motor and a motor driver.
See the dual motor driver(and details) I have, here:
Dual Motor

See the motor(and details) I have, here:

I use an arduino uno to control motor direction and speed of motor.
I also have a voltage transformer (220V → 24V) and connect these 2 wires to POWER and GND of driver
I connect the +5V and GND to arduino 5V and GND, pin PWM2 of driver to pin 9 of arduino and pin DIR2 to pin 10 of arduino.
Then, I connect pin MOTOR2 to red wire of motor and the other pin MOTOR2 of driver to black wire of motor.


int DIR = 10;
int PWM = 9;

void setup()
  pinMode(DIR, OUTPUT);
  pinMode(PWM, OUTPUT);

void loop()
  for (int i = 0; i <= 255; i++)  // increase speed
    digitalWrite(PWM, i);
    digitalWrite(DIR, 0);
    if (i == 255)   //if max_speed
      for (int i = 255; i >= 0; i--)  // decrease speed
        digitalWrite(PWM, i);
        digitalWrite(DIR, 0);

So,the problem I have is:
For some reason, speed is not increasing/decreasing ,but is stable
Then when I change DIR2 from 0 to 1 ,the motor rotates otherwise, BUT the motor driver board starts to get very hot .
Do you have any link about this motor driver(how it works)??
I have found some videos ,but doesn’t refer descriptions(or code).
I need a big help here.

There are descriptions for motor and motor driver in links.
I think this project will be my thesis in the future
If I solve this important and basic problem ,I will be able to continue the project.

Your help is very important !!!

Thanks a lot… :slight_smile:

You need to use analogWrite() for PWM. digitalWrite() just does LOW or HIGH.


OOOOOOhhhh,I forgot it.Yes.

But , as about the other problem I have :
When I change DIR2 from 0 to 1 (to change direction of motor ),the motor driver is getting hot.
Why is this happening?


ok ,I just solve it
It was only the analogWrite.

thanks a lot

Is it common for these 8 MOSFETs to heat up?

Does anyone know if is it common for these 8 mosfet of motor driver (that I have in the first link) to heat up?