FOC with 50pp stepper kills encoder precision by factor 50

this is my first posting here. I am an IT engineer which does some work on electronics also, partly hobby, partly for innovations at work. I have a working stepper FOC prototype with current sensing and magnetic encoder (AS5147, max. 14bit). The stepper has 50 pole pairs. The software I use is called SimpleFOC (https://www.simplefoc.com/) I stumbled over a fact which might kill using FOC on steppers for precise position applications completely. As the SimpleFOC project focuses on BLDCs, I could not get a sound answer on it. I quote here from a Master thesis at https://odr.chalmers.se/bitstream/20.500.12380/300460/1/Master_Thesis_Michael%20Marne.pdf 2

“PMSMs with a large number of poles (as most stepper motors are) are a challenging motor type for applying FOC due to the reduction in electrical rotor angle accuracy from the fact that the angle sensor measures mechanical angle which is divided into electrical angle”.

Both sources don't tell what the final implication is on low speed, positional precision focused applications, as this was not their primary object of research.

As a standard 1.8deg stepper has 50 pole pairs, one physical revolution equals 50 electrical revolutions. As the encoder measures the physical angle, e.g. with 12bit resolution, but the calculations are done on the electrical angle, the measurement is transformed from the static coordinate system into the rotating system and the resolution of the encoder is divided by the pole pair number, thus 50! Thus you lose 5-6 bits! motors with a low pole pair count don't suffer that much here. As I try to use FOC+stepper in a CNC scenario, the goal is to get better and repeatable closed loop position quality compared to open loop micro stepping.

Does this mean that FOC for steppers is pointless in principle when you don’t attach extremely expensive high-resolution optical encoders?

I know that there are industrial applications where closed loop algorithms are used on steppers. How does industry handle this resolution problem? Are the not using FOC? If not, what else? Or do they use 1000$encoders because costs don't matter? • actually 1.8 deg = 200 steps / rev Dec 5 '21 at 16:01 • Welcome to the EE Stack Exchange. It is not a particularly well-written question. Please ask a more specific question. Including a schematic will probably get more focused replies. After informing potential respondents about a master's thesis and a software, you asked "how do they handle the resolution problem?" which is a broad general enquiry. I recommend that you edit your question further. Thanks. – Syed Dec 5 '21 at 16:07 • You could look at sensorless FOC techniques. Because that uses the motor currents and voltages in place of the sensor it is naturally based on electrical angle giving you the resolution you need. But steppers aren't usually driven via FOC but open loop. Either way you probably want an optical sensor to crosscheck, i.e. to resolve the ambiguity between electrical and mechanical angle. IMO could end up a meaty research project. Dec 5 '21 at 16:08 • IMO the best information on Steppers is here: academia.edu/25552583/… FOC will not achieve an increase in accuracy if you have a geardown ration ( belt or gears) between motor and effector endpoint. Best accuracy gain is to put the position sensor at the endpoint (linear sensor) so that all the driving backlash is included. The ultimate aim is to increase the 'stiffness' of the CNC endpoint. If you expect the motor driver to recover the correct position (lost pulses) you have already destroyed your surface finish. Dec 5 '21 at 18:51 • If you want a cheap solution to you can buy servo based stepper motors. Clearpath are one example of a readily available solution: teknic.com/products/clearpath-brushless-dc-servo-motors/… Dec 5 '21 at 19:04 4 Answers Another thought that may be an answer from a different angle (no pun intended). High encoder resolution is meaningful for the mechanical purposes, meaning you need it for rotor positioning. For FOC you simply need to have a more or less accurate sine waveform, which is easily achievable with 100 points, just look on a chart in excel. In fact, even 16 is not too bad 8 looks recognizable, but probably will cause noise in the loop. So the bottom line is a 4000 counts encoder is great for this application, but on several conditions, that i am not allowed to disclose :) sorry, trade secret. • So 4000 counts would be enough for a dynamic system, e.g. at constant speed. But for a static system, for exact positioning, how much more resolution I need ? Dec 7 '21 at 17:36 • Define exact :) for an awful lot of systems 4000/revution is great. For others you get 20bits. – TQQQ Dec 7 '21 at 19:43 • exact in my case means: limit the bounce in position at speed=0 to less/equal than 0.225degrees. This is what I get in theory from 1600 microsteps/round. Dec 8 '21 at 8:01 • So microsteps don't guarantee the exact position. Even though there is always current, it only creates torque wen the rotor is moved. In this sense it's not too different from a servo. For your system i would take a 2500 lines per revolution encoder for starters. You get 8 counts for your delta, for a well tuned servo should not be a problem to hold tight. – TQQQ Dec 8 '21 at 11:53 • sorry, don't get it - 360degrees / 2500 = 0.144degrees - that would make 2 counts for 0.225degrees. And what about the factor div 50 (for 50 polepairs), when the measurements are transformed by Inverse-Park into the rotating electrical coordinates ? That is the core of my initial question. Without that, I'd had plenty of lines/round with my 14bit AS5147 encoder. Dec 8 '21 at 13:03 Fractional N Stepper motors use 1.8 deg per step for 200 steps per revolution or 400 half steps or 800 quarter steps. Using a sine modulated N fractional stepper which uses PWM to interpolate the voltage, one can easily obtain N= 2 to 64 x higher resolution, but the position error depends on load torque. Thus measuring the phase of the normally inductive current, one can transform the real current induced by torque load into a position and thus using fancy matrix algorithms correct the error using FOC. Does this mean that FOC for steppers is pointless in principle when you don’t attach extremely expensive high-resolution optical encoders? No, but you do need to measure motor impedance accurately with added viscous thin rotary damper wheels, if you want to reduce resonance-induced problems. Anecdotal I didn't read the thesis, but I had no problem designing a stepper servo 1.1 m square gantry move at > +/- 1m/s using 8 mm belt and ~14 mm D pulley using the right tools with no load except gantry friction and inertia. This translates into 1m/s / 44mm circumference = ~ 23 rev/s second x 200 steps/rev = 4600 steps/s using 10 us step pulse to an Arduino CNC shield with max acceleration and max velocity controls to prevent slippage. With added drag and inertia, this must be reduced significantly. • I don't get the point about measuring motor impedance (R+L) with damper wheels. For me R+L are given by the motor's spec - in my case 1.3Ohm and 1.8mH. Dec 5 '21 at 16:59 I read your posting only half the way, finding you are a bright engineer, more on software, more on application side, and trying to use what's out there. I may not be answering, for I am not yet in agreement with FOC for stepper motor. I admit that my knowledge is marginal, experiences are long ago. So, I am just writing an opinion here, due to the limited space for the comment. IMO: Though stepper motors are BLDC motors, the construction of the motor is different from 3 phase BLDC motors. The main thing is: FOC, especially DQ is FOCused on sinusoidal drive signal with feedback (closed-loop, phase and current). Though, interpretation of the phase angle might help synchronous motor and stepper motor control, it usually is not necessary (open-loop). That is because, synchronous motor and stepper motor can be driven without knowing the phase angle every moment, but the mechanism drives to the angle at the command signal. In order to control stepper motor in finer than a single step, micro stepping method is used along with a motor designed to do so. Edited, I will continue in the IMO mode: As I try to use FOC+stepper in a CNC scenario, the goal is to get better and repeatable closed loop position quality compared to open loop micro stepping. 1. In theory, micro stepping can go as fine resolution as one wishes, and as long as the mechanical tolerance meets the accuracy. Manufactures specify (IIRC) the micro step resolution, and I guess the limit comes from the mechanical tolerance. 2. Closed loop can be achieved, regardless of any motor type. However, the design of stepper motor is not intended for position "feedback" control in mind. It is intended the position to be deterministic, as long as the device is used as it was to be. 3. The stepper motor you choose almost already decide what you can get for the positioning. 4. Feedback control doesn't necessarily always provide better resolution, unless the process is designed so as well. A linear motor is a better solution if feedback control is desired due to the "continuity" of the control loop response. 5. As in "1.", stepper motor can be almost linear motor, so can consider placing it in the feedback control loop. But, what advantage do you get, except the higher cost. 6. Stepper motors' are different from linear motors, and has the value,for it can be driven to a deterministic position without feedback, and the capability of the stronger rotter locking force, but not by any inherent accuracy that depends on how it is controlled or how it is used. 7. Only what I can see the advantage of position feedback with stepper motor is, aside the origin detection, detecting mechanical error, when the stepper motor did not go to the commanded step, likely from overload or loose tolerance. This case, controlling the position back to in tolerable accuracy is meaningless or more costly effort than having a better mechanism. I forgot where this part belongs, will just continue: divided into electrical angle” Yes, FOC uses electrical angle as it is well explained in "DQ". FOC can estimate/predict every finest angle, based on rough encoder reading. If you read more attentively about FOC/DQ, you will realize that FOC/DQ is an approach for a "Dynamic" system. That is the fundamental difference with stepper motors, since stepper motors are structured for static (locking) operation. Again, however finer angle resolution from the FOC algorithm library, it is for dynamic system. Does this mean that FOC for steppers is pointless in principle when you don’t attach extremely expensive high-resolution optical encoders? Attaching extremely expensive high-resolution optical encoder does not give advantage of extremely high resolution feedback control. Pointless. I know that there are industrial applications where closed loop algorithms are used on steppers. Sorry, I have come to far off at this point. :) I sincerely apologize for my loud voice, and please, please, let me know if you find anything about it. How does industry handle this resolution problem? Are the not using FOC? If not, what else? Or do they use 1000$ encoders because costs don't matter?

FOC has its use, but may not be of accurate CNC with stepper motor. The first thing is the mechanical tolerance, in order to get accurate positioning. Stepper motor, if used, resolution can be further scaled using levers and gears. If high resolution position encoders are used, I would imagine, linear motors can provide better control response, while moving the cost from high priced stepper motor to the encoder.
One more, Linear position encoders are better used for CNC, I think, than angular ones.

• as my comment is too long, I paste the whole story as answer. Dec 5 '21 at 18:00
• @husky - You are not allowed to post a comment as an answer. If you have new information, you can edit it into the question. If you want to chat with jay (and if they also want to), then I can create a chatroom for you (and give you suitable permission in it, as you currently don't have enough points to use chat without moderator help). However, as I said, one thing you must not do is post anything except an answer, in the box labeled "Your Answer" below. And since you asked the question, there are very few situations when you would also write the answer, unless you solved your own problem. Dec 5 '21 at 18:18
• @husky - As I explained, non-answers are not allowed in the "Your Answer" box, so your non-answer has been deleted. Your two choices are explained in my comment above. I see that you are new to Stack Exchange (SE), so please read the tour and at least the "Asking" and "Our Model" sections from the help center, to get some information about how SE rules and etiquette differ from typical internet forums. Thanks. Dec 5 '21 at 18:31
• Sorry @husky, I read more, and I guess what you tried to ask. I was just reiterating your question, I see it now. I am adding the answer part, soon. Meanwhile..Thanks Sam!
– jay
Dec 5 '21 at 20:38
• Wow that's a long answer to a long question...
– TQQQ
Dec 5 '21 at 22:47

FOC for steppers is not pointless and exist in at least one application I am aware of. The main thing about it-not any encoder can handle, and those that can - make the system expensive just as a bldc would be. However sometimes it's doable and works really great. Reduces cost and moves the working point to higher torque, which is very beneficial.

Here is an example.

http://www.servotronix.cn/product_category/integrated-stepper-motors/

• Thanks for adding your post. I did not intend a long post, but noticed the comment later that the OP was trying to ask questions:-) Meantime, it makes sense, "improving torque" by feedback & DQ, benefits from the holding torque: "servo at the price level of a stepper", thus eliminating the servo mechanism. Question: if you would read the OP's question, Can it improve the resolution like "extremely expensive high-resolution optical encoders"?
– jay
Dec 5 '21 at 23:13
• I am not sure what are you asking. But since i personally explored this topic really deeply, i can tell you that it's not about really expensive encoders. Simply it's about encoders that are more expensive than what makes sense with a stepper. Unless you find the right technology and do a few things in house.
– TQQQ
Dec 5 '21 at 23:16
• I am not trying to argue nor bring you down. I was asking if the control resolution can be improved by FOC, beyond the micro-step resolution. I sincerely curious. As I said, my knowledge is marginal, no way to challenge experts.
– jay
Dec 5 '21 at 23:22
• Ok, now I understand. Alright, so the control resolution like in a stepper is not a thing anymore. Stepper might nominally have microstep resolution of 200*256, but it's anyway not accurate and not really meaningful. With FOC you get the exact resolution of your encoder, but now it's precise. And now you control your torque in a way that allows smooth movement, efficiency and basically all bldc perks.
– TQQQ
Dec 5 '21 at 23:52
• It took me 15 years to start making my own motor, so I sort of guessed you had some prior knowledge ;)
– TQQQ
Dec 6 '21 at 0:45