0
\$\begingroup\$

Ive got this motor driver from Sparkfun, https://www.sparkfun.com/products/9670. Where I get it that setting ENA and IN1 to high will enable connected motor 1 to og full speed in one direction.

But, can I connect IN1 to pwm and in that way control the speed? For instanse, instead of full speed I could get 50% speed by adjusting the dutycycle? And if I wanted I could read CSA pin to get the actual break "force"?

\$\endgroup\$
1
\$\begingroup\$

You can feed this driver with PWM signal.

I suggest to use ENABLE pins for PWM signal, this will allow you to use only one PWM channel in microcontroller for both motor directions.

You don't have to put PWM signal to both ENA and IN pins, you can use simple microcontroller output for IN pins and drive it like this:

enter image description here

And yes, you can use current sense outputs to measure "break force" on motor.

\$\endgroup\$
3
\$\begingroup\$

You can, but I'd use ENA as the pwm input. That is because if you want to reverse the motor you will need to hook a pwm output to IN2 instead of IN1, and that means another used pwm output for your microcontroller. You can do as you say though.
Keep in mind that the pwm frequency has a maximum, the L298 datasheet is not that clear but it seems to me that you can go up to 40kHz, while the typical frequency is 25kHz (page 4).

Start with a slow (some 10kHz or a bit more) pwm and go up until you are satisfied.

\$\endgroup\$
  • \$\begingroup\$ I was writing very similar answer when you published it... Im wondering if I should delete mine or not... \$\endgroup\$ – Kamil May 31 '14 at 22:55
  • \$\begingroup\$ The Hz is controlled by what? The thread sleep in between? \$\endgroup\$ – Jason94 Jun 1 '14 at 6:16
  • \$\begingroup\$ That seems quite right. What micro are you using? \$\endgroup\$ – Vladimir Cravero Jun 1 '14 at 6:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.