ODrive 3.6-56V can't connect to hoverboard motor

Hey all,

I am using an ODrive v3.6 56-Volt driver and have connected it to a 6.5" hoverboard motor as described in: Hoverboard motor and remote control setup guide — ODrive Documentation 0.0 documentation

After running the setup commands listed under ODrive configuration and Hoverboard motor configuration, I am unable to get the motor to spin.

This is the output I get when I run dump_errors(odrv0):

In [24]: dump_errors(odrv0)
system: no error
axis0
  axis: Error(s):
    AXIS_ERROR_INVALID_STATE
  motor: no error
  sensorless_estimator: no error
  encoder: no error
  controller: no error
axis1
  axis: no error
  motor: no error
  sensorless_estimator: no error
  encoder: no error
  controller: no error

I noticed after running odrv0.axis0.motor that I get ‘error: 16777216 (uint64)’ but all else appears to be working.
After running ‘odrv0.axis0.encoder’:

Out[17]: 
calib_scan_response: 0.0 (float)
config:
  abs_spi_cs_gpio_pin: 1 (uint16)
  bandwidth: 100.0 (float)
  calib_range: 0.019999999552965164 (float)
  calib_scan_distance: 150.0 (float)
  calib_scan_omega: 12.566370964050293 (float)
  cpr: 90 (int32)
  direction: 0 (int32)
  enable_phase_interpolation: True (bool)
  hall_polarity: 0 (uint8)
  ignore_illegal_hall_state: False (bool)
  mode: 1 (uint16)
  phase_offset_float: 0.0 (float)
  pre_calibrated: False (bool)
  sincos_gpio_pin_cos: 4 (uint16)
  sincos_gpio_pin_sin: 3 (uint16)
  use_index: False (bool)
  use_index_offset: True (bool)
count_in_cpr: 0 (int32)
delta_pos_cpr_counts: 0.0 (float)
error: 512 (uint16)
hall_state: 1 (uint8)
index_found: False (bool)
interpolation: 0.5 (float)
is_ready: False (bool)
phase: 0.0 (float)
pos_abs: 0 (int32)
pos_circular: 0.0 (float)
pos_cpr_counts: 0.0 (float)
pos_estimate: 0.0 (float)
pos_estimate_counts: 0.0 (float)
set_linear_count(obj: object_ref, count: int32)
shadow_count: 0 (int32)
spi_error_rate: 0.0 (float)
vel_estimate: 0.0 (float)
vel_estimate_counts: 0.0 (float)

I noticed that the phase_offset_float value is 0.0, when it should be 0.5 mod 1. Any help or advice you could provide would be appreciated.

Thanks!

Seems you’re missing a command. Can you paste your startup script?

Having personally used the hoverboard motors, definitely make sure you get the hall effect encoder with capacitors setup correctly. I’ll try and find a link to the individual post that helped guide my through it.

It may seem silly but did you enable closed loop before trying to command the hoverboard motor?

1 Like

This is the link I saw that helped guide me on my journey using the hall effect sensor for hoverboard motors. It’s a great solution.

1 Like

Sure, here is the full sequence of commands (in odrivetool terminal) I ran in order to do the setup and configuration:

odrv0.config.enable_brake_resistor = True
odrv0.config.brake_resistance = 2 # for included resistor
odrv0.config.dc_max_negative_current # verify the correct current

odrv0.axis0.motor.config.pole_pairs = 15
odrv0.axis0.motor.config.resistance_calib_max_voltage = 4
odrv0.axis0.motor.config.requested_current_range = 25 #Requires config save and reboot
odrv0.axis0.motor.config.current_control_bandwidth = 100
odrv0.axis0.motor.config.torque_constant = 8.27 / 16

odrv0.axis0.encoder.config.mode = ENCODER_MODE_HALL
odrv0.axis0.encoder.config.cpr = 90
odrv0.axis0.encoder.config.calib_scan_distance = 150
odrv0.config.gpio9_mode = GPIO_MODE_DIGITAL
odrv0.config.gpio10_mode = GPIO_MODE_DIGITAL
odrv0.config.gpio11_mode = GPIO_MODE_DIGITAL

odrv0.axis0.encoder.config.bandwidth = 100
odrv0.axis0.controller.config.pos_gain = 1
odrv0.axis0.controller.config.vel_gain = 0.02 * odrv0.axis0.motor.config.torque_constant * odrv0.axis0.encoder.config.cpr
odrv0.axis0.controller.config.vel_integrator_gain = 0.1 * odrv0.axis0.motor.config.torque_constant * odrv0.axis0.encoder.config.cpr
odrv0.axis0.controller.config.vel_limit = 10
odrv0.axis0.controller.config.control_mode = CONTROL_MODE_VELOCITY_CONTROL

odrv0.save_configuration()
odrv0.reboot()

odrv0.axis0.requested_state = AXIS_STATE_MOTOR_CALIBRATION

odrv0.axis0.motor

odrv0.axis0.motor.config.pre_calibrated = True

odrv0.axis0.requested_state = AXIS_STATE_ENCODER_HALL_POLARITY_CALIBRATION

odrv0.axis0.encoder

odrv0.axis0.requested_state = AXIS_STATE_ENCODER_OFFSET_CALIBRATION
odrv0.axis0.encoder

odrv0.axis0.encoder.config.pre_calibrated = True

odrv0.save_configuration()
odrv0.reboot()
odrv0.axis0.requested_state = AXIS_STATE_CLOSED_LOOP_CONTROL
odrv0.axis0.controller.input_vel = 2

# motor did not spin, but at some point during the setup I heard a 'click' come from the motor.

Thanks

Awesome, thanks for this advice. Did you find that without the capacitors the motors didnt run, or was it just the encoders were more consistent with capacitors?

If I recall correctly, I could not get the motor to perform at all before I made the small board. The board really was needed in my case. Perhaps in yours as well.

If you get invalid state after this set of parameters, it’s because you need to do the encoder offset calibration. With that said, I don’t think you need to do it with HALL sensors. Have you tried odrv0.erase_configuration() and then these same commands again? Also, might want to set dc_max_negative to something like -1

I see, thanks for your response! I have tried erasing the configuration, but I keep running into the same issue. Would you mind telling me which specific commands to run for the encoder offset calibration?

I had a similar issue, and I not only could not get the motors working, but couldn’t get them working with 22nF caps either! It took 47nF caps before the encoders wouldn’t fault out. Don’t worry, it’s not you…the ODrive board is noisy as hell! Here’s a board we designed to make it easy to use caps, and just plug in…