Velocity Control & Encoder Question

Hi all, I’m new to the subject of controlling BLDC motors and have a few questions about the oDrive.

I have a project that involves controlling the rpm of a bldc motor precisely. From say 100 RPM to 12,000 RPM or more. If I were to use a quadrature encoder at what count/sec would the odrive have difficulty (lose or miss counts).

Also is there an example using an arduino to set the velocity control and what would be the precision of it?

Command exists in ODriveArduino.h (https://github.com/madcowswe/ODrive/tree/master/Arduino/ODriveArduino)

void SetVelocity(int motor_number, float velocity);

Project involves setting the RPM and Time for which the motor should spin. Would like to also be able to control the acceleration and deceleration of the motor. Lastly is there documentation on using a brake resistor with this drive?

Very possible these subjects have been discussed, appreciate if anyone can point me to those threads.

Greatly appreciate your comments! Thanks!

3 Likes

First of all, I don’t know if ODrive can run at 12000+ RPM. But nevertheless, if the only thing you care about is velocity control, then you can choose an encoder with a relatively low CPR. This way the ODrive will not have the problem of skipping counts.

The precision of the velocity control depends of many variables. Like the attached load, disturbances from the outside, motor quality, motor type, parameters from the PI loop for velocity control (more about that here https://docs.odriverobotics.com/control), but when everything is optimized, I find that ODrive does a pretty good job of keeping the velocity stable.

To set the velocity you can indeed use that command with the velocity in counts/second (I guess). If that’s the case, you will need to convert RPM to counts/second using the encoders CPR.

If you want acceleration and deceleration, I advise you to use the integrated trapezoidal trajectory planner. First of all, you will need to set an acceleration, deceleration and max velocity. After that, you can use the move_to_pos(targetCount) command to move to a specific location while respecting those previously defined parameters.

If you want to move the ODrive for a given time (so you don’t care about the final position), you can always build your own trapezoidal trajectory planner on the Arduino and calculate what positional parameter you need to pass to the move_to_pos command.

I think I made a very basic trapezoidal planner in the past, if I find the calculations I will post them here. They might be useful.

1 Like

For precise velocity control, I recommend higher pulse count rather than lower. It improves the bandwidth of the velocity control considerably.

2 Likes

What sampling rate is the controller running at on the Odrive? Also, what are the first limitations that you run into when using high rpm?

8kHz

First thing you hit is the encoder electrical frequency limit, then encoder mechanical limits. ODrive supports very high pulse frequencies.

1 Like

Thanks for the replies everyone!

I’m thinking of using a USDigital encoder (https://www.usdigital.com/products/encoders/incremental/rotary/kit/E8T)
mechanical limit on these units is 60,000 RPM.

As said by Wemelon, I’d like to get as high a PPR as possible in order to get precision velocity control.

If I get the encoder with 2,880 pulses per revolution (PPR). At 12,000 RPM I’m at 576kHz. And at 100 RPM I’d be at 4.8kHz. Could go with 720 PPR and then have 144kHz @ 12,000Rpm and 1.2kHz @ 100Rpm.

Is 8 kHz really the maximum frequency I can run an encoder at with the ODrive?

For running 12,000 Rpm and 8kHz max frequency I’d be limited to 40 PPR.

What? No. It samples the position/velocity/current at 8khz but iirc the max electrical pulse rate is something like 10 MHz.

EDIT: See this thread for more information. Velocity Control - What is the max speed possible?

Not sure what motor you’re using, but you may run into other issues trying to get it to run 12000rpm