Open loop position control ok, encoder ok, but

Hi, I’m using nucleo 64 board(F446RE) with P-NUCLEO-IHM001 board and bldc motor(no name, 14 poles, 12Vdc), encoder is AMT103.

I did rotate the motor using openloop position control of simpleFOC and get encoder data successfully.

But, I can’t run the motor using closed loop position control.

When I run the example code, the motor rotate first time for motor init, and after finish the motor init, motor is hold the position.

The log said that all the init process was success, but no current sense.

  1. Should I need current sensing for rotating with closed loop position control?
  2. On the example(bluepill position control.ino), the line
    motor.controller = MotionControlType::velocity;
    is right???. The name of example seems like run the motor with position control, so I think that MotionControlType should be angle, not velocity.

now, I’m not home so I can’t write this topic with my code, sorry.

Oh. the simpleFOC library is really really grate!!!

Hey @rino,

Nice setup, you should be able to run your motor without any problems.

So if I understood well:

  1. you have tested the open loop and it works.
    TEST: when you set the target angle 6.28 motor does exactly one full turn?
  2. you have tested the sensor, and it works.
    TEST: rotate the motor by hand one full rotation and make sure the sensor output is 6.28
  3. you are in the closed loop control phase, which seems to init well but does not work afterwards

No, no, the code will work without current control as well.

It is true, that is a typo there, it should be the angle not velocity.

But I would suggest you to start with for testing and once you have the motor spinning then go to the angle and velocity:

motor.controller = MotionControlType::torque