Driving stepper motors
Stevezila
Posts: 35
·Does anyone have experience·running stepper drives with a BS2? I have a project·where I want to use a couple of stepper motors. I found a drive module referenced in another post, a Gecodrive. The drive only needs two inputs from a BS2 (I think) which will be way easer than building an H bridge and trying to make it work right. One is a direction signal and the other is the step pulse. The literature for the module says it's rated for up to 200khz and that it triggers on the trailing edge of the step pulse. Does that mean that I send a command frequency·of between 0-200khz·to the step pin and the motor "steps" at·a given·speed?· I assume that the direction pin changes direction by changing it from high to low. This seems just a little too easy. What am I missing? Do I need to ramp the stepper up/down, if so how should I do that. Possibly with PWM?
Thanks
Thanks
Comments
I noticed the chip got very hot very quickly, so the motor might be drawing more current than the chip can handle. That's my buest guess. I don't have the spec for the motor and I can't find it. I noticed that the motor would jitter a lot, and not really run properly, so I tried changing the coil connections, and BOOM.
To answer your question. You don't need PWM. Stepper motors work by supplying current to the coils in succesion. The rate at which you do this (frequency) determines the speed of the motor. See attachment.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't worry. Be happy
Depending on the speed you need to operate the motor at, plus the load that will be present on the motor, you may or may not need to ramp it. A stepper cannot start out with you giving it maximum speed (pulses on the step pin). You must ramp to maximum speed, although there may be some smaller motors that are exceptions. Ramping is a function of how closely spaced the pulses are (steps). To ramp or decel, you simply change the rate of the steps incrementally.
An example of ramping is (generic)
i = 30000
loop
'turn on step pin
'wait for a short time to set the time ON (fixed pulse width)
'turn off step pin
pause = i 'wait for a time to set the speed of the motor
i = x - rateToIncrease ' the pause gets shorter each pass, causing the motor to speed up due to faster pulses
To decel, simple start out i as 0, and add to it each time. To set a maximum speeds, you limit how low i will get.