PID Dual Loop with Arduino PID library.


Before I do a lot of digging in the PID library, I was hoping that someone could tell me if I can create a dual loop architecture with it. I realize that it is single loop, but I am hoping one of the experts out there can give me some direction. I wish to control a brushless servo motor, not a hobby servo motor. The drive will take a step and direction input as an FYI.



If you want dual-loop control, you'll need TWO PIDs, not one. At that point, unless you're on a Due or other fast processor, your update rate will probably be rather slow, which will make for less precise control.

Regards, Ray L.

I am on the Due so I am good there. And was thinking that I would be be able to do it with two PID’s. I needed that confirmed. So thanks for the confirmation. And if there was any one that could cut down the learning some with additional information that would be great. Pretty sad my degree is in control systems, but that was 30 years ago and that is the last time I thought of this. So there is some limited familiarity, but just barely.

It should not take you long to refresh your skills. Valuable knowledge!

Are you trying to compensate for backlash (dual loop) or simultaneously control speed and position (probably cascade loops) or are you trying to control two motors with one controller (two separate loops)?

If you're controlling the motor through a step/direction drive, the PIDs should be IN the BLDC drive, not in front of it. You'd be much better off either using a proper BLDC servo drive, or simply use a brushed DC motor and encoder with the PIDs in the Arduino.

What is the application? What kind of speed/position accuracy are you after?

Regards, Ray L.