Phase-Locked Motors

Hello, this looks a terrific solution for BLDC motor control! I have an application where I need to run two motors at constant speed (of 10 and 15 Hz, say), while maintaining a fixed phase difference between them. I was hoping it might be possible to lock each motor to a well-defined external reference signal, using a phase-locked loop. Is this possible with SimpleFOC? Any advice would be much appreciated.

Thanks and best wishes

John

Hi @John_de_Mello, and welcome to SimpleFOC!

It sounds like an interesting problem, but I haven’t really understood you too well…

If the motors are going different speeds, how can they stay phase locked?

Or is the aim to run them at different speeds, phase-locked to a reference, but not each other?

In any case, closed loop speed control is already possible with SimpleFOC, it’s a PID based solution.

I think it would be quite possible to sync the speed to an external reference signal.
It could also be done with the position control mode.

Wouldn’t that be similar to Step-Dir control, actually?

Hi Richard

Many thanks for the reply. Yes, it’s a slightly unusual spectroscopic application, where I need one motor to execute 1.5 revolutions for every complete revolution of the other motor.

To give a concrete example, I was planning to derive two phase-locked external reference signals of 15 Hz and 10 Hz from a master clock signal, running at 30 Hz. I then hoped to phase lock one motor to the 15 Hz reference signal and phase lock the other motor to the 10 Hz reference signal.

If SimpleFOC allows for phase-locking to an external reference signal, then using the above approach it should be straightforward to ensure a constant phase difference between the two motors.

I’m a newcomer to SimpleFOC, so I’m not completely familiar with how it operates. For the planned analysis, I need the rotation speed to be constant (rather than steplike) so I imagine this might prevent the use of the position control mode? However, I could imagine it might be possible to modify the PID controller in the speed control mode to include a phase-locking term. Is this what you were suggesting? Any advice on how to do this would be really appreciated!

Thanks and best wishes

John

Hi John,

I was thinking more about it yesterday… I think it should be quite possible.

The closest we have to this at the moment is the StepDirControl - intended for stepper motors, that’s a common interface for controlling 3-axis machines and similar. Conceptually, the motor’s position is driven by the step signal, with each impulse advancing the motor one step (or micro step, depending).

You could do something similar quite easily using your clock signal:
in open loop mode, use the motor.setPhaseVoltage() to advance the motor by a fixed amount of radians for each clock impulse. Basically add a fixed amount to the motor’s electrical angle each time. (See our motor alignment procedure in the BLDCMotor class for an example of this).

In closed loop position mode, you can do the same thing with the target value of the position PID controller.

→ but these solutions will have the “step-like” motion you don’t want, but if the steps are small and fast enough it might not matter?

Alternatively, you could run the motor in closed-loop velocity mode, and basically put a PLL on top of the velocity controller.
I guess there’s several different ways to do it - but at the core you’d compare the actual rotor position to the expected rotor position after N PLL clocks, and use the difference to adjust the target value.

Depending on the accuracy and precision needed there’d be some fairly fancy ways to do this. I’m thinking for example of using an ABZ encoder, with MCU hardware support (which we have on STM32) and then doing the PLL based on the MCU’s timer/counters. ABZ drivers one counter, the PLL clock drives another, and the PLL could be super-precise with this kind of setup.

But TBH I’d try something simpler first, and see if it doesn’t just work for you. A SimpleFOC main loop typically runs at 2kHz or more, which is quite fast enough for many control applications.

What kind of precision / tolerances are you aiming for?

Hi Richard

Many thanks for the suggestions. I think you’re right - it makes sense to try (closed-loop) stepping first, and only move onto a PLL-based approach if it’s necessary. Does a BLDC motor stepped in this way perform similarly to a micro-stepped stepper motor or are there obvious differences? (I’ll be using hollow-shaft gimbal motors with very light load).

I don’t know the necessary tolerances, I’m afraid, so it will just be a question of trying it out on the final measurement to see if it’s good enough. It’s good to know that I should be able to swap to PLL if the need arises.

Best wishes

John

To be honest, I almost never use steppers so I don’t know :grimacing:
But perhaps someone else here in the forum knows more about it?