Strange PWM behaviou on Baby O

Hello,

I am having a strange behavior with PWM. At 50% duty cycle the motor is running at almost full speed. Speed varies very little from 50% duty cycle to 100% percent(speed increases by 5%, or rather at 50% speed is only 5% lesser than top speed).

Speed was measured from the encoder outputs. There was no load on the motor apart from the load from the 1:141 gearbox.
This behavior is the same for 300Hz, 1.2KHz and 9.7KHz PWM frequencies corresponding to mode 4, 3 and 2 respectively.

I then connected 500 ohm resistor instead of motor. I probed the IN1 and OUT1 signals on H-bridge chip. I saw that the delay from IN1 going high to OUT1 going high was about 50ns. But the delay from IN1 going low to OUT1 going low was about 2us.(That is micro seconds).

If I put a large resistor, 22Kohm instead of 500 Ohm the OUT1 does not fall to zero during PWM off state. It only drops to about 3V and stays flat for rest of the PWM period. This happens at all duty cycles.

Wondering what is going on?
Using the standard PWM test code from the library.

Thanks

Hello.

Do you have the ability to verify that the PWM has the duty cycle you have specified in your code? How much current does each of your motors draw at 100% duty cycle?

Do you know what the motor driver inputs are during the low portion of the PWM’s duty cycle? If both inputs are low, the motor driver’s outputs are “off” (high-Z) and you could very well see what you describe above.

- Ben

Hello,

I did verify the PWM duty cycle. I was sweeping the duty cycle from 0 to 100% and saw that on the scope.

As for the behavior with 22K resistor, yes both the gates being turned off does explain that behavior. Just not sure why it drops sharply to 3V and stays flat.

The motor specs are
No load Current 21mA (because there is gear box, current may be a little higher)
Terminal Resistance 5.1 Ohms
Rotor Inductance 70uH

I expected the motor speed to vary linearly with PWM duty cycle. When I probe OUT1 when motor is connected I see following.

When PWM is high the voltage reaches full scale (7.4V).
When PWM goes low the voltage does not drop all the way to zero. The at 50% duty cycle it drops only to about ~6.5V.

Is the PWM frequency too high? Saw this behavior at 300Hz PWM too.

Thanks
brijesh

The behavior you’re observing might just be the way the motor driver operates. It seems that motor speed does not typically vary linearly with PWM duty cycle. One of our customers, Jim Remington, did some motor control tests using our Orangutan and came up with a motor speed vs duty cycle curve that looks like what you’re describing (see the blue line on the right graph). He also found that if you configure your motor inputs to alternate between drive and brake (rather than drive and coast), the speed vs duty cycle curve becomes much more linear (the blue line on the left of the two graphs).

I suggest you take a look at the findings on that page and see if they mesh with your own observations. I believe he also provides some sample code that might be useful.

- Ben

Yes, my observations match Jim’s. I did measure the current today and those readings match too.

I will try locked antiphase PWM mode tomorrow and see how that one fares.

Thanks
Brijesh