Driving Kollmorgen AKM42S Servo using ODrive

I am planning on using ODrive to control a Kollmorgen Servo Motor.
(AKM42S-ANSN2-02: https://drive.google.com/open?id=19x0QQIhNDC1kmObtXkrhfT5vLvAnVJoa)

I am fairly new to all this (only used simple brushed DC motors until now), and from what i understand these industrial servo motors are just big BLDC-Motors with an Encoder attached to them.

My Goal is to ultimately control the motor through a python script. I dont need particularly high RPM. I’m more looking for precise controll of position and tourqe in realtime.

Has anyone tried to use these kinds of motors with Odrive yet?
Is it possible at all, or am i completely wrong here?

Hello JanBalke420,
as far as I know, the motor type themselves are compatible, but the optimal voltage of that servo is too high for ODrive. If you are limited to using that motor, try stmbl. One of the main component for the current version (IRAM256-2067A2) is obsolete and out of stock everywhere, but I found 15A version (IRAM256-1567A2) from aliexpress.

Hey naktamello,

thanks for the reply. From what I can see, I would have to build the stmbl myself. Or is there any way of buying them fully assambled?

Since I want to use the motor mainly as a DIY Direct Drive Wheel for Simracing, I’m not seeing myself driving it with its full force anytime soon.

Also ODrive already provides a library for controlling it via python. I would have no idea how to do that with the stmbl.

You have to assemble stmbl yourself, but the project’s target motors are like the one you posted. From my experience ODrive works well with both those sold as hobby brushless motors and industrial bldc motors. If you can find motors with driving voltage <56V that can take an encoder on the backside I think you’ll be satisfied with ODrive’s performance and interfacing options.

I’ve already tried to drive a motor of that kind of size (small mige) with odrive, but I had no success so far (when thru a lot of initialisation errors, and I finally gave up).
I’m not sure odrive FW and HW are designed to deal with that kind of motor.

The “S” in AM42S refers to a special winding type that isn’t in the datasheet. The catalog part number that has the closest specs is the AM42J. Which has a back emf constant of 27.5 V/krpm. The following equation gets you the maximum inverter RMS voltage given a maximum modulation factor (0.8 for Odrive currently[?]).

V_max,rms = V_DC/2 * sqrt(3) * 1 / sqrt(2) * mod_index

The above equation gives you a max voltage at the Odrive inverter terminals of 27Vrms. Now, I don’t know if the back emf constant given in the datasheet is in rms units or not. Assuming it is, you will get a no-load speed of only about 1000RPM. Notice how I say “no-load”. In order to produce torque (which comes from current) you need some level of margin between the bus voltage and the motor voltage, so your ability to produce torque will be limited to the sub 1000RPM speed range.

So, short answer is yes, that motor should work. Just don’t plan on spinning it anywhere near the speed that is on the name plate.

Hey guys!

Sorry, its been a while, but thanks for the detailed answer jalbob.
Now I’m not really familiar with RMS Voltage or what you mean with modulation factor.
But I get, that i can’t drive the motor to its full potential, when i’m using much less than the rated Voltage.

I recently found this Motor driver…
http://www.dmm-tech.com/Dyn4_main.html

There’s a version of it avalable for 1.3-1.8 kW Motors.
My Question regarding this driver would be, how easy is it for me to drive it using python.
I know, this is probably the wrong forum for questions about this driver, but maybe theres someone that has experience with this manufacturer.

Sorry, I am mixing my terms here. The correct terminology is modulation index not modulation factor. Think of it as something similar to duty cycle in a pwm signal. It’s not quite the same because in certain situations that don’t apply to Odrive V3 you can get a greater than 1 modulation index, but it is essentially defines a percentage.

Regarding controlling the drive that you have linked to using python. If you are expecting to do PID control through python then I think you may have some difficulties related to timing and jitter. Realtime in my mind means you have hard timing guarantees, which python won’t handle very well. If you are just sending setpoints and the drive is doing all of the PID control then that may be a bit of a different story, but I would need to know more about the architecture that you are planning to use before I can comment further.

I wouldn’t want to do the PID controlling via Python, i want the drive to handle that for me, but i would like to send setpoints and controll the speed and torque the motor is using to get to this setpoint in realtime. Realtime meaning for me, about 60Hz.

So i looked at the OSW System, wich is an existing Direct Drive Wheel System, and its using the IONI Pro HC from Granite Devices.


This driver has a max output voltage of only 55V…
and it seems to be sufficient for its use case.
So i’m thinking the ODrive would be good enough as well…

What do you guys think?

I think too that the ODrive should be good enough, even maybe overkill.
Do you already have the Kollmorgen Servo Motor and an ODrive ?

Hey, so it’s been a while, but i did order an ODrive, and i got the motor running with it.

I had a few calibration issues… i hat to set the calibration voltage up to 6V, otherwise the ODrive wouldn’t measure the phase resistance and inductance at all.
I also had to change the number of pole pairs, the default setting is 7, but my motor has 5 pole pairs.

After that the motor works with the odrive, but… while in closed_loop_control the motor makes noises and the measured current looks noisy as well.

Apart from that the whole thing actually works really well, as you can see in the video.

Regarding the noise, I already tried to tune the parameters like pos_gain, vel_gain and vel_integrator_gain, but nothing seems to get rid of the noise.

For using it as a sim steering wheel i actually control the current by constantly changing the current_lim. By setting the pos_setpoint to +8192x2 or -8192x2 i change the direction the tourque should be applied in.

I know theres a current_control mode, but i somehow can’t get it to work with that mode.

2 Likes

Great work !
About noise, maybe the current sensors shunts are too small if you’re using 10 or 20 Amps instead of 100 A.
Apart from this Is the torque smooth ? if you apply a constant torque, does it stay constant when you turn the wheel ?

You must be able to get the motor to work in current control mode, or you’ll have never-ending problems in the other modes.

Can you define “doesn’t work”?

To be honest, i don’t fully understand current control mode…

as far as i understand it, current controle mode is one of 5 modes inside the closed_loop_control, is that right? Or is the current control mode seperate from closed_loop_control?

Also, when im in current control mode and i set a current_setpoint, nothing happens… and how is the motor supposed to respond, when i don’t give it a direction in wich to apply the desired current?

So it’s not like the ODrive doesn’t work, it works like a charm… it’s just that i don’t get it.

No, there’s only 3 control modes for normal motors.

  • Current Control
  • Velocity Control
  • Position Control

Gimbal motors (high resistance motors) use voltage control instead of current control.

If you are in AXIS_STATE_CLOSED_LOOP_CONTROL and CTRL_MODE_CURRENT_CONTROL you can send current_setpoint values (positive or negative) to get a torque in the positive or negative direction.

Oh, okay, so with these modes i’m effectively telling the ODrive what parts of this control loop (https://docs.odriverobotics.com/control) to use, right?

The thing is, i tried that, i was in AXIS_STATE_CLOSED_LOOP_CONTROL and put it into CTRL_MODE_CURRENT_CONTROL, but when i set a current_setpoint, nothing happend. What am i missing here?

Nothing, that should work as long as there are no other errors. It’s easy to quickly get an overspeed error in current control mode if you haven’t disabled it controller.config.vel_lim_tolerance = 0. Keep in mind the motor will go to maximum speed unless it has something to push against

So i just tried it out, and i really don’t know what i did different the first time, but now it works.

Now when it comes to the noise issue, how would i go about calculating the appropriate resistance for new shunt resistors?

Depends on the maximum current you can expect with your motor and power supply.
But if you do that, you will need to recompile the Firmware and change the define SHUNT_RESISTANCE in board_config_v3.h. In the end I’m not sure if it’s useful to change the shunt resistors.
Maybe it would be better first to try to change the DRV8301 shunt gain in the FW code. I don’t know what’s the default value, but if you set it to 80V/V, you should have a +/- 37.5 Amps range.
If this doesn’t help, adding additional digital filters to current sensing code, and/or add a filter to the command output may be the only way to suppress the noise.