Let's Make Robots!

PWM with l293/l298

I hit a wall when I was trying to use PWM on the enable pins of both l293 and l298. Whatever  PWM frequency I choose it seems that I loose a lot of torque on the l293/l298 outputs with the PWM at maximum (255).

Browsing around searching for implementations I have seen that most of the time PWM is used on the enable pins, but on some (very few) designs I have also seen PWM on the input pins. 

The question is:  which is best/recommended?  PWM on the enable pins or on the input pins?

Second question: I did use an Attiny clocked at 16 mHz when testing with all prescalers available, but the best results seem to be at no prescaler at all so pretty high frequency. What frequency should be used? 

Third one:  In the Atmel datasheets they recommend using phase and frequency correct PWM for motor application, but it seems to work better with fast PWM. What is your experience with that?

Last one: In my experiments with stepper motors I tried switching on the l293/l298 before the step and off after the step was done with a delay of 10 ms. With that delay the stepper would work with usable torque but still lesser than compared with the torque you get when leaving the driver on. How long does it actually take for the driver after enabling it to get to full power? I could not find any clear indication any where so that is why the first question comes to mind ...

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

The difference between strobing the enable pins and input pins on the L293/298 is quite significant.
When you're strobing the enable you're alternating between the normal forward/reverse condition and free-wheeling. If you've got a wheeled bot this is often useful because the momentum of the bot will keep it rolling 'for free' during the time that the enable is turned off.
If you strobe the inputs instead you're now alternating between forward/reverse and shorting the motor leads. Basically if both inputs to the motor are the same, then both the motor leads are connected to Vss or Ground together. This has a braking effect, which will generate a resisting torque whenever the inputs are the same and the motor tries to turn. This is potentially a good thing if you want the motor to lock up between bursts of power, for example if you were looking for accurate DC motor positioning or a higher resisting torque.

You can do a quick demonstration of the difference by spinning the motor by hand when the leads are disconnected and then tying them together and trying again. Different motors will have varying free-wheel and braking torques.

That does explain why I was not able to microstep using my driver with PWM on the enable pins.

In my exp, I've always used the input pin to push the pwm signal through as that seems to make sense for what I've been doing(same as you). I'd be curious as to what the difference would be as well.

Did you notice the same loss in torque while PWM-ing the input pins?

Which frequency did you use? 

What PWM type?

I think if we could actually crack this thing  once and for all, we could make an walktrough on that for driving motors and other stuff in general ... 

The setup(motor driver) that I had was actually underpowered for motor that I was using. I'm now moving over to a scratch built dual hbridge setup but still using pwm to control the speed.

I was just using a picaxe for the inital test, going to be using an arduino next as it has 4 pwm channels, though only 2 will be used as I need the other pwm channels to drive servos....need to research the setup.

50% duty cycle is fixed on these as far as I know.

I haven't played around enough with the avr chips yet to know how to control the pwm. I did want to use them though for pwm and simple io.