Lockin Spin for Motor Stall

Hi!

I am currently using an ODrive S1 in sensorless mode. Speed control works well, but now I also want to be able to stall my motor. This post seems to point towards the LockinSpin mode to achieve this.

I tried to find more information about this mode, and from what I understand, here’s the step I need to follow:

  1. Set LockinConfig current to the desired value.

    odrv0.axis0.config.general_lockin.current = 5 # A
    
  2. Request motor calibration and then lockin spin.

    odrv0.axis0.requested_state = AxisState.MotorCalibration
    odrv0.axis0.requested_state = AxisState.LockinSpin
    
  3. Set input velocity to 0.

    odrv0.axis0.controller.input_vel = 0 # turn/s
    
  4. Request idle state to stop.

    odrv0.axis0.requested_state = AxisState.Idle
    

Will this procedure work? Is it required to set the input velocity to 0?

Do you have any suggestions for the current required to resist to external forces? It doesn’t need to stay at a specific position, I just don’t want my motor to spin freely.

Thanks,

William

Hi! You currently can’t control lock-in velocity from input_vel. You’ll have to modify general_lockin.vel and then put it in lock-in spin – it only updates the parameters upon entering closed loop control, so it can’t be changed in real time.

Yes, this will do a decent job locking it.

Setting general_lockin.vel was the parameter I was missing. Concerning the current, is it the one going to the motor, or the one provided by the bus? I tried to play with the parameter, but the values don’t match. For example, I observed the following ibus values:

  • 1.15 A @ general_lockin.current set to 25
  • 2.40 A @ general_lockin.current set to 40
  • 2.65 A @ general_lockin.current set to 50
  • 2.65 A @ general_lockin.current set to 100

I need to do some more tests to see which config is best, my goal is to keep my fan at 0 RPM even with external forces. The last problem remaining is to get it to stop when already turning, any suggestions?

Thanks!

The current isn’t the same – bus power == motor power, but the ODrive “steps down” the voltage as a property of how motor control works, so motor voltage < bus voltage, motor current > bus current, and motor voltage * motor current == bus voltage * bus current.

Happy to do a better job explaining tomorrow - here’s a good article on it though:

What motor are you using? The S1 will limit the current to around 40-80A depending on your DC bus overvoltage trip threshold (see ODrive S1 Datasheet — ODrive Documentation 0.6.9 documentation). But that 40-80A figure may be massive for your motor, depending on which it is.

To stop when turning, I’d set the velocity as low as it can go while maintaining good sensorless control (usually a few hundred RPM), then set to idle and immediately set lock-in spin with a vel of zero.

Overall though, I’d maybe just recommend using an encoder :slight_smile: may I ask why you aren’t able to for this application?

Great blog post, lots of information.

I am working with a Delta PAG fan which is rated 26 A @ 13 V. I don’t know the motor constant (Kv), but I was able to achieve better performance than the original controller (lower current consumption since we use 28 V with the ODrive for the same RPM).

If the motor is spinning too fast in idle, is it possible to make it stop by increasing the lockin spin current? I seem to get the 4096 error if the motor hasn’t slowed down enough. This is also a problem if I try to go into closed loop.

We will definitely include an encoder in our next version! It will simplify a lot of the problems we have with sensorless right now, but it requires several changes to our design.

Quick question, what is the maximum operating temperature of the ODrive S1? I have the heat spreader plate, and the specs says that the board is able to output 40 A continuous with this configuration. In lockin spin, I feel like more heat is generated since the current goes only through one phase.