Motor failed/current unstable

Hi I recently purchased a Odrive for a work project. I am a novice programmer . I have played with the odrive for about a week now and I can’t get it to work for me.

My Setup:
24vdc power supply
47 ohm resister hooked up
Odrive v3.6
motor: https://www.faulhaber.com/fileadmin/Import/Media/EN_2057_B_FMM.pdf
The motor has only 1 pole and has a hall effect sensor that I have hooked up

What I need:
I need to be able to spin the motor to 15000 rpm

The problem I am having:

It calibrates fine- it beeps, then slowly turns one direction… then the other and stops. So I know everything seems to be connected properly.

Any time I try to run it the motor will not turn or if it does it is less then 1 rotation and flags the following errors below. I know I am doing something wrong, but I am hopeless at the moment and would greatly appreciate help.

Thanks for your help in advance.

axis0
  axis: Error(s):
    ERROR_MOTOR_DISARMED
    ERROR_MOTOR_FAILED
  motor: Error(s):
    ERROR_CURRENT_UNSTABLE
  encoder: no error
  controller: no error
axis1
  axis: no error
  motor: no error
  encoder: no error
  controller: no error

In [233]: odrv0.axis0
Out[233]:
error = 0x0060 (int)
step_dir_active = False (bool)
current_state = 1 (int)
requested_state = 0 (int)
loop_counter = 357282 (int)
lockin_state = 0 (int)
config:
startup_motor_calibration = True (bool)
startup_encoder_index_search = True (bool)
startup_encoder_offset_calibration = True (bool)
startup_closed_loop_control = False (bool)
startup_sensorless_control = True (bool)
enable_step_dir = False (bool)
counts_per_step = 2.0 (float)
watchdog_timeout = 0.0 (float)
step_gpio_pin = 1 (int)
dir_gpio_pin = 2 (int)
calibration_lockin: …
sensorless_ramp: …
general_lockin: …
motor:
error = 0x1000 (int)
armed_state = 0 (int)
is_calibrated = True (bool)
current_meas_phB = -0.4219663441181183 (float)
current_meas_phC = 0.2119901180267334 (float)
DC_calib_phB = 0.019366221502423286 (float)
DC_calib_phC = -0.5742654800415039 (float)
phase_current_rev_gain = 0.02500000037252903 (float)
thermal_current_lim = 4.4958343505859375 (float)
get_inverter_temp()
current_control: …
gate_driver: …
timing_log: …
config: …
controller:
error = 0x0000 (int)
pos_setpoint = 0.0 (float)
vel_setpoint = 0.0 (float)
vel_integrator_current = 0.0 (float)
current_setpoint = 0.0 (float)
vel_ramp_target = 0.0 (float)
vel_ramp_enable = False (bool)
config: …
set_pos_setpoint(pos_setpoint: float, vel_feed_forward: float, current_feed_forward: float)
set_vel_setpoint(vel_setpoint: float, current_feed_forward: float)
set_current_setpoint(current_setpoint: float)
move_to_pos(pos_setpoint: float)
move_incremental(displacement: float, from_goal_point: bool)
start_anticogging_calibration()
encoder:
error = 0x0000 (int)
is_ready = True (bool)
index_found = False (bool)
shadow_count = 3 (int)
count_in_cpr = 3 (int)
interpolation = 0.5 (float)
phase = -1.059565544128418 (float)
pos_estimate = 3.234375 (float)
pos_cpr = 3.2343788146972656 (float)
hall_state = 6 (int)
vel_estimate = 0.0 (float)
calib_scan_response = 48.0 (float)
config: …
set_linear_count(count: int)
sensorless_estimator:
error = 0x0000 (int)
phase = -0.39534294605255127 (float)
pll_pos = -0.38636890053749084 (float)
vel_estimate = 7.5265045166015625 (float)
config: …
trap_traj:
config: …
watchdog_feed()

Following is the way, they are calculating Id & Iq and dumping the error:
`
// Clarke transform
float Ialpha = -current_meas_.phB - current_meas_.phC;
float Ibeta = one_by_sqrt3 * (current_meas_.phB - current_meas_.phC);

// Park transform
float c_I = our_arm_cos_f32(I_phase);
float s_I = our_arm_sin_f32(I_phase);
float Id = c_I * Ialpha + s_I * Ibeta;
float Iq = c_I * Ibeta - s_I * Ialpha;
ictrl.Iq_measured += ictrl.I_measured_report_filter_k * (Iq - ictrl.Iq_measured);
ictrl.Id_measured += ictrl.I_measured_report_filter_k * (Id - ictrl.Id_measured);

// Check for violation of current limit
float I_trip = config_.current_lim_tolerance * effective_current_lim();
if (SQ(Id) + SQ(Iq) > SQ(I_trip)) {
    set_error(ERROR_CURRENT_UNSTABLE);
    return false;
}`

So, if you will increase current_limit_tolerance in motor_confg , probably you will not get the error. I was getting the same error and i tried the same & everything is going well. Also you can increase current limit too.
@madcowswe @Wetmelon , I am curious to know why this error (ERROR_CURRENT_UNSTABLE) is defined in this firmware not in the previous, also will there be any problem if i am increasing current_limit_tolerance?

@addapti if everything goes well, i will be waiting for 30$ USD haha.

1 Like

Sarthak, Yes thank you that solved it! I will PM you.

We realized that there are conditions under which the current controller can go unstable, and allow the actual current through the motor to exceed motor.config.current_lim, potentially causing damage to the board. It also seems to be thrown when an encoder is misaligned and the controller loses control of the motor.

@Wetmelon @madcowswe
It may be like this but it doesn’t seem to help if i put tolerance to a lower limit, the error comes out and if i put it to a higher value, it doesn’t pops out the error. In both cases, as if encoder gets misaligned, there is no way i can get the error else motors and odrive get heated and sometimes even temperature reaches upto 100C.
So, how can this be used to stop motor if any misalignment occur?

Also , i am using a three wheel omni drive drives by 3.5 Nm T motors using odrive in pwm-velocity mode. I have mapped pwm from arduino from 125 to 251 to -vmax to +vmax. So, for 188 pwm vel should be zero but vehicle continues to move with some rpm even if pwm is 188.
I want to know how it converts pwm from arduino to velocity setpoint so that i may be able to make it exact zero to stop the vehicle.
Thanks

1 Like

It uses the Servo-style PWM (50Hz, 1000 to 2000us high time). Make sure you’re using Servo objects in Arduino code to output, not AnalogWrite.

HI,
I was going through the firmware of odrive.I couldnt find these lines, where can i get these definitions? i have downloaded the firmware from github Github: https://github.com/madcowswe/ODrive/ , i couldnt find the definition, can you please share the link?