Analog PID controller from scratch

Thread Starter

atferrari

Joined Jan 6, 2004
4,425
Analog PID controller designed from scratch in a very long journey of trying, failing and learning. It seems, anyway, that I managed to get some reasonable results.

The controller.JPG


Tested today for temperature on the simplest possible plant.

The plant and sensor.JPG

The actuator

The actuator.JPG

The first test in P mode only, maintained a steady difference wrt the setpoint. A second test now in PI mode, added a bit of I. Results below.

Since the details and values had been changing until yesterday, I intend to show a tidy schematic maybe during the next week.

I feel good today. Yes!!
 

Attachments

GopherT

Joined Nov 23, 2012
8,012
Nice work.

I'd like to see P only plotted on the same graph as PI and then PID.

Good luck tuning it.

PS. I have been doing some similar work on old-school (non-Microcontroller) versions of projects.
 

Thread Starter

atferrari

Joined Jan 6, 2004
4,425
Thanks OBW and Gopher for your words.

Graph of the P controller test will come in the next two days I hope.

Attached here is the block diagram I had in mind to design the circuit whose schematic follows. Since it is a work in progress, I am not going to comment in detail.

The idea of a windows riding the setpoint, seemed to me a simple and good way to avoid integrator windup in the initial stage immediately after a step change in the setpoint. If that proves to be ridiculous, bear with me. I had to literally learn from scratch most of what you see here. I feared diferentiators / integrators as much as interrupts in micros in the past.

Just two names: Walt G. Jung and Ron Mancini. Thanks to them I solved many many doubts.
-------------------------------------------------------------------------------------------------------

Next step is to test the controller as a full PID, including the derivative component.

In case you think I "tuned" this somehow, really I did NOT: I elected a first, random setting for the Kp's pot and then another one for Ki's pot when doing the PI test. Just sheer luck. That's it.

Later I would like to characterize this so as to try it on a different plant to do a predictable tuning or an attempt at least.

Comment: I noticed some unreasonable quick changes in values that suggest maybe the necessity of better decoupling. Sure I have to work on that.

Enjoyed (and enjoying) the journey.
 

Attachments

I have done PID using a PIC micro for motor control and it was fairly straightforward.
After you use the basic formula for PID its a matter of getting the gain right to stop under/over shooting.
 

Thread Starter

atferrari

Joined Jan 6, 2004
4,425
Good job. And don't forget that Bob Pease had quite a bit to say about these kind of PID controllers. Here is one of his pertinent articles -- there were many others.
Yes, I run across it many years ago and recently, when decided to build my own PID controller, it was the first thing I reread in detail again and again. Maybe (sure!) for him, but not THAT simple to me.

In my search centered on Bob Pease, there are frequent mentions (even by himself) of another article about PID but couldn't find that one. The EDN site seems one of the most difficult to work with. Some articles you can download, other do not exist anymore and some are easy to access. Uneven quality so to speak.
 

Thread Starter

atferrari

Joined Jan 6, 2004
4,425
With my controller somewhat working, yesterday I rerun tests for P and PI modes still using radnom Kp & Ki values.

I do it manually, reading error and current through the resistor (plant) every 30 seconds. I am afraid I am going to use lot of time. My question:

In a plant, in real life, with processes involving big volumes, the actual calibration, how is it done? Actual tests, could take days, isn't it?

As an example, the PI test took 36 minutes and I had to stop it because of my work. BTW, the graph later showed a nice damped graph with the first two peaks just 7 minutes apart.

Not that I want to skip steps but I have not that much of time all the time.:( Lazy people is said to be sometimes intelligent.

Suggestions accepted and thanked in advance.
 
Top