Sensored BLDC motor in hoverboard / hall cofiguration

I am having trouble making my Castle Creations 1406- 1900kv sensored motor spin with the odrive v3.6 56V. I contacted the manufacturer and got the following information on this motor:

  • pole pairs: 2
  • cpr: 12
  • sensors: open drain
  • power rating: voltage dependent - 180W at 6V
  • max. continuous current: 30 amps

I configured the odrive using the values recommended on the website in the hoverboard / hall section. Below I will walk you through the commands I ran and how the motor behaved throughout.

odrv0.axis0.motor.config.current_lim = 20
odrv0.axis0.motor.config.calibration_current = 10
odrv0.axis0.motor.config.pole_pairs = 2
odrv0.axis0.motor.config.motor_type = MOTOR_TYPE_HIGH_CURRENT`

odrv0.axis0.motor.config.resistance_calib_max_voltage = 4
odrv0.axis0.motor.config.requested_current_range = 25 
odrv0.axis0.motor.config.current_control_bandwidth = 100

odrv0.axis0.encoder.config.mode = ENCODER_MODE_HALL
odrv0.axis0.encoder.config.cpr = 12

odrv0.axis0.encoder.config.bandwidth = 100
odrv0.axis0.controller.config.pos_gain = 1
odrv0.axis0.controller.config.vel_gain = 0.02
odrv0.axis0.controller.config.vel_integrator_gain = 0.1
odrv0.axis0.controller.config.vel_limit = 1000
odrv0.axis0.controller.config.control_mode = CONTROL_MODE_VELOCITY_CONTROL

odrv0.save_configuration()
odrv0.reboot()

Next I calibrated the motor and then had the odrive list out all the data pertaining to the motor. On the website they got the values phase_inductanace = 0.00033 and phase_resistance = 0.17934. Are my values concerning? Could this be my problem?

odrv0.axis0.requested_state = AXIS_STATE_MOTOR_CALIBRATION
   # the odrive beeped

odrv0.axis0.motor
   # phase_inductance = 9.24095
   # phase_resistance = 0.03376

odrv0.axis0.motor.config.pre_calibrated = True

Next I calibrated the encoder and the motor spun in both directions which was encouraging. My offset_float value was almost twice as big as what they had on the website, which is offset_float = 0.5126959

odrv0.axis0.requested_state = AXIS_STATE_ENCODER_OFFSET_CALIBRATION
   # The motor spun in both directions after this command!

odrv0.axis0.encoder
   # offset_float = 0.99989

I then saved and rebooted and tried to run the motor using AXIS_STATE_CLOSED_LOOP_CONTROL. The motor did not spin.

odrv0.save_configuration()
odrv0.reboot()

odrv0.axis0.requested_state = AXIS_STATE_CLOSED_LOOP_CONTROL
odrv0.axis0.controller.vel_setpoint = 120
    # My motor should have spun here but instead did nothing

odrv0.axis0.controller.vel_setpoint = 500
    # Still no motion

odrv0.axis0.requested_state = AXIS_STATE_IDLE

My motor is quite different from the motors typically used with the odrive. Based on the specs of the motor I listed above, should I be configuring the odrive with different values?

Note: I soldered in 22nF capacitors between the A, B, C and ground pins.
Note: I am using the “odrive control utility v 0.5.1” but have not updated the firmware since buying the odrive. the odrive is a v3.6 and came with v0.4.12 firmware. Could this be my problem?

Any help is greatly appreciated! Thank you!

You need to place your motor into velocity control.

odrv0.axis0.controller.control_mode=CONTROL_MODE_VELOCITY_CONTROL

Yes, please try updating your firmware using odrivetool dfu (which will automatically fetch the latest version)
On the newer firmware, you should be setting input_vel, not vel_setpoint.

1 Like

Sweet! Thanks @towen! That worked!

1 Like