Closed Loop Speed

5 years 3 months ago - 5 years 3 months ago #29530758 by Peter Balch
I have an HBL2360 driving BLDC motors to make an electric vehicle controlled by a PWM joystick in Mixed mode. It works fine under Open Loop. I've now selected Closed Loop Speed and Encoder=UseFeedback (i.e. feedback from the BLDC hall sensors). The loop parameters are P=20, I=0, D=0.

The wheels go round ok but there doesn't seem to be any closed-loop speed control. I had expected that the joystick would now control wheel rpm (rather than power as in open-loop). In other words, the speed would stay the same whether the vehicle was going downhill or climbing a kerb.

The vehicle is up on blocks. If I set the joystick to slow forwards I can grab a wheel to slow it down. I'd expected the controller to try to maintain the speed of the wheel but it feels no different to how it was with open-loop.

I've tried various other PID values. In particular, I'd expected that increasing 'I' would mean the accumulated error forced the wheel forwards. But all that happens is that the accel/deccel are much slower.

Thanks

Peter

Please Log in or Create an account to join the conversation.

5 years 3 months ago #29530759 by TechSupport
Replied by TechSupport on topic Closed Loop Speed
You're using the wrong PID value for speed mode. It works primarily on the I gain. P gain is for the position modes.

If you are using encoders, make sure in your motor output settings that you set the closed loop feedback to "other" instead of hall sensors.

Please Log in or Create an account to join the conversation.

5 years 3 months ago #29530760 by Peter Balch
Replied by Peter Balch on topic Closed Loop Speed
If I set P=0, I=2, D=0 then all that happens is that the acceleration is becomes very low. It takes several seconds to reach the speed that the joystick is requesting. That's no use in a wheelchair - if the joystick returns to zero, the chair should stop quickly (which it does in Open Loop).

And even when the wheel reaches the speed set by the joystick, I can still grab the wheel and stop it. I'd expected that if I set the speed to 60rpm then the controller would maintain 60rpm no matter what.

Fiddling with D values doesn't help either.

It's a bit puzzling.

(Yes, the MotorConfiguration FeedbackSensor is set to Other.)

Peter

Please Log in or Create an account to join the conversation.

5 years 3 months ago #29530761 by TechSupport
Replied by TechSupport on topic Closed Loop Speed
You adjust your speed and acceleration values as well. The Max speed is the max speed of the motor in this mode. You set your acceleration and deceleration values as well. You increase the I gain as needed to get the speed.

Please Log in or Create an account to join the conversation.

5 years 3 months ago #29530762 by Peter Balch
Replied by Peter Balch on topic Closed Loop Speed
> If you are using encoders, make sure in your motor output settings that you set the closed loop feedback to "other" instead of hall sensors.

Aha. You mean that because I have BLDC motors with hall sensors I should set the MotorConfiguration FeedbackSensor to Hall. OK, I've done that and it made no difference.

> You adjust your speed and acceleration values as well.

The MaxSpeed is set to 171 rpm.

The Acceleration is set to 342 rpm/s.

The Decceleration is set to 1710 rpm/s.

Those values work well with in Open Loop mode. Should I increase or decrease them for Closed Loop Speed?

Maybe I'm misunderstanding what "Closed Loop Speed" actually does. I'd like the motors to go at constant speed whatever the load.

Peter

Please Log in or Create an account to join the conversation.

5 years 3 months ago #29530763 by TechSupport
Replied by TechSupport on topic Closed Loop Speed
The closed loop mode works completely different than the open loop since it is looking at actual specifics. In open loop, the max speed is based on the motor command being at 100% (+1000 or -1000 motor command), and this is regardless of what your max speed setting is set to. It takes the max speed and divides by the acceleration to create a time change over to get to command.

Default settings 1000 max, 2000 acel. This is a 500mS time change to get to command.

In closed loop speed, it works differently. The max speed is the actual max speed. Therefore if you have a 1500 RPM motor, and you go with the defaults, then it would not go any faster than 1000 rpms.

In this mode you also have the PID parameters to fine tune along with the speed and acceleration parameters. The purpose of the D gain is the added reactive boost upon a command change to help get to the desired speed faster. Recommended you don't use too much of this value as you could possibly damage the motor if something bad happens.

The PID values are what are used to maintain the speed at loads. However when loaded, it may require additional fine tuning.

Please Log in or Create an account to join the conversation.

5 years 3 months ago #29530764 by Peter Balch
Replied by Peter Balch on topic Closed Loop Speed
It sounds like Closed Loop Speed doesn't do what I thought it did.

I'd like the joystick to request a speed and the HBL2360 to make the motors go at that speed whatever the load.

If the max speed is set to 1000 rpm and the joystick is set to 50% then the motors go at 500 rpm.

Is there a mode that does that?

Peter

Please Log in or Create an account to join the conversation.

5 years 3 months ago - 5 years 3 months ago #29530765 by TechSupport
Replied by TechSupport on topic Closed Loop Speed
It works that way. It just means that if the joystick is at full tilt to get full command, it will do +1000.

So in your case, it would work.

Closed loop mode just has a lot more specifics required to meet the needs of what you are trying to achieve. The open loop is just basic operation of move the motor. It does not apply torque or position based commands amongst other things since it is open loop.

The issue you were having was related to the PID wrong values. On top of that, you also needed to adjust the speed and acceleration values to make it get to speed faster and maintain it. Outside of that, it should work for what you are looking to achieve.

Please Log in or Create an account to join the conversation.

5 years 3 months ago #29530766 by LROBBINS
Replied by LROBBINS on topic Closed Loop Speed

The MaxSpeed is set to 171 rpm

That sounds like speed downstream of a gear reducer, but your Hall sensors are almost surely on the motor shaft. Multiply that 171 by the gear ratio and you'll know the motor rpm. I think that's the speed you should be aiming for.
Ciao,
Lenny

Please Log in or Create an account to join the conversation.

5 years 3 months ago #29530767 by Peter Balch
Replied by Peter Balch on topic Closed Loop Speed
> That sounds like speed downstream of a gear reducer

Well spotted! Yes, you're right. I've reset it to a more reasonable value of 1000. It should be 5400 but I'll be cautious for the moment.

But it hasn't made Closed Loop mode any better.

> You adjust your speed and acceleration values as well.

They're now at
MaxSpeed = 1000 rpm.
Acceleration = 500 rpm/s.
Deceleration = 2000 rpm/s.
P=0
I=2
D=0

(I've tried all sorts of other values.)

With those settings, a +10% setting on the joystick makes the motor accelerate to full speed in a couple of seconds. Returning the joystick to zero makes the motor slowly decelerate over 6 seconds.

Why is the deceleration slower than the acceleration when it should be 4 times faster. Why does it accelerate so quickly (it behaves fine with those settings in Open Loop)? Why is the speed so high with even a small joystick value?

Can you suggest some reasonable values?

Thank you

Peter

Please Log in or Create an account to join the conversation.

Moderators: tonysantoni
Time to create page: 0.132 seconds