With the help of the datasheet and the Basic Application Connections docs I was able to control a 12V dc motor sort of successfully. I am using an Arduino UNO board (PWM at 495 Hz).
USING PWM on D2
The documentation suggests using PWM on D2 which I did, what seemed awkward to me was that for the time that D2 is in LOW cycle then SF also goes LOW (which indicates a faulty condition like overtemperature or overcurrent). This does not seem right to me being a typical application or is it something else that I am missing? Also, I dont know if because the low frequency of PWM I get an audible tone generated everytime the motor starts (may be a normal thing I dont know).
USING PWM on IN1-IN2
I switched and PWM’ed on IN1-IN2 inputs. SF stays HIGH (which I guess its a good thing). I get the same audible tone but much quieter. When I stop the motor (IN1-IN2 to LOW and D2 always HIGH) i have a little resistance when I try to freewheel the motor (which I didnt get when I PWM’ed on D2).
Can someone help me understand more in depth the differences between the 3 proposed ways to PWM? Is there any documentation available in the matter?
SF is supposed to go low whenever D2 goes low, so the behavior you described is correct.
It is normal to hear a whining noise from the motor at the same frequency as your PWM. You can solve this problem by switching to PWM frequency that’s higher than humans are capable of hearing, for example 20 kHz. The MC33926 is capable of accepting a 20 kHz PWM signal and the ATmega168/328 on the Arduino is capable of generating it.
That is what we would expect.
You are feeling extra resistance because both OUT1 and OUT2 outputs are in their low (L) state, which causes the motor to brake. Try disconnecting the motor from the motor driver (if you can) and turn it with your hand while the motor leads are shorted together: you should feel the same type of extra resistance. When you PWM the IN1 or IN2 lines, you are rapidly switching between a driving state and a braking state, so we call it drive/brake PWM.
By contrast, when you drive D2 low, you are disabling both of the outputs, which causes the motor to coast, so you can turn it with less resistance. When you PWM the D2 line, you are rapidly switching between a driving state and a coasting state, so we call it drive/coast PWM.
I don’t know of any in-depth documentation to point you to, but here are some tips:
- Using drive/brake PWM generally gives you a more linear relationship between motor speed and PWM duty cycle.
- The jrk has the same chip and does drive/brake PWM using the IN1 and IN2 lines.