# Creating new algorithm like PID

I have come across this Proportional Integral- Derivative( PID) control theory. I feel that it is highly beneficial and accurate. I want to create a new algorithm which is more accurate, faster, efficient than PID. Also it should be easily programmable in microcontroller. So what are the prerequisites/ learning materials for a beginner like me.
Also, I have heard that we have to mathematically prove that a control algorithm converges to a defined value when applied repeatedly. Could you please provide details about the rigorous math needed.

Related Programming and Computer Science News on Phys.org
Sounds like a thesis at least.

Sounds like a thesis at least.
No it is not a thesis but I want to create a more efficient algorithm for microcontroller applications.

No it is not a thesis but I want to create a more efficient algorithm for microcontroller applications.
I'm saying to be able to do that, it would be worth a thesis for a masters probably even a doctorates. You're not going to magically create a better way of doing it unless you know a lot of math and understand many proofs, even then I'm sure it would take a whole lot of research.

Alpharup
berkeman
Mentor
I have come across this Proportional Integral- Derivative( PID) control theory. I feel that it is highly beneficial and accurate. I want to create a new algorithm which is more accurate, faster, efficient than PID. Also it should be easily programmable in microcontroller. So what are the prerequisites/ learning materials for a beginner like me.
Also, I have heard that we have to mathematically prove that a control algorithm converges to a defined value when applied repeatedly. Could you please provide details about the rigorous math needed.
No it is not a thesis but I want to create a more efficient algorithm for microcontroller applications.
What is your level of education so far? You will need at least a background in Control Theory, and a strong background in programming microcontrollers of different kinds. A strong background in Digital Signal Processing (DSP) would also be important to have.

Alpharup
I am doing bachelor's in engineering. What are the topics to be learnt in DSP?( I have a little background)

Don't you think that if it was achievable for someone at your education level to create a new general purpose control algorithm more efficient than PID that it would have been done a thousand times already?

Why do you need a more efficient control algorithm? If you have a specific application in mind you might be able to create a specialized algorithm that could outperform a basic PID controller for that specific application.

Alpharup
Don't you think that if it was achievable for someone at your education level to create a new general purpose control algorithm more efficient than PID that it would have been done a thousand times already?
Yes, it may take time but will be rewarding. What will be more rewarding if we could control the process efficiently with our own algorithm?

If you have a specific application in mind you might be able to create a specialized algorithm that could outperform a basic PID controller for that specific application.
I want to create a new algorithm which can be used for all applications. If PID control can be proved to converge / be stable, why can't we play with some other function involving error variable and play with it ?

Also what are the conditions which should be proved?

I want to create a more efficient algorithm for microcontroller applications.
If by efficient you mean quick, there isn't a more efficient algorithm than PID. If efficiency is measured in terms of more accurately regulating the output, There are many other types of feedback control mechanisms that do that better. However, PID is about the simplest you can get with any decent amount of control (PID for me includes PD and PI). Even though microcontrollers can do many more operations per second than they could 10 years ago, you'll still have to use some simplifying assumptions to make it run in real-time. Thus, you're traveling in the direction of PID.

What will be more rewarding if we could control the process efficiently with our own algorithm?
The only thing more rewarding than writing the algorithm is actually implementing it in a real project. It seems you haven't tried seriously building a controller that even has used PID, because even a simple smooth-running inverted pendulum like the Segway is pretty hard.

I want to create a new algorithm which can be used for all applications
Good luck. There are many control techniques that assume a great many things. For example, not all systems can be said to be LTI (linear time-invariant), which a few techniques assume. Many aren't even linear. There are many control theorists (with PhDs even) that want to come up with that "perfect algorithm", but it's harder than you think.

If PID control can be proved to converge / be stable, why can't we play with some other function involving error variable and play with it ?
All PID loops are NOT stable. In fact, it's very easy for the integrator to cause the system to be unstable. Seems you need to do a bit more reading about feedback control and stability criteria.

Alpharup and berkeman
jim mcnamara
Mentor
As a rule of thumb - (Ignoring the correctness aspect (proofs), which is very bad) algorithms account for a large part of the efficiency of code. You can add small tweaks to localize data for example. This may improve efficiency by a few percent. However. The more tweaks you add the more likely you will likely lose correctness, lose control of program state, or just plain crash. But you will very definitely lose code readability.

Based on the way you have asked your questions I would suggest you need way more experience with control theory and software engineering. Not trying to deter you, I am trying to prevent you from wasting your time in an exercise that we can believe will frustrate you. A lot. Today. You need more background. Later, then go for it.!

Last edited:
Alpharup
mfb
Mentor
I want to create a new algorithm which can be used for all applications. If PID control can be proved to converge / be stable, why can't we play with some other function involving error variable and play with it ?
You underestimate the effort that has been put in research.
This has been done. With hundreds, probably thousands of different approaches, with researchers that had years to decades of experience in the field. And the result of all this research is PID (and several other methods).

Alpharup and timthereaper
Even getting a PID controller set up can be very annoying.
An undergrad project I worked on was getting a wind tunnel to work at a constant velocity, we read about PID loops and how to choose the parameters.
Even then we wasted an awful lot of time trying to get a reasonably stable velocity.

Perhaps a good way to start is building a small experiment to become acquainted with the pitfalls of setting up and the disadvantages of a PID loop.

Alpharup and timthereaper
I am doing bachelor's in engineering. What are the topics to be learnt in DSP?( I have a little background)
Shannons Theorem.

Alpharup
FactChecker