1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. PLEASE: Read the FORUM RULES BEFORE registering!

    Dismiss Notice

Basic CNC

Discussion in 'CNC IN THE HOME SHOP' started by Bill Gruby, Oct 7, 2012.

  1. DMS

    DMS United States Active User Active Member

    Likes Received:
    17
    Trophy Points:
    38
    City:
    Santa Clara
    State:
    California

    -Return to Top-

    I'll give it a shot, but microstepping gets a little complicated. I will have to resort to visual aids.

    Lets start with our software and how it communicates to our drivers (I have, in my previous posts, referred to these as "motor controllers" as well). Most home users are likely going to be using either EMC2/LinuxCNC, or Mach3 running on a PC. The software has to have some way of interacting with the real world, and most commonly that is through a parallel port and breakout board. When you configure the software, you select individual pins on the parallel port, and tell the software what they are connected to (x motor, y motor, z motor, spindle motor, home switches, etc). Motors take 2 pins each, one for "step", and one for direction. "Step" is what we have been talking about in previous posts. Its the pulse that makes the motor go. One pulse (parallel port pin goes to 5v, then to 0) causes the motor to advance one step. The direction pin controls the direction of advance. Nothing to tricky here.

    So what do we need a driver for? First of all, your parallel port is only going to do about 5v at a couple milli-amps, not enough to power a motor, so we need something to boost that power. Secondly of all we talk lightly about "steps", and direction, but there is a lot more going on with the motor than it seems. Let's refer to my visual aid here. This diagram shows simple stepper motor, one that turns 90 degrees per step. In the middle we see the rotor (the thing attached to the output shaft). This is basically a permanent magnet (red is north, black is south). On the outside, we have what is called the "stator" (which means stationary). This is where the coils are. There are two coils, and each coil has 2 ends. The ends of coil one are P1a and P1b, and the ends of coil two are P2a and P2b.

    Full Stepping

    Now that we have that straight, lets get down to business. Recall that the north poles of magnets attract the south poles of other magnets, and repel the north poles of other magnets. Recall also, that if we run a current through the coils of wire in the stator, we are going to create an electromagnet (one pole will be north, the other, south, this switches depending on direction the current flows in the coil).

    In our first diagram, we see the rotor at the zero position. Coil one is energized. When we hit our "step" pin, the driver is going to de-energize coil one, energize coil two. The rotor is now going to be attracted to coil 2, and will rotate 90 degrees. We get another step pulse, and the motor de-energizes coil two, and energizes coil one. This time, coil one is hooked up in the opposite direction of what it was in our zero position. The rotor turns. One more step. Coil 1 de-energize, coil 2 energized in reverse. One last step, and we are back to where we started. If we keep sending pulses the motor keeps advancing, if we change the value of the "direction" pin, the direction will reverse. The driver reverses the direction of the motor by going through the sequence above in reverse.

    Half Stepping

    So that's the basic stuff, but what is this "half step stuff".

    Half stepping is a lot like full stepping. If you look at the second picture, in the second diagram, you will notice that we have energized both coils at the same time (unlike with full stepping, where we only had one active at a time. You will also notice that the rotor is half way between it's normal, 90 degree position (hence the name, half step). Notice that the two poles are both attracting the rotor, and assuming the current flowing through them is equal, they are going to pull with approximately the same amount of force, so the rotor is exactly between them. In this case, we only move 45 degrees between steps, and it takes us 8 half steps to make a full revolution. Otherwise, everything is the same.

    Micro Stepping

    Now that we have covered full and half stepping, micro stepping isn't so bad. It is basically half stepping taken a little further. Imagine that we have a motor driver that can do 10 microsteps per step. Remember when talking about half stepping where I said if we power two coils, and the current in each coil is the same, the rotor goes halfway between? Well, what happens if the currents aren't equal? Basically the rotor will be somewhere between the two, but it will be closer to the pole of the coil that has the stronger current running through it.

    Lets say we start in our zero position, and coil 1 has 10A going through it. If we were in half step, we would leave coil 1 active, and send 10A through coil 2. With microstepping, we are gonna take things a little slower. Instead of sending the full current to coil 2, we will send say, 1 amp through coil2, and while we are at it, we will reduce the current through coil1 to 9A. On our next pulse, coil2 goes to 2A, coil1 goes to 8A. Then 3A and 7A, then 4A and 6A, then 5A and 5A (we're in the middle), etc. Now, instead of taking 4 pulses to do one revolution, it takes us 40.

    Motor drivers are pretty complicated beasts, especially when you get into microstepping, but they are really easy to use. Servo drivers can be a little trickier to use, but I'll leave that for another time.

    stepper_diagram.jpg
     
  2. 7HC

    7HC Active User Active Member

    Likes Received:
    6
    Trophy Points:
    38
    City:
    Tampa
    State:
    Florida

    -Return to Top-

    Ok, that's how the motor works when it's half stepping or micro stepping, and it's interesting to know, but more importantly why do I need to implement it ?
    Is it to to be more accurate, or faster, or slower, or with more or less torque?
    In other words, if I want to move an axis 6" from point A to point B, why would I choose to use less than full steps to get there?


    M
     
  3. HSS

    HSS United States Active User Active Member

    Likes Received:
    8
    Trophy Points:
    38
    City:
    Pine Bluff
    State:
    Arkansas

    -Return to Top-

    This is great info, and much appreciated. If one were to try their hand at building a cnc machine, deciding which motor to use would depend on how much you are willing to invest in the motors, since, I am assuming, one type would be more expensive than the other. Would that be the main deciding factor in the type of motor to use, or are there other factors involved?

    Patrick

    Sorry Bill, I'm not trying to move off topic, but am trying to determine which way to go.
     
  4. jgedde

    jgedde United States Active User Active Member

    Likes Received:
    35
    Trophy Points:
    48
    City:
    Middle Island
    State:
    New York

    -Return to Top-

    As covered above, microstepping is sort of a subset of half stepping. It can be used to acheive greater position resolution, but not without some compromises. Here's a fact list regarding microstepping:

    1) Positional accuracy will be affected by the motor's inhenent detent torque. The detent torque is a sinusoidal function that completes one full cycle for every natural step position. Superimposing this on the ideal microstepping torque vs position yields a distorted position vs step curve for positions in between detents. If the motor has repeatable detent torque cycles, this can be compensated for to some extent by altering the shape of the microstepping.

    2) Microstepping excels at driving loads with resonances at the desired step rates.

    3) Microstepping falls flat on its face when driving loads with a lot of stiction.

    4) Microstepping in a CNC application is best used with a stepper motor having MUCH more torque available than is needed to move the load. The reasons for this are complicated, but has to do with the flux angle vs the rotor's position angle. The motor will not generate enough delta torque between microsteps to actually move unless the load torque is much less than the available torque. This is less of an issue with continuous rotation as inertia helps keep you moving. If the motor is commanded to stop in between detents, it may not start moving again until the motor the commutation waveform yields a flux angle large enough to generate enough torque to overcome the load.

    5) When microstepping, position is held by statically applying voltages to each coil. If power is removed (as with half stepping a motor in between detents) the dentent torque will cause the motor to drive into the nearest detent.

    6) Microstepping waveforms are created by modulating the winding currents with sine and cosine of rotor position between detents. One step equals 360 elelctrical degrees regardless of the motor's inate step angle.

    7) Only bipolar motors are usually microstepped (although polyphase motors also lend themselves well to microstepping).

    John
     
  5. 7HC

    7HC Active User Active Member

    Likes Received:
    6
    Trophy Points:
    38
    City:
    Tampa
    State:
    Florida

    -Return to Top-

    John, I've read and re-read your post but I'm afraid that it it just went to prove that I'm not nearly as smart as I thought.

    I'm ashamed to admit that I have no idea what 'detent torque' is, and knowing that detent torque is a sinusoidal function that completes one full cycle for every natural step position didn't help at all.
    Same goes for the entire content of paragraph four, it left me :headscratch:
    I won't go on because I'm just demonstrating my ignorance, and I'm obviously thinking that 'basic cnc' is much less basic than I'm able to under stand. :confused:

    However, if you or someone else could provide a 'Dummies 101' of when and why half stepping or micro stepping should be used, and what the pros and cons are, I'd be grateful.


    M
     
    sarg likes this.
  6. DMS

    DMS United States Active User Active Member

    Likes Received:
    17
    Trophy Points:
    38
    City:
    Santa Clara
    State:
    California

    -Return to Top-

    Honestly, you don't need to do anything but full step, there are some reasons why you might want to though.

    When you are designing a machine, there are 3 things you are interested in.

    1) Torque - how much load can you move, and how quickly can you accelerate that load
    2) Speed - how fast can you go.
    3) Accuracy - how accurately can I position my tool.

    That's all. There are various ways to get there, but that's really all you care about. As always, there are tradeoffs, lets talk about some of those.

    Torque

    With steppers, you always see motors listed with the holding torque. This is number is mostly useless, unless you are going to be using them as expensive brakes. What you want to look at is the torque curve. This will tell you what kind of torque you are going to have at a given speed. There are two speeds you care about, your cutting speed, and your rapid speeds.

    Speed

    Speed is important, because it determines your maximum feed rate and rapids. The actual speeds are going to depend on how fast your motor can go, and the reduction added by the rest of your drive system (screws, belt reduction if you are using it).

    Accuracy

    Accuracy is going to depend on the motor you are using (1.8deg per step, 0.9deg step, etc), how you are driving it (full/half/micro step), and the reduction added by the rest of your drive system. If you have a 1.8 deg stepper, and are running it with full step (200 pulses per revolution), and have a 1/4 TPI screw, you are gonna have to send 800 pulses to get the axis to move 1 inch. That means you have 1inch/800pulses = 0.00125"/pulse. That is the best you can do for positioning. If you go to half step, it's gonna take 1600 pulses to go an inch, which gives you 0.000625 inches per pulse. I'd be happier with that personally, but you are gonna lose some torque.

    Basically you trade between torque, speed, and accuracy. Using half step or microstepping will increase your accuracy, but reduce your max torque. If your PC can't deliver enough pulses per second, it can also reduce your maximum speed.

    Another thing to think about is that you can switch the mode of the controller once everything is set up. Most people will spend at least a couple hours once their system is together adjusting their max speed, and acceleration to get the most out of their particular machine.

    To address HSS's concerns, I'm not sure what you mean by "type". For steppers, you are basically going to pay more as you get larger and larger motors. When choosing a motor, I would look at other people that have converted similar sized machines, and go with a motor the same size as them, going larger when in doubt. As far as full/half/micro stepping, that is all about the driver, not the motor, and most decent drivers you find will be able to do at least half step, if not micro-stepping. That stuff is usually configurable, so even if you don't think you want to use it, you can play with it to see what effect it has.
     
  7. Bill Gruby

    Bill Gruby United States Global Moderator Staff Member H-M Supporter-Premium

    Likes Received:
    1,825
    Trophy Points:
    113
    City:
    Bristol
    State:
    Connecticut

    -Return to Top-

    John;

    With all due respect to you and the knowledge you have on this subject ( I have followed some of your stuff) I have to agree wilh Mike on this. I can understand most of what you daid but some, like Detent Torque needs to be simplified even more. The use of half stepping and micro-stepping is still beyond my grasp also. Maybe we need to back up a little. At this point I don't even know what to ask to clarify anything.

    "Billy G"
     
  8. 7HC

    7HC Active User Active Member

    Likes Received:
    6
    Trophy Points:
    38
    City:
    Tampa
    State:
    Florida

    -Return to Top-

    Thanks, I'm starting to feel a bit smarter again now. ;)


    M
     
  9. Bill Gruby

    Bill Gruby United States Global Moderator Staff Member H-M Supporter-Premium

    Likes Received:
    1,825
    Trophy Points:
    113
    City:
    Bristol
    State:
    Connecticut

    -Return to Top-

    Not me. The motor moves the tool. The tool is doing the cutting. How do I know how much torque it will take to make that cut? I understand that from this I will know what size motor to choose. I there a formula or something else?

    "Billy G"
     
  10. 7HC

    7HC Active User Active Member

    Likes Received:
    6
    Trophy Points:
    38
    City:
    Tampa
    State:
    Florida

    -Return to Top-

    I don't know if this would work for practical purposes, but I guess you could measure the torque required to make the heaviest cut you're capable of by using a torque wrench to turn the axis while making that cut?


    M
     
  11. jumps4

    jumps4 Global Moderator Staff Member Active Member

    Likes Received:
    181
    Trophy Points:
    63
    City:
    New Port Richey
    State:
    Florida

    -Return to Top-

    setting the best step rate for the normal use of the machine depends on what it is doing. you can set the machine to have really fast rapids and it will have bad vibration at slower cutting speeds. you can set higher microsteps to smooth out slow feeds but the top speed of the motor is much lower. that is why if you can you want big motors to be able to have smooth low speeds and enough torque left to still move at high speed during rapids. i included 2 videos of my machine as i was still trying to work out the proper microstep i needed for the way i will use my machine. the first on is at a half step (400 pulses per revolution)note the vibration but at this setting the mill will move at 200 inches per minute rapids. the second video is set at 5000 pulses per revolution and note how smooth it sounds cutting at feed rate of 9. the mill will now only rapid at 100 ipm any faster and the motor does not have the power it needs and falters missing steps. you can actualy hear your motor missing steps anything that is not a steady humm or buzz is a missed step and recovery.so if it dont sound right it isnt right.

    first run
    [video=youtube;3PXo4sqKEyY]http://www.youtube.com/watch?v=3PXo4sqKEyY&feature=plcp[/video]

    200 ipm listen to the motors
    [video=youtube;1jWF1JW1JnE]http://www.youtube.com/watch?v=1jWF1JW1JnE&feature=plcp[/video]

    my final setting for smooth motion at feed rates
    [video=youtube;DcsYpc4I7mY]http://www.youtube.com/watch?v=DcsYpc4I7mY&feature=plcp[/video]

    steve
     
  12. jumps4

    jumps4 Global Moderator Staff Member Active Member

    Likes Received:
    181
    Trophy Points:
    63
    City:
    New Port Richey
    State:
    Florida

    -Return to Top-

    sorry the last post was so big but i wanted you to be able to hear the sounds
    steve
     
  13. jumps4

    jumps4 Global Moderator Staff Member Active Member

    Likes Received:
    181
    Trophy Points:
    63
    City:
    New Port Richey
    State:
    Florida

    -Return to Top-

    that is a very good question bill i'd like to know the math or what ever is really needed to decide myself
    to tell you honestly my choices were made by watching videos of machines like mine, how they sounded and how fast they would move for the motors they had. i didnt like what i heard or seen so i went bigger. i already had a cnc with too small of motors and wanted to avoid that at all cost even if i had to wait for more money. the small motors work on my sherline but it is always just working on the border of failing and messing up the part.
    steve
     
  14. DMS

    DMS United States Active User Active Member

    Likes Received:
    17
    Trophy Points:
    38
    City:
    Santa Clara
    State:
    California

    -Return to Top-

    If you have never held a stepper motor in your hands and fiddled with it, you may be unfamiliar with detent torque. If you have access to a motor (those of you that don't will have to close your eyes and imagine), pick it up. Hold the motor in one hand, and turn the shaft with the other (no power connected). You will feel a sort of "clicking". The motor won't turn smoothly, it jumps from step to step. The force required to get the motor to move from one step to the other is the detent torque. It starts out high, and as you gets lower and lower, until it hits zero (halfway between two steps). Go a little further, and it starts rising, but it's reversed now, pulling you towards the next step, instead of back to the last. That's what John is talking about. If you power the motor, and turn the shaft (if you can), you will feel this in a _much_ more pronounced way. Basically, the torque is greatest when the rotor is aligned with a pole, this is why you get less torque out of a half or micro step setup.

    As far as measuring the torque, 7HC, you could probably do that, it's probably a pretty tricky setup to do it right. Once you get that number, make sure you use a safety factor, because you never _ever_ want to reach the limit on your torque with a stepper, cause if you do, you're gonna miss step (and that is bad, mmm'kay).

    To BillGruby, I don't know of an equation for motor sizing. This stuff gets pretty complicated, mainly because there are so many things to account for (friction, mass of the moving members, rotor momentum, cutting force on the tool). I've never actually seen an equation or table for the force required to move a tool through a workpiece (I have looked, though not for a while), so I think that is the trickiest part.

    That is why my advice is, copy your neighbor. This is your best bet, unless you are converting a really uncommon machine, especially if nobody has done a conversion on one (or published their result).

    If you really want to try calculating your torque needs, I would do this.

    1) Turn up a disk about 3 inches in diameter, with a center hole that will mount in place of your handwheels.
    2) Mount it on one axis, and wrap a piece of cord around it. To the other end of the cord, attach a small container (small plastic pail, etc)
    3) add sand or shot to the bucket (slowly!) until the axis starts moving (if it sticks somewhere, add more weight till you get past that).
    4) Measure the weight (including the bucket). This weight times 1/2 the diameter of your disk is the torque required to move that axis.
    5) Wind the cord around the disk the other way, and repeat (depending on how worn the screws/nuts are, they may be different).
    6) Repeat on all axes
    7) Take the maximum value you get here, and double it. Then look for a motor that has enough torque to meet or exceed this value, at an RPM that will give you about 100IPM (check the torque curve).

    I think you could do pretty well with this method, but it's not what I used. I basically got the largest servos I could find and went with those ;)
     
  15. jumps4

    jumps4 Global Moderator Staff Member Active Member

    Likes Received:
    181
    Trophy Points:
    63
    City:
    New Port Richey
    State:
    Florida

    -Return to Top-

    missed steps can be real bad, it is not just accuracy problems. say your into the part at some depth the pc thinks the motor made its move on x and it didnt it then moves y for an example at full depth into a location not intended you will remember the sound of your motor grinding to a complete halt or the cutter snapping off, parts flying dislodged clamps screaming belts. this i know how to do well and avoid at all costs lol
    steve
     
  16. jgedde

    jgedde United States Active User Active Member

    Likes Received:
    35
    Trophy Points:
    48
    City:
    Middle Island
    State:
    New York

    -Return to Top-

    OK, sorry about that. I'm so close to it it's hard to step back far enough for it to make sense to someone who isn't a motor guy also. I have had technical discussions with many regarding paragraph four. It's a hard to comprehend topic. What's the worst of all is people who argue that it can't be a problem for their application only because they don't understand it.

    OK, so here's the low down... Ever turn a stepper motor by hand? Notice it doesn't rotate smoothly. It wants to stay in certain discrete positions even though nothing is connected to it. That's detent torque, also known as cogging torque. Some motors are designed to have low or zero detent torque (like servo motors). Some motors are designed to have high detent torque for appliocations where it is desireable to have high holding torque in an unpowered condition.

    Detent torque and microstepping are generally not good friends because the detent torque adds/subtracts (depending on where you are) to the motor's powered torque resulting in less than smooth motion.

    I would say that full stepping or half stepping (as opposed to microstepping) are best for a CNC application as they will yield, by far, the most reliable motion and the most consistent torque output. After all, what good is CNC when you can't count on the tool moving at a desired rate or being in the proper spot?

    John
     
  17. jgedde

    jgedde United States Active User Active Member

    Likes Received:
    35
    Trophy Points:
    48
    City:
    Middle Island
    State:
    New York

    -Return to Top-

    Thanks DMS. I couldn't say it better! My only comment is that detent torque hits a maximum 1/4 of a step away from each detent. It starts low, peaks at 1/4 of a step, hits zero at 1/2 step, then starts to ramp up in the opposite direction until 3/4 of a step, then falls again to zero when you reach the detent. In essence, detent torque is a sine wave between detents. In other words, the rotor will be able to stop wherever there is a position that has zero torque (like a detent). If there's torque, the motor will move until there's no more torque.

    John
     
  18. Bill Gruby

    Bill Gruby United States Global Moderator Staff Member H-M Supporter-Premium

    Likes Received:
    1,825
    Trophy Points:
    113
    City:
    Bristol
    State:
    Connecticut

    -Return to Top-

    Gonna try that method of measuring the torque tomorrow. I will post the results with pictures.

    "Billy G" :))
     
  19. jumps4

    jumps4 Global Moderator Staff Member Active Member

    Likes Received:
    181
    Trophy Points:
    63
    City:
    New Port Richey
    State:
    Florida

    -Return to Top-

    the method described for measuring torque required does work but it is leaving a lot of factors out. for it to really be useful it would have to be done while cutting something hard and deep at a desired feed rate that weighs a lot. it is just figuring what it takes to move the axis nothing else. i'm not trying to correct the information just adding to it.
    steve
     
  20. Bill Gruby

    Bill Gruby United States Global Moderator Staff Member H-M Supporter-Premium

    Likes Received:
    1,825
    Trophy Points:
    113
    City:
    Bristol
    State:
    Connecticut

    -Return to Top-

    I'm going to do it cutting and non cutting Steve. Cutting will be with aluminum and a .040 depth.

    "Billy G" :thinking:
     
  21. jumps4

    jumps4 Global Moderator Staff Member Active Member

    Likes Received:
    181
    Trophy Points:
    63
    City:
    New Port Richey
    State:
    Florida

    -Return to Top-

    your trying it on the lathe for your cross feed mod right?
    that should be a pretty good test
    i'm curious how much it will take myself
    steve
     
  22. Bill Gruby

    Bill Gruby United States Global Moderator Staff Member H-M Supporter-Premium

    Likes Received:
    1,825
    Trophy Points:
    113
    City:
    Bristol
    State:
    Connecticut

    -Return to Top-

    Yup. I want to see for sure what it will take roe a stepper motor.

    "Billy G":))
     
  23. jgedde

    jgedde United States Active User Active Member

    Likes Received:
    35
    Trophy Points:
    48
    City:
    Middle Island
    State:
    New York

    -Return to Top-

  24. jgedde

    jgedde United States Active User Active Member

    Likes Received:
    35
    Trophy Points:
    48
    City:
    Middle Island
    State:
    New York

    -Return to Top-

  25. 8ntsane

    8ntsane Active User Active Member

    Likes Received:
    9
    Trophy Points:
    38

    -Return to Top-

    Bill
    Infro on this page touches base on many of the things in this thread. I thought it might be helpfull to you , and others. If it shouldnt be here, let me know, and Ill delete it.

    http://www.kelinginc.net/index.html
    Scroll down to fundamentals and operation
    Seems like lots of good infro here.

     
  26. 7HC

    7HC Active User Active Member

    Likes Received:
    6
    Trophy Points:
    38
    City:
    Tampa
    State:
    Florida

    -Return to Top-

    I don't see why it should be a problem, Keling motors are widely used, and in fact probably the most common among hobbiests.


    M
     
  27. Bill Gruby

    Bill Gruby United States Global Moderator Staff Member H-M Supporter-Premium

    Likes Received:
    1,825
    Trophy Points:
    113
    City:
    Bristol
    State:
    Connecticut

    -Return to Top-

    Links to info like that are apprciated here.

    "Billy G"
     
  28. HSS

    HSS United States Active User Active Member

    Likes Received:
    8
    Trophy Points:
    38
    City:
    Pine Bluff
    State:
    Arkansas

    -Return to Top-

    DMS, by type, I was referring to stepper vs servo, but since we aren't to servo motors yet I'll wait and keep reading. Thanks

    Patrick
     
  29. DMS

    DMS United States Active User Active Member

    Likes Received:
    17
    Trophy Points:
    38
    City:
    Santa Clara
    State:
    California

    -Return to Top-

    Ah, gotcha.

    Servo's are a bit more expensive than steppers, mostly because the controllers are more expensive, and you have the added cost of encoders, and gearing (you will usually see servomotors geared down because they tend to have lower max torque, but higher (usable) top end RPM.

    The difference is not night and day though. I wen't with servo's for my machine, because I figured, if I was gonna do it, I might as well go all out. The main disadvantage with servos is that tuning them can be really tricky (we haven't talked much about servo's, so we haven't gotten into tuning them).
     
  30. Bill Gruby

    Bill Gruby United States Global Moderator Staff Member H-M Supporter-Premium

    Likes Received:
    1,825
    Trophy Points:
    113
    City:
    Bristol
    State:
    Connecticut

    -Return to Top-

    A myth dispelled, I think. Stepper motors are not in a continuously smooth movement, but in steps as their name says. A DC motor moves smoother but cannot stop on command in a givin position. The increment steps of a stepper motor are so fast that we cannot see the jagged movement. Also they are so fast that the cut is actually smooth. I think I finally have it. Sorry but I have to be thorough.

    "Billy G" :))
     

Share This Page