Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Some basic PID questions

Status
Not open for further replies.

neddie

Full Member level 5
Joined
Feb 23, 2010
Messages
257
Helped
41
Reputation
82
Reaction score
39
Trophy points
1,308
Location
South Africa
Activity points
3,042
Hi to all.
I have a few questions about a PID , well actually a PI control that I'm implementing on a DC motor. 24V 1500RPM motor.
I want to control the motor from about 1300 to 60 RPM. The motor has the encoder (20 teeth) on the shaft , so at 60RPM
I'm getting feedback at the rate of 20Hz or 50ms.
What "speed" / interval must I run my control loop at?
If I run it at 50ms it will probably be fine for low speeds , but at high speeds
it will be very slow compared to the feedback rate. If I run it fast , say every 1ms or so at low speeds I'll be running the loop without
updated counts. What is the correct way to go here.

Another problem. The loading on the motor is very non linear. It goes through about 1 to 4 reduction , so for ever single rotation of the
final gear the motor has done about 4 turns. Every single rotation of the final gear sees full load to no load during 1 rotation.
Will I be able to compensate for this using PID throughout the speed range (60 - 1300rpm) , or am I on a hiding to nothing :0(
Cheers
Ned
 

barry

Advanced Member level 5
Joined
Mar 31, 2005
Messages
5,180
Helped
1,118
Reputation
2,248
Reaction score
1,123
Trophy points
1,393
Location
California, USA
Activity points
28,354
Interesting problem (and well-stated, which is a refreshing change around here).

I don't think there's any problem with using a fast sample rate; when you translate the continuous-time representation of your controller to discrete-time, that sampling rate is figured into the conversion.

You might want to try simulating your system,; it sounds a little scary, but I don't know enough to say yes-or-no it will work.
 

keith1200rs

Super Moderator
Staff member
Joined
Oct 9, 2009
Messages
10,877
Helped
2,064
Reputation
4,128
Reaction score
1,597
Trophy points
1,403
Location
Yorkshire, UK
Activity points
57,271
Surely the time constant of the system is a factor? Even if it is moving quickly, the inertia and motor torque will limit the rate at which motor demand can be usefully be changed.

Keith
 

t_maggot

Member level 3
Joined
Nov 9, 2006
Messages
57
Helped
4
Reputation
8
Reaction score
2
Trophy points
1,288
Activity points
1,282
I thing you have understood that the control isn't going to be perfect for many reasons, so the control sheme depends on what you define as 'acceptable' response. For example you want smoothness in your motion or you prefer a more 'strict' control? This can be controlled by the PID gains but there are other things also.

I suggest you to start from the simple. Run the PID every time you read a new speed. Run the system for the low rpm (real load conditions). Optimise this. You will draw some conclusions. Then go for the higher rpm with this low freq in your PID and feed to the PID the average of the speed (see Cumulative moving average). If the response is too slow (50ms is prety fast, so probably not, but depends on the size of your motor), only then try to increase the PID freq along with the speed reading, but this probably means that you need to adjust some gains as a function of the PID period (at least Integral gain response, varies with the PID speed). Of course there is no reason to run PID faster than the speed reading, but in contrary, IMO this is wrong because you feed PID with previous data. But of course you can try it, the effect might be negilible.

Also, a simple trick I have done in the past to monitor the rotation speed of a motor is to connect an extra IR transceiver to the encoder, and feed this (amplified to correct levels of course) to a sound card line-in (beware of the dc, if your card lack's an input capacitor). Then with a free audio recording programm (like goldwave or any other) you can record, see, and hear (because 300-1500 Hz is clearly audible) the speed of your motor. I have found it really convenient.

And for the end, if you have abrupt load changes, want to keep constant speed and dont care about start/stop times, try to add some extra inertia (weight, heavy disk, wheel) to the rotor. Think of this as a natural 'low pass' filter for the rotor speed.
 

neddie

Full Member level 5
Joined
Feb 23, 2010
Messages
257
Helped
41
Reputation
82
Reaction score
39
Trophy points
1,308
Location
South Africa
Activity points
3,042
Thanks for all the tips guys. Obviously lots of experimenting still to be done here. Speed up and slow down times are not all that important
here , in fact a slow ramp up and down is required ,so that points me in the direction of some sort of "flywheel" to help smooth
out some of the non linear load on the motor. Thanks for the tip , not something I would have thought of.
I'm thinking of running the PID loop quite fast , but only updating the values if a valid reading has come in. I'll just set a flag in my input capture
ISR when I have a valid reading.
Lets see how it goes :0)
Cheers
Ned.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top