Need help setting up hoveroard motors


#1

Hello every one,

I have a 24v Odrive 3.5 powered by a lab power supply running 24v5amps and two different hoverboard motors. I followed the step by step tutorial on how to setup the odrive with the hoverboard motors, everything looks good until I run

odrv0.axis0.requested_state = AXIS_STATE_ENCODER_OFFSET_CALIBRATION

The first two attemps resulted in a 0x02 error code and now 0x04. I did everything as specified in the hoverboard tutorial but I can’t figure out what’s causing this code. I tried swapping the cables connecting the hall sensor plug from the hoverboard motor to the odrive.

Here’s my configuration :

odrv0.axis0.motor.config.pole_pairs
Out[74]: 15
odrv0.axis0.motor.config.resistance_calib_max_voltage
Out[75]: 4.0
odrv0.axis0.motor.config.requested_current_range
Out[76]: 25.0
odrv0.axis0.motor.config.current_control_bandwidth
Out[77]: 100.0
odrv0.axis0.encoder.config.mode
Out[78]: 1
odrv0.axis0.encoder.config.cpr
Out[79]: 90
odrv0.axis0.encoder.config.bandwidth
Out[80]: 100.0
odrv0.axis0.controller.config.pos_gain
Out[81]: 1.0
odrv0.axis0.controller.config.vel_gain
Out[82]: 0.019999999552965164
odrv0.axis0.controller.config.vel_integrator_gain
Out[83]: 0.10000000149011612
odrv0.axis0.controller.config.vel_limit
Out[84]: 1000.0
odrv0.axis0.controller.config.control_mode
Out[85]: 2


odrv0.axis0.motor
Out[89]:
error = 0x0000 (int)
armed_state = 0 (int)
is_calibrated = True (bool)
current_meas_phB = -0.04455310106277466 (float)
current_meas_phC = 0.041716814041137695 (float)
DC_calib_phB = -0.6201490163803101 (float)
DC_calib_phC = -1.6934059858322144 (float)
phase_current_rev_gain = 0.012500000186264515 (float)
current_control:
  p_gain = 0.06191680580377579 (float)
  i_gain = 25.097341537475586 (float)
  v_current_control_integral_d = 0.0 (float)
  v_current_control_integral_q = 0.0 (float)
  Ibus = 0.0 (float)
  final_v_alpha = 0.0 (float)
  final_v_beta = 0.0 (float)
  Iq_setpoint = 0.0 (float)
  Iq_measured = 0.0 (float)
  max_allowed_current = 35.999996185302734 (float)
gate_driver:
  drv_fault = 0 (int)
timing_log:
  TIMING_LOG_GENERAL = 0 (int)
  TIMING_LOG_ADC_CB_I = 897 (int)
  TIMING_LOG_ADC_CB_DC = 10967 (int)
  TIMING_LOG_MEAS_R = 4299 (int)
  TIMING_LOG_MEAS_L = 4601 (int)
  TIMING_LOG_ENC_CALIB = 0 (int)
  TIMING_LOG_IDX_SEARCH = 0 (int)
  TIMING_LOG_FOC_VOLTAGE = 4539 (int)
  TIMING_LOG_FOC_CURRENT = 0 (int)
config:
  pre_calibrated = True (bool)
  pole_pairs = 15 (int)
  calibration_current = 10.0 (float)
  resistance_calib_max_voltage = 4.0 (float)
  phase_inductance = 0.0006191680440679193 (float)
  phase_resistance = 0.2509734034538269 (float)
  direction = 1 (int)
  motor_type = 0 (int)
  current_lim = 10.0 (float)
  requested_current_range = 25.0 (float)
  current_control_bandwidth = 100.0 (float)

odrv0.axis0.encoder
Out[91]:
error = 0x0004 (int)
is_ready = True (bool)
index_found = False (bool)
shadow_count = 0 (int)
count_in_cpr = 0 (int)
interpolation = 0.5 (float)
phase = -2.1105637550354004 (float)
pos_estimate = 0.014514235779643059 (float)
pos_cpr = 0.02415577508509159 (float)
hall_state = 1 (int)
vel_estimate = 0.0 (float)
config:
  mode = 1 (int)
  use_index = False (bool)
  pre_calibrated = True (bool)
  idx_search_speed = 10.0 (float)
  cpr = 90 (int)
  offset = 26 (int)
  offset_float = 0.5154410600662231 (float)
  bandwidth = 100.0 (float)
  calib_range = 0.019999999552965164 (float)

Right now it’s still giving me the 0x04 and I can’t get it to replicate the 0x02. I tried swapping with the other motor I have wich gives me about the same results either 0x02 or 0x04.

Any help appreciated

Edit : I got it to go back to error 0x02 for some reason, but I recounted the magnets and the values seem correct yet I get 0x02


#2

All your settings look correct. You seem to have set encoder.config.pre_calibrated = True even though you should only do that if you had a successful calibration. But this shouldn’t cause errors during calibration.

Does your motor turn for half a turn or so during AXIS_STATE_ENCODER_OFFSET_CALIBRATION ?

  • If yes: Double check the signals coming in from the hall sensor, check that encoder.hall_state and encoder.shadow_count are all changing as expected when you move the wheel by hand.
  • If no: check your motor wiring.

#3

I’ve checked encoder.hall_state and shadow_count wich are both changing as i turn the motor by hand; I still get the half turn when I run AXIS_STATE_ENCODER_OFFSET_CALIBRATION