Introduction: Position Control of a Brushless Motor With Arduino Uno

an example of position control of a Brushless DC or Permanent Magnet Synchronous Motor.

The goal will be to have a infinite loop with:

  • A spin of the motor from 0 to +50000 pulses with 5000 RPM plus a short wait time
  • Turning back the Motor into -32559 pulses with 1500 RPM of speed plus a short wait time

For this example I’m using:

  • Arduino Uno
  • Brushless Motor as teknic m-2310P-LN-04K This Motor has 8 Poles with an internal Encoder with 1000 physical lines pre-quad, meaning that in 1 turn rotation the motor controller will read 4000 pulses generated by this motor’s encoder in quadrature manner ( 4 times more)
  • Solo Uno as motor controller used as servo drive.

To make it work, I also use the Library for communication between Arduino and Solo, more info here.

Step 1: Schematic

  • The piano switch for Solo Uno is from pin 1 to 5: Up, Up, Up, Up, Down.
  • Correctly calibrated the Encoder with correct connection of the Motor’s windings to ABC outputs of Solo Uno

Step 2: The Code

This is the example file.

Step 3: Conclusion

So, after setting up the essential parameters like the Motor’s number or Poles, Encoder lines and others, in the loop the main code of this example.

It worth mentioning that when Solo Uno is in Position Mode, it counts the pulses in a quadrature manner, so the feedbacks and the references are all in quadrature form, for instance in this example when we ask SOLO to traverse the shaft of the motor into +50000 pulses, if we consider the initial starting point is at zero, we are spinning the motor for (+50000 / ( 10000 * 4)) = 12.5 turns or 4500.0 degrees, so it is possible to calculate the exact end point and provide desired reference to Solo Uno to reach a different goal.