Stepping up to a closed loop system with a positional feedback.

Hi. I am new to electronics and arduino but learning fast (I think). I already built one small CNC with optical limit switches and steppers controlled through Arduino with grbl and easydrivers in 3 days. I also realize that this is very complex and most of my "achievements" came through stealing other people's codes and following instructions.

Now, I am building a "real" CNC 4' by 4' with real heavy duty stuff and have 1 month to finish it (evenings and weekends). I have two options for setting this thing up - 1) regular open loop with steppers and closed loop with positioning info provided back to the controllers but steppers still doing the movement through PWM.

So, the reason for my question is that I really do now want to bite more than I can chew at my level and here is the ask:

Is the positioning feedback to a controller and PWM for steppers so much more difficult over a regular step/dir control that it is not realistic for a newbee to tackle in a month? The reason why I am asking is because all DYI CNC examples are built based on step-dir but everybody says how awesome positioning feedback would be.

P.S. here is little more info about the "high-end" setup that I am contemplating: steppers driving through PWM controllers and there is an optical sensor that provides closed loop positional feedback to a controller.

The reason for considering this setup is that I have nice set of motors and PWM based controllers link to the manual . I also have couple broken plotters that have long film that, along with a optical reader, provides positioning feedback and wanted to reuse them as well. I will need to figure out how to put these two together and then find a right software to run it.

Yes I would say it is too much to do in a month.

You normally do not drive stepping motors with PWM, that link resulted in a blank page on my iPad so I don't know the driver.

Appart from the awesom aspect ( a much over used word these days ) what advantage do you see it giving you? Traditionally it is used to implement a PID algorithm when using DC motors. All it gives with stepping motors is a check you have not missed any steps by over doing the speed.

Hi Mike, Thanks for the feedback and here is the link to the manual http://motion.schneider-electric.com/downloads/manuals/discontinued_prod/ib462h.pdf and, in case the link does not work again, the model number is ib462h and comes right away in Google.

[u]Here is my limited understanding of "awesome" in this context (besides the skipped step):[/u] Instead of calculating the position based on number of steps, the controller would rely on a positioning feedback and send appropriate signal to the motor. That way, inherently less accurate but much more efficient and faster driver mechanisms (belt instead of lead screw) can be used without loosing accuracy.

You are the second person who says that PWMs do not drive steppers and they only control the current and this is true in 99% of cases. I thought, with certain drivers they did (as input) but... at the expense of exposing myself as a complete dilettante in this topic, here are few assumptions that may be completely incorrect. Actually, it will be ideal if I am completely wrong about this and can use my PWM based controllers with step-dir - then just build a basic set up with my existing parts and move on: OK. here are the assumptions (very much generalized):

[/u] PWM controlled motor can be moved at an accurate speed and very fast and efficiently but one cannot just tell a stepper to move X number of steps. PWMs is (kind of) replacing step input since it is much more efficient and consistent. plus, it can provide high frequency input that is perfectly timed and allow steppers run much faster than what is possible with step/dir. Here is a link to a STK672-110 http://pcbheaven.com/circuitpages/Full_Half_Stepper_Motor_with_STK672/ that gives examples of controlling steppers with PWMs and related searches gave most of the info that fed into my assumptions.

Also, the input specs on these drivers say "clock" and not "step". There seems no way to provide step input:

[u]Here is the verbiage from the STK672 specs from http://pcbheaven.com/datasheet/stk672_110.pdfdescribing the four user inputs for controlling the motor:[/u] CLOCK 9 Reference clock for motor phase current switching Operates on the rising edge of the signal MODE 8 Excitation mode selection CWB 7 Motor direction switching RESETB 6 System reset and A, AB, B, and BB outputs cutoff

[u]And Here is some verbiage from the BI specs:[/u] The Step Clock input is internally pulled-up to +5VDC through a 4.99k? resistor. This input would be used if an external 0 - 40kHz clock input is being used as a motion clock for the IB462H. This input will increment the motor only if the /Start input is in a logic HIGH (internal oscillator stopped) state. The Direction input will function normally.

Instead of calculating the position based on number of steps, the controller would rely on a positioning feedback and send appropriate signal to the motor. That way, inherently less accurate but much more efficient and faster driver mechanisms (belt instead of lead screw) can be used without loosing accuracy.

Sorry but that is not correct, you are talking about a stepping motor not a DC motor. That would be true if you had a DC motor driving a positional sensor and then being geared down to move the what ever. But on a stepping motor it only provides confirmation that a step has taken place.

PWM controlled motor can be moved at an accurate speed and very fast and efficiently but one cannot just tell a stepper to move X number of steps. PWMs is (kind of) replacing step input since it is much more efficient and consistent. plus, it can provide high frequency input that is perfectly timed and allow steppers run much faster than what is possible with step/dir.

Remove the word steppers from that an it is spot on. Put the word back and it is rubbish. Stepping motors work with steps, hence the name, they can not be made to run faster than then can be stepped in any way. Have a read of this about how stepping motors work:- http://www.thebox.myzen.co.uk/Workshop/Motors_3.html http://www.thebox.myzen.co.uk/Workshop/Motors_4.html

Your manual only has one mention of PWM in it and it states:-

The principal function blocks are: a translator which generates the motor phase sequences, a dual PWM chopper circuit which regulates the current in the motor windings and a power stage to drive the motor.

There is no mention about PWM controlling the speed.

You are the second person who says that PWMs do not drive steppers and they only control the current and this is true in 99% of cases.

You are out there, it is in fact 100% of cases. Read this about what PWM actually is:- http://www.thebox.myzen.co.uk/Tutorial/PWM.html

Here is a link to a STK672-110 http://pcbheaven.com/circuitpages/Full_Half_Stepper_Motor_with_STK672/ that gives examples of controlling steppers with PWMs and related searches gave most of the info that fed into my assumptions.

The word PWM does not appear anywhere on that page. What makes you think it is about PWM?

So basically you are mixing up a servo system with a DC motor controlled by PWM and position feedback, with a stepping motor.

PWM is usually a stream of pulses at a constant frequency but with a varying mark-space ratio. The purpose of varying the mark-space ratio is to vary the amount of energy transmitted.

Stepper motors are controlled by a stream of pulses with varying frequency sent to a stepper motor driver. The pulse is normally a constant (very short) width. Stepper motor control signals do not transmit energy.

The stepper motor driver may use PWM internally to regulate the amount of current flowing in the motor coils but that process is invisible to the code controlling the motor.

...R

Hi Mike, thanks again for the help and advice. Here is some other conflicting info - not arguing but trying to figure out what is valid out there.

Grumpy_Mike:

Instead of calculating the position based on number of steps, the controller would rely on a positioning feedback and send appropriate signal to the motor. That way, inherently less accurate but much more efficient and faster driver mechanisms (belt instead of lead screw) can be used without loosing accuracy.

Sorry but that is not correct, you are talking about a stepping motor not a DC motor. That would be true if you had a DC motor driving a positional sensor and then being geared down to move the what ever. But on a stepping motor it only provides confirmation that a step has taken place.

Here is the info from CNC handbook about the closed loop systems with steppers. It just makes sense - controller can send additional signals (steps) to stepper motors based on the positional feedback - just like it would send to any other type of motor or any other kind of "thing" that a controller can control. It should not matter what kind of motor being controlled as long as the controller has this capability to react to a positional feedback. Please see the second subsection from the bottom - http://blog.cnccookbook.com/2014/01/27/ultimate-cnc-mini-mill-steppers-servos-closed-loop-open-loop/. This has nothing to do with electronics, it is just a logic and I respectfully (and strongly) disagree.

[quote]PWM controlled motor can be moved at an accurate speed and very fast and efficiently but one cannot just tell a stepper to move X number of steps. PWMs is (kind of) replacing step input since it is much more efficient and consistent. plus, it can provide high frequency input that is perfectly timed and allow [s]steppers[/s] run much faster than what is possible with step/dir.[/quote]
Remove the word steppers from that an it is spot on. Put the word back and it is rubbish. Stepping motors work with steps, hence the name, they can not be made to run faster than then can be stepped in any way.
Have a read of this about how stepping motors work:-
[url=http://www.thebox.myzen.co.uk/Workshop/Motors_3.html]http://www.thebox.myzen.co.uk/Workshop/Motors_3.html[/url] 
[url=http://www.thebox.myzen.co.uk/Workshop/Motors_4.html]http://www.thebox.myzen.co.uk/Workshop/Motors_4.html[/url]

While there are many drivers that control current with PWM (PWM controlled current drivers such as DRV8825) PWM can also be used to provide pulses to the leads (oversimplifying the language). The Sanyo STK672-110 chip has it in the name (Two-Phase Stepping Motor Driver (Square Wave Drive) and describes the input "clock" as "The input frequency range for the clock signal used for motor speed control is 0 to 25 kHz". this seems very explicit that the PWM is provided to control speed and not the current. There is simply no other pin that could provide a step. Unless I am completely missing something, how does one use this chip with step/dir? Here is the link again: http://pcbheaven.com/datasheet/stk672_110.pdf.

Also, page 14 for the IB462H manual there is a description how waves are used to energize phases to drive the motor (not the amount of current). Again, this seems fairly explicit unless I am completely overlooking something. There is no other pin to provide input for step http://motion.schneider-electric.com/downloads/manuals/discontinued_prod/ib462h.pdf

In the later comments you mention lack of "PWM" wording but the referenced documents describe input in Hz or KHz without saying "PWM" explicitly. Should it matter too much in the context of this discussion?. So, basically, the input the control the movement is some kind of wave in place of step.

With all due respect, but considering there is just too much info that contradicts the statement that 'when using PWM, it helps to control current 100% of cases", it would be fair to raise the question (same goes for not being able to use steppers for closed loop feedback).

Here is the another fragment from Instructables site: "In it's simplest form a PWM square wave can be created with a few lines of code. The following code would produce a signal with a 1 second Frequency and a 10% duty cycle. " http://www.instructables.com/id/Arduino-Hardware-PWM-for-stepper-motor-drives/

Hi Mike, finally got it and thank you for your input. It just helps me to understand in the context of other information. It is semantics (and beyond) and these motors are not controlled by PWM but rather with a series of pulses. They can be controlled by PWM but the motor would only take the frequency into consideration and nothing else.

You are correct about this point but I would still claim the closed-loop stepper issue :)

thanks again.

Closed loop stepper drives do exist but they are really an entirely different animal from a standard drive. My understanding of how they work is that the stepper motor is driven as a high pole-count BLDC motor through some magic known as “phase vector control” (don’t ask me to explain, it’s way above my pay grade!) so the lowly stepper motor actually becomes a true servo motor.
Only recently have they become affordable. Here are a couple of examples:

http://www.evarobotics.com/
From all I’ve read they really are quite good, allowing the motor to run much cooler and smoother with greater resolution.
Having said that, there is nothing at all wrong with standard steppers if they are properly matched to the machine they are driving.
My CNC machine, which I built about 5 years ago, has been running happily and productively with no problems, sometimes for 8 hours at a stretch.
If you really want to improve the performance of your machine I would move away from the GRBL controller (which really is quite amazing since it runs on an Arduino) and step up to LinuxCNC which will give you all the capability you would ever need. It’s free and open-source software which has traditionally required a computer but is now ported to the Beaglebone as well as other small single board computers making it an affordable alternative to GRBL.