Stepper motor braking - need to understand!

Thread Starter

YorkshireDave

Joined Jun 12, 2016
59
A pal of mine has cobbled together a stepper motor, motor drive controller PWM generator (MKS OSC) & st-4045-a1 stepper motor driver. He can make it go back and forth but he's unable to make it brake or freewheel.

From some things I've seen, it appears (based on my probably incorrect interpretation of a Chinglish write up) that the enable/disable function has three states +5v for enable, 0v for freewheel & -5v for brake. The fleabay item number (293499193226) is the PWM controller. This link is for the controller

Has anyone any idea a: if my theory is correct and b: how one might achieve it given that its power comes from a switched mode supply with just +5v, +12v & 0V!
 

Alec_t

Joined Sep 17, 2013
14,280
It's anybody's guess exactly how that fleabay controller works, but motor drivers these days typically comprise at least one H-bridge of power MOSFETS. Depending how the individual MOSFETS are switched they can, with a uni-polar power supply, drive current one way or the opposite way through a motor coil (forward/reverse), drive no current at all (freewheel), or short-circuit the coil (braking).
 

shortbus

Joined Sep 30, 2009
10,045
This link is for the controller
That was a link for the stepper driver not a controller. A driver allows the stepper to actually work, a controller tells the driver what to do.

I may be wrong, but have never seen a driver that allows braking. The braking Alec refered to can't be done using these drivers, because only one direction can be chosen at a time by the "DIR" input. The freewheeling will never be like a regular DC motor, it will have a slight "cogging" feel to shaft rotation, because of the magnetic interaction between rotor and stator of the motor.

Those divers are only expecting a positve voltage or no voltage on the control inputs. The optoisolator inside wanys to see 5VDC, but more voltage can be used by adding an external resistor, the little box at the lower right corner tells what resistor to use for different voltages. And that resistor must be used with a voltage of over 5VDC.

The "ENA" means, enable. this allows the stepper to stop moving without turning off the pulse stream from your speed control. I guess you could use it for your 'freewheeling' too.

Almost every stepper driver today use a similar control input like that one. Just make sure to set the amperage dip switches to match your motor, and you will get better overall performance by using voltage close to the high side of the allowed range. Many use a 32VDC for power.
 
Last edited:

MaxHeadRoom

Joined Jul 18, 2013
28,617
When using Stepper motor drives there should be a setting that depends on the inductance of the motor in order to calculate the Maximum operating voltage used on the drive.
When controlled, the label current of the motor should never be exceeded, and remain Constant.
The higher voltage is used in order for the drive to maintain this constant motor current due to the motor inductive reactance change with RPM.
For more info on this, there is Info pages on the Gecko Stepper site.
Max.
 

Papabravo

Joined Feb 24, 2006
21,157
There is no need to "brake" a stepper motor. If you stop sending pulses, the driver will hold it's last state and the rotor will be locked in the position dictated by which coils are energized. As long as the power is on and at least one coil is energized, there will be a defined position for the rotor.
 

Thread Starter

YorkshireDave

Joined Jun 12, 2016
59
There is no need to "brake" a stepper motor. If you stop sending pulses, the driver will hold it's last state and the rotor will be locked in the position dictated by which coils are energized. As long as the power is on and at least one coil is energized, there will be a defined position for the rotor.
Papa thanks. I think I get that. So 5v out on the enable line enables it to move and holds it in its position till the PWM output drives it forward or backwards.
Ok a seemingly silly question. How do you then set it to be 'free wheeling'? Do you simply remove the 5v from the enable line or is it something else? What actually happens when you remove that +5V?
I apologise for my simplistic view.
 

BobTPH

Joined Jun 5, 2013
8,804
I would think setting enable to low would disable the power to the stepper, and thus make it freewheeling, but who knows what this controller might do?

Bob
 

Papabravo

Joined Feb 24, 2006
21,157
Papa thanks. I think I get that. So 5v out on the enable line enables it to move and holds it in its position till the PWM output drives it forward or backwards.
Ok a seemingly silly question. How do you then set it to be 'free wheeling'? Do you simply remove the 5v from the enable line or is it something else? What actually happens when you remove that +5V?
I apologise for my simplistic view.
Even with no power the rotor will not rotate freely. You have to do work to get the rotor to move against the stationary coils. If the coils are shorted it is near impossible to turn the rotor by hand.
 

MaxHeadRoom

Joined Jul 18, 2013
28,617
Steppers have two torque ratings,
Holding Torque: With the motor shaft at standstill (zero rpm) the amount of torque required to move the shaft of its holding position when the rated current is applied.
Residual Torque: The torque present at standstill, i.e power OFF and the torque required to move the shaft from its stationary position.
Max
 
Last edited:

shortbus

Joined Sep 30, 2009
10,045
There is no need to "brake" a stepper motor. If you stop sending pulses, the driver will hold it's last state and the rotor will be locked in the position dictated by which coils are energized. As long as the power is on and at least one coil is energized, there will be a defined position for the rotor.
That may be so on some high end drivers, never had one. But the one like he showed dosen't do that unless the ENA is on and you shut down pulsing. But most don't do it that way, because starting up the pulses take longer than the ENA part of the driver. Most times you leave the pulse running and stop movement with the ENA. Because the speed is already set.That way you can change direction or just start movement with an instantaneous result.
 

Papabravo

Joined Feb 24, 2006
21,157
That may be so on some high end drivers, never had one. But the one like he showed dosen't do that unless the ENA is on and you shut down pulsing. But most don't do it that way, because starting up the pulses take longer than the ENA part of the driver. Most times you leave the pulse running and stop movement with the ENA. Because the speed is already set.That way you can change direction or just start movement with an instantaneous result.
Running at a constant speed was never really an option. We would ramp the velocity up, run a maximum speed, and then ramp the velocity down, and we didn't even use pulses, just controlled the coils directly. The lowest speed was so slow there was never a need for "braking", we just stopped changing the state of the drive transistors.
 

Thread Starter

YorkshireDave

Joined Jun 12, 2016
59
Running at a constant speed was never really an option. We would ramp the velocity up, run a maximum speed, and then ramp the velocity down, and we didn't even use pulses, just controlled the coils directly. The lowest speed was so slow there was never a need for "braking", we just stopped changing the state of the drive transistors.
Hmm. So, as I said, this is for a pal who wants to move to CNCing his milling machine table. Can anyone suggest a suitable resource so he can complete his project now we're locked down for 3 more weeks? He uses a Macbook btw & has had trouble talking to his arduino.
 

shortbus

Joined Sep 30, 2009
10,045
I haven't been there for a long time but like Max said earlier Gecko Drives used to have a lot of information on this. But their drives are slightly different. https://www.geckodrive.com/support.html

CNCZone is also good. https://www.cnczone.com/

Again been a long time since looking into this but what else is he using to interface from his Macbook to controlling the mill? You used to need a software program, and most of them didn't work with Mac.
Another good one or it used to be. https://www.cnccookbook.com/cnc-software/
 

shortbus

Joined Sep 30, 2009
10,045
Running at a constant speed was never really an option. We would ramp the velocity up, run a maximum speed, and then ramp the velocity down, and we didn't even use pulses, just controlled the coils directly. The lowest speed was so slow there was never a need for "braking", we just stopped changing the state of the drive transistors.
So you didn't use any kind of stepper drivers? There had to be some sort of pulses some where in the mix, that is what tells the transistors when and how to control the motor coils. And how fast to do it, faster pulses means faster speed.
 

MaxHeadRoom

Joined Jul 18, 2013
28,617
Hmm. So, as I said, this is for a pal who wants to move to CNCing his milling machine table. Can anyone suggest a suitable resource so he can complete his project now we're locked down for 3 more weeks? He uses a Macbook btw & has had trouble talking to his arduino.
For CNC, One of the best for product and support is Gecko Stepper Control, has a large following by many in the DIY arena as shown in the CNCzone forum.
Max.
 

Papabravo

Joined Feb 24, 2006
21,157
So you didn't use any kind of stepper drivers? There had to be some sort of pulses some where in the mix, that is what tells the transistors when and how to control the motor coils. And how fast to do it, faster pulses means faster speed.
That is correct -- there were no pulses. There was a Z-80 processor that had a timer based state machine, each time the timer expired, the output changed to the next half step value. Up, down all around the town. BTW - this was before there was such a thing as a stepper driver chip.
 

Papabravo

Joined Feb 24, 2006
21,157
Hmm. So, as I said, this is for a pal who wants to move to CNCing his milling machine table. Can anyone suggest a suitable resource so he can complete his project now we're locked down for 3 more weeks? He uses a Macbook btw & has had trouble talking to his arduino.
In order to be able to control the velocity of the stepper with a pulse train you have to be able to change the frequency. I would say you need about 25 discrete velocities that you can use to accelerate, run and decelerate.
 

MaxHeadRoom

Joined Jul 18, 2013
28,617
Hmm. So, as I said, this is for a pal who wants to move to CNCing his milling machine table. Can anyone suggest a suitable resource so he can complete his project now we're locked down for 3 more weeks? He uses a Macbook btw & has had trouble talking to his arduino.
I assume the mention of the Arduino was just an aside?
What CNC software does he intend using? Mach3?
Not sure if there is a Mach version for Macbook however.
As I mentioned, there are many hundreds (thousands?) that have gone through this in the Zone forum.
Max.
 
Top