# What is the slow speed positional accuracy when open loop?

I’m looking into the idea of using hovoerboard motors to position a CNC machine.

winding a steel rope around the drum instead of the tire, and using a 15 pole-pair hoverboard motor (it has hall effect sensors, but they only produce 90 state changes/rev, so I think I have to go open loop to be more precise than that)

Assuming that I understand how multiple pole pairs work correctly, If I can control the field rotation to about 2.5 degrees, with 15 pole pairs I should be able to position the 125" diameter rim with an accuracy of ~0.2mm (smaller is better, but that’s the worst acceptable performance for this machine)

The motor I’m replacing is a dc motor running through a ~300:1 gearbox and aspires to run at ~20mm/sec (and in practice is unreliable above about half that but has an overkill position accuracy of ~0.008mm), which would be ~18 degrees/sec if I’m doing the math right, and while faster is useful in some conditions, most of the time a particular motor will be moving far slower.

so am I insane to aim for such low speeds and fine positioning with an open-loop configuration? adding an encoder is non-trivial for these motors.

Also, with positioning, is is possible to tell the motor to run slowly in a given direction until the next hall effect transition (trying to use that as a sort of homing stop, getting it to a known field angle)

David Lang

1 Like

I would not say insane, but I am not sure it will work. You’ll have to try… while it will be possible to do the motion slowly in open loop mode, the motor won’t have much torque at all. So it will be a question whether you can drive a CNC, and with how much force, and how bad the problem of skipping commutation steps will be.

I think you’ll find you need closed loop with a sensor, but we won’t know until you try it

You could do this in open loop mode, in theory…

@davidelang

If Klipper integration is the goal. I suppose the timed position is part of the Klipper command, language. Actual position will bind the whole clockwork together with now = position → future = position etc. without it, the machine is blind.

It depends on the cogging behavior of the particular motor. You’ll need to set one up with an encoder and rotate it slowly, plotting the difference between open loop commanded angle and reported angle of the sensor. You might also try giving it some resistance (maybe lift various weights by the cable wrapping technique) and see if the positional accuracy changes significantly.

It will probably work. This is the same as microstepping with stepper motors. My machine has 4mm pitch ball screws and 200 steps per revolution so 0.020mm full step resolution, but with microstepping the usable resolution is much better than that.

@Juan-Antonio_Soren_E klipper is a useful thing on it’s own, and a possible means to the goal, not the goal itself.

@runger how badly do you have to derate a motor’s specs when thinking about open loop mode? In my case, I can roughly predict the force needed, so could, in theory, ramp the applied power up in some areas (not something klipper could do, but if I’m writing my own controller…)

@dekutree64 I was hoping to avoid needing to have an encoder (I was thinking that FOC mode would be pretty accurate), although I guess it’s reasonable to get one for the design/testing work to see how bad the slippage is.

An encoder is just one way to verify the accuracy before investing any more time into it. You could also make a test setup with cable wrapping to lift a small weight, and use a dial indicator to measure the linear movement. Or just take your chances and build the machine Like I said, it will probably work.

If I’m understanding your measurements in the original post, you need the equivalent of 24 microsteps between each position you would get with the hall sensors. But according to the bavaria-direct.co.za winding calculator, 27N30P has 270 cogging steps, so you may only need 8 microsteps between cogging positions.

yes, 8 steps between cogging would meet the minimum requirement.

I do intend to build a test setup, but I wanted a sanity check that I wasn’t being completely insane (pushing the limits and I’ll continue, not a chance and I’ll go back to the approach of trying to 3d print a gearbox to use a smaller, high rpm motor instead)

Printing gear-boxes is pretty hard, and to get CNC level precision, I don’t know if it’s possible. But I think it is possible to make belt-driven systems with decent precision out of 3D printed parts…

I’d do a test with just the motor… I must say I’m more doubtful than Deku on this one - in open loop you really don’t get much torque, esp. at low speeds. And the system will have no way to know when it misses a commutation step. It might decide to grind on a few steps later, or it might take a step in the wrong direction as the open-loop cycles through the commutation pattern.

But setting up just driver and motor is not hard, then you can test it just blocking it by hand and get a sense for the torque delivered. And also you can run it for a little bit with a small load, and see how much heat is developed, because that will be the other problem of running open loop…

why is low speed torque so poor in FOC mode? using the standard BLDC 6-part cycle, and reducing the voltage to slow the speed enough to not generate significant cogging would greatly reduce the torque, but I would expect that using full voltage split between the windings via FOC, the torque would be pretty consistent.

what am I missing?

You can’t do FOC control without the sensor. Open loop control is not FOC…

Open loop control just means commanding a commutation waveform to the motor, and trusting that the motor follows it.
This means the commutation is hardly ever optimal (aligned to Q axis), and there is no way for the system to correct it.

Why the torque is worse at slow speeds, I think someone with better knowledge of the motor physics would have to answer that one.

But the main problem is that without feedback the alignment of the magnetic fields isn’t good so the torque can’t be either.

As I understand it, the worst that should happen is it will lag a few degrees short of the target position, but shouldn’t miss a whole step. In open loop mode, the stator field points toward the target, and with no load the rotor will naturally align with it. But as the rotor approaches perfect alignment, the magnetic force vector goes from tangential (which causes rotation) to radial (which just squeezes the rotor and doesn’t cause rotation). As the load pushes the rotor away from alignment with the stator field, the vector becomes more tangential again and you get more torque trying to correct it. So under load, the rotor will never quite reach the target, and the amount it will fall short depends on the amount of load.

In closed loop mode, the stator field is always pointed 90 electrical degrees ahead of the rotor position, giving 100% tangential magnetic force vector. With open loop that would result in overshooting the target, but with closed loop you can remove the force as soon as the rotor reaches the target.

So in open loop, for example if the load pushes you 15 electrical degrees (1 mechanical degree with 27N30P) back from the target, you will get sin(15)=0.259 or about 1/4 the torque that you would have in closed loop mode. And if it pushes you 90 degrees back, you will get full torque. And beyond 90 degrees, the rotor turns backward and you miss a step.

Is this a CNC router, or a low force machine more like a 3D printer? Running some calculations, I was underestimating how poor the mechanical advantage is with cable wrapping. it probably will be too weak for a router. My little CNC mill has NEMA23 steppers and SFU1204 ball screws, so max linear force is 1Nm * 2pi / 0.004m = 1571N. But a hoverboard motor with cable wrapping around 125mm diameter would only be 5Nm / 0.0625m = 80N. But with only 20N load, it will lag ~1 degree (~1mm) behind the target position.

No, I don’t think so. I’ll be interested to hear @davidelang’s experience, but my prediction would be that in FOC mode, it probably won’t be possible to stop the hoverboard motor by hand. It will be too strong, or at least it will be quite difficult. But in open loop mode it will be easy to stall it by hand.

The moment the motor is stalled, the commutation will just keep going, because there is no feedback to tell it otherwise – and it will keep counting “open loop distance”. So from that moment on, the position will be wrong, and the machine will have “lost steps”…

In open loop if you put low voltage you could, but higher voltage will rip your hands off.

My project is a CNC router, put two motors on the ends of a 10’ board and hang a router between them. https://www.maslowcnc.com/ the current design uses 12v 2a DC motors into a ~300:1 gearbox with a 10mm radius chain sprocket on it and can produce up to ~66 pounds of force (at very low speeds, 20mm/s max, but in practice, unreliable above ~10mm/s)

I hadn’t thought of the problem of open loop letting the magnet align with the field and then produce a small amount of force, that’s a valid issue that means I really do need to get an encoder And it may be that these motors don’t produce enough torque for this machine (I had assumed that a 250w motor would have enough power compared to the small ones

But shouldn’t stall speed be the same for open vs closed loop? If you are putting the same power into the windings and rotating the field, in open loop you will have the same force on the rotor once the magnetic angle gets to 90 degrees as it would have with a perfectly sensored closed loop. There will be ‘springiness’ between 90 degrees and -90 degrees magnetic, but it won’t stall past this unless it would stall a fully sensored motor, right?

I think one misunderstanding here is the difference between commutation and FOC. My understanding of the term is that commutation mode is when you are using the 6-step switching mode, applying a constant voltage for the entire step, jumping between 6 different magnetic field angles. FOC mode is when you are applying power to all three phases simultaneously, continuously varying the magnetic field angle.

In FOC mode, depending on your waveform you can get very close to the same power as constant on, or you can be down as far as 70% of max power (sin wave, space modulation, space modulation with 1st harmonic injection, I haven’t looked to see what simpleFOC uses, I assume it’s on the more sophisticated side or it’s an easy win to add it )

Both of these can be used in open, back EMF, hall sensor or full position sensor mode. (with hall sensors, you don’t have the full angle info, you just get it a few times per rotation, so you have to operation in open loop mode to estimate your action positions between sensor readings)

Are you saying that simpleFOC in FOC mode doesn’t use FOC for open loop operation?

Another open loop question: By default you don’t know the starting position in open loop mode, but I’ve read about ‘high frequency injection’ where you send high frequency, short duration, pulses through each pair of windings and measure the back EMF generated on the 3rd winding and can then map out the rotors position (magnetic position anyway) so that you can start up with the fields oriented correctly and avoid the rotor going backwards momentarily. Does simpleFOC implement this?

Ah, yes, this is then a misunderstanding. I use commutation to mean moving a motor by changing the electrical fields of its electro-magnets… DC motors have commutation, it’s just built-in to the hardware itself.
Commutation can be via FOC, or BEMF-driven 6-step commutation, or other methods.

By FOC I refer to control methods that react to / control the field between the magnets, e.g. need to know the position of the rotor relative to the stator. In effect in SimpleFOC it is the classic Clarke/Parke transforms and controlling voltage or current in the static D-Q coordinate system. We have some details in our docs, and links to other pages and videos on the topic if you’re interested.

A different thing again is the modulation - this can be sinusoidal, or space-vector modulation (with 3rd harmonic injection) or trapezoidal - eg the shape of the waveform used to drive the motor.

And yet another thing is the amplitude (magnitude) of the voltage/current applied via the control method using the modulation.

No, field oriented control is by definition closed-loop, I would say. You need the rotor position as input to the algorithm, although there are advanced methods to obtain it that don’t involve a position sensor/encoder…

SimpleFOC in open-loop mode simply applies a sine-wave (so sine modulation) of a frequency determined by the given target speed, and with an amplitude given by the voltage limit.

By contrast consider closed-loop FOC-mode:

The closed loop sensor-driven FOC control loop will keep the rotor and stator aligned at 90° electrical, while the velocity PID control loop would regulate the voltage to maintain the target speed - in effect you’d get the most torque you can if needed, but only use as much voltage/current as needed to reach the target speed with the given load.

The net effect will be way lower current consumption in most situations, which directly translates into much less heat generated. And also the ability to recover from stalls/slippage due to the sensor.

This is one of the advanced methods I was referring to, and no, we don’t implement it. I’m afraid it would be very MCU and motor-specific, probably require calibration/training and in the end would not be at all simple… so I don’t see us implementing this soon, but if anyone gives it a shot, we would love to hear about it!

2 Likes