# x2. VNH2SP30. slow responce rate motor driver

Hi,
Would increasing the pwm frequency help with responce rate from when the motors are told to go to 0 speed and when the bot stops?
Also i think it has to do with the same thing time between foward and reverse seams to take a while.

I was also looking at the break comands both low and high but did not seam to get a noticable differnence when trying to implent them.

Hello.

The PWM frequency used by the X2 is already much faster than the mechanical response time of a motor, so you will not see an increase in response time by increasing the PWM frequency. Are you sure you’re not just seeing the effects of mechanical inertia? For example, the voltage on the motor ouputs could change immediately, but a mass will require time to accelerate to the new speed. You can push the gas pedal on your car all the way to the floor in a fraction of a second, but it will take a lot longer than that before you’ve gone from 0 to 60, and it will take even longer for you to slow back down to a stop if you just take your foot off the gas and don’t use the brake, which is entirely separate mechanism.

Are you using the instantaneous motor speed commands, or are you using the acceleration motor commands? If you want faster response, you should be using the former. If you want to decelerate more quickly, you should use the brake command with an argument of 127. The X2 PWM alternates the motor driver outputs between drive and coast (high-impedance), so a motor speed of 0 corresponds to full coasting. As a result, setting the motor speed to 0 will just let your robot roll to a stop. If you want to stop more quickly, you should use full braking, which shorts the two motor outputs together and generates a back EMF that resists rotation and slows the motor more quickly. You can see this effect for yourself by taking a spare motor and spinning it first with the leads dangling free and then again with the two leads held shorted together.

Note that the X2 allows variable braking; braking with an argument of 0 is equivalent to zero braking/full coasting (i.e. it is the same as setting the motor speed to 0).

- Ben

Thanks ben.
should it be using the low break or the high break? for the quickest posible break

``````// Variable braking for motor 1.   This command affects the motor immediately.
void brakeLowMotor1(unsigned char pwm)
{
sendMotorPWMCommand(CMD_MOTOR1_BRAKE_LOW, pwm);
}

// Variable braking for motor 1.   This command affects the motor immediately.
void brakeHighMotor1(unsigned char pwm)
{
sendMotorPWMCommand(CMD_MOTOR1_BRAKE_HIGH, pwm);
}``````

It doesn’t matter; both kinds of braking will slow the motor at the same rate since both use the same mechanism of shorting the two motor leads together. Brake-high shorts the two motor leads to the VIN rail while brake-low shorts the two motor leads to ground. Braking low is the safer approach since there’s less chance of inadvertently shorting something out on your board, so I would recommend you brake low with 100% duty cycle.

- Ben