I have just gotten my ODrives working with my scooter hub motors after having to flash them with an STLink to get them up to the latest firmware.
I can calibrate the motor and hall effect encoder and control the speed of the motor in closed loop mode.
What I am not understanding is why at lower speeds even when I stall out the motor the current and torque stays low. When running at a low speed at 30V input the current will drop from 130mA to 100mA when I stall the motor. This is not what I would expect for a closed loop motor controller. At higher speed when I try to stall the motor the current drain will raise to over 3A (my power supply’s limit).
I noticed that if you hold the motor stalled the current does slowly ramp up over 10 or 20 seconds and the motor gradually puts out more torque.
So I have now been playing with the motor tuning parameters, and have had quite a bit of success. I ended up having to raise the integrator gain a lot to get the torque to ramp up quickly. The motor is now now has quite a lot of torque even at low speeds.
It is quite shaky at speeds below a vel_setpoint = 30 or is it just cogging?
I will include my new settings below.
One further question I have is:
At higher speeds when I load down the motor too much the odrive cuts the power to motor and I have to reboot it before it will work again. I suspect I am hitting a current limit cutout, or it is caused by overloading my power supply. How do I confirm why it is stopping?
Do you have any more information about the hall effect encoder?
I suspect that your motor may be shaky at low speeds due to the encoders limited resolution but its hard to say without knowing more about it. One way to check could be run Liveplotter from odrivetool with start_liveplotter(lambda: [my_odrive.axis0.encoder.pll_vel]) and watch the velocity plot as your rotate the motor slowly by hand.If your plot follows your speed smoothly then then is not your problem. If your plot jumps periodically (when your encoder updates position) then this may be your issue.
I have two recent V3.5 48V Odrives. I have not done any testing on the second one yet. I flashed the latest firmware via git as of commit 20b2c8b. I did notice that when I tried to set ENCODER_MODE_HALL it complained it was not defined. I then set it to mode 1 (which I hope is right)
I checked the errors and it is axis error 0x3 which if I am understanding the source means DC bus low. I assume this could be being caused by my power supply? I do intend to run this project off large batteries once I get them.
I don’t know anything about the encoders other than they are presumably same type of hall effect encoders used in most of these hub motors. They have a 5 wire connector that seemed to be wired correctly to plug directly onto the ODrive.
Ok, running at 100 and then 30 it looks like:
turning by hand it looks like:
I am not sure if it my bad configuration, or if that is just how bad these hall effect encoders are?
I also have a youtube video of it running at various speeds including one where it is jumpy/stepping.
Any advice would be appreciated.
I just looked carefully again, and I think the 0x3 error happens when my 30V 3A bench supply hits 3A and switches from constant voltage to constant current mode.
I have played around with the motor tuning and can get it to run a bit smoother at lower speeds, but only at the cost of control at higher speeds. I think the low speed jerkyness is probably OK for my use, and probably related to the Hall effect encoders.
Another issue I am struggling with is the top speed. For some reason I can’t get it to go over 700RPM. It runs a little faster (maybe 720RPM) if I turn the current limit down to 1 (seems unintuitive). What is stopping the motor going any faster? Settings follow.
My guess is that 700RPM may be the base speed of the motor at 30V? Can you run the same test and give us what you see at odrv0.axis1.motor.current_control? You can do a test where you start with a lower speed, and then keep increasing the speed. look at Iq_setpoint and Iq_measured. If they are close to each other, you are below base speed. If they are significantly different, then the speed you are asking for is unattainable at this bus voltage.
BTW I had a look at the link of your motor, and it’s completely unclear what the base speed (no-load speed) of your motor should be…
Thanks Oskar I will run the test you recommend tonight.
I doubt I am hitting the motor’s top speed, it seems to have plenty of torque at that speed and will ramp up the current to remain there if you try to slow it down. I am using the 24V version of the motor and feeding it 30V and it is only drawing around 40W or so at this speed.
Is the brake resistor getting hot while running a sign of something in particular that I can look into? While running at maximum speed it gets too hot to touch in a few minutes.
I tried running odrv0.axis1.motor.current_control and each time I check the values for Iq_setpoint and Iq_measured seem to jump around randomly. Sometimes they are close and sometimes they are quite different, they also swing between positive and negative values. This behaviour seems to be the same at any speed.
The brake resistor also heats up significantly while running even at constant speeds well below the maximum.
For the hover board motors they are also shaky below 30. Between 20-30 it moves smoothly.
At least with the hover board the resistor does not get warm at all slow speed (100) ,grazy fast 900.
Must say the motor is unloaded.
Your speed PI is not stable. When you run at 100 the speed is between 80 and 110. I can imagine when the speed is around 110 the odrive will try to slow it down to 100 by using the brake resistor, it also undershoot too 80. Energie needs to go somewhere.
I have tried everything I can think of to make the speed more stable. It seems to be something inherent with the Hall Effect sensors, not with he way to motor is tuned.
I am not an expert in brushless motors but I don’t feel it is hitting its base speed at 720RPM. Again I think it is related to the speed instability. Though, when I put it in current control mode it does top out at the same speed. I wonder if the encoder offset calibration can be working correctly if the speed signal is so erratic?
Is there anything I can look at next to try and get this working properly?
Would it help if I try to capture the hall effect signals? I have a cheap logic analyser, but no oscilloscope.
We are using the same size and look hub motor, we have discovered there are lot of very similar looking ones. but outer tyre diameter is 4inch correct?
We found a version with AB encoder internal as well as hall sensors.
I’ll find the seller if you are interested.
MUCH smoother low speed than the hall sensors.
Note there is only an AB encoder and no Index. We haven’t got to it but going to look at using one hall channel as the index.
I think the encoder version of this motor is made maybe 2 or 3mm wider, I haven’t confirmed because we are using it in a single sided mount configuration so it does not affect us. But the tyre is a little bit free to slide side to side on the rim, so I think the wheel is stretched in the centre to make room for the encoder.
Hi Martin, im getting the same error trying to Set " ```
odrv0.axis0.encoder.config.mode = ENCODER_MODE_HALL
how did you set to mode 1 after this and get the hub motors to rotate at all ? this is where i am stuck . Any help really appreciated.
Damn, I just ordered two more of the motors I am using. I could have tried those instead. They would definitely be an option for anyone else who is trying to do the same thing as I am (this is a drive for a 3D printed R2D2).
I simply ran: odrv0.axis0.encoder.config.mode = 1
Not sure if this was the right thing to do or if that is the root of the problem I am having, but is seemed to be what ENCODER_MODE_HALL was defined as in tools/odrive/enums.py
I still can’t figure out how to stop my odrive spending half its time trying to slow my motor back down again, hence pumping a significant amount of power into the brake resistor and not reaching the top speed I would expect.
You do this by lowering a combination of vel_gain, vel_integrator_gain and encoder.bandwidth. Did you use the recommended values in the hoverboard guide?
Can you paste for us what values are printed for:
This is running at 400RPM. Over the maximum speed the blue line diverges to the current limit, but the orange line stays bouncing between 2 and -2. This sounds like it confirms your suggestion that this is the motor’s base speed.
I have tried reducing all of these but either run into instability of a lack of torque at lower speeds. Looking at the Iq_setpoint, Iq_measured graph I think that with a physical load on the motor the current will move above the 0 point, and hence dump less/no power into the resistor?
I did start from the hoverboard suggestions, but my motors seemed to have absolutely no torque at low speeds, so I had to tweak things up a bit.