Microcontrollers and PID loops are two distinct subjects that can and should be explained separately even though the calculations for PID can be performed on a microcontroller.
Hey there guys, sorry for that late reply and lack of information. Pain in my leg joints ain't helping me to sit or stand long, so I typed briefly.
My brother is an ADP programme Biology and Chemistry teacher, and got some sort of molecular biology Masters, so yeah, he knows basic calculus.
For the PID - I explained the very basic on-off control to maintain the specific temperature, which seemed to allow him to understand. All the maths, I put them aside first (until he asked). I could whip up the PID controller for his coffee-maker, but there are ready made solutions in eBay which is much more cheaper.
However, the Arduino is slightly difficult, as I need to explain to him what is a microcontroller first. However, I did advised him to take up basic C/C++ and Matlab in case if he ever need to go into research again (as molecular biologist).
I suspect the problem is not the subject matter as much as Arduino deployment.
Arduino buffers the user from a lot that is going on. And gets off into 'metaphorical abstractions" where one is an artist producing sketches and wiring. I prefer to see this as 'metaphorical distraction. You are simply heaped layers of unnecessary code that take you further away from a lean and simple working example.
Yes, it can provide a PID controller, but to get to the fundamentals of microcontroller might take more digging. Arduino C++ uses libraries to create 'black boxes' that contain the details. You might consider the BasicStamp or the Propeller for code that actually shows you what the microcontroller does.
For a coffee maker, industrial thermostats have long been around and switch 115VAC and 240VAC. You just buy one that is the temperature target you desire and wire it in series with the device. If you still desire microcontrolled PID, you might include one of these thermostats at a bit higher setting than the control range to act as a failsafe device if something should go wrong (wrong code, wrong wiring, relay failure, and so on.)
Thermal code is an asymmetrical solution as you only correct error in one direction. Whereas motor control is symmetrical and you correct errors in both directions. So there may well be some additional code to allow timeouts for cooling off. And the sign maths of positive and negative errors might just use data from the positive side while timing out on the negative side.
Thermal control is not the ideal first learners example. But if that is his project and he has the maths already, it can still be done and rewarding.
How about forgetting about the micro-controller part altogether? At least for a while.
It seems your brother will have no problems with the maths required for PID. He could probably code one up if he knows a little programming. Or could soon learn enough programming skills to do so.
I think we sometimes forget that there is a lot to assimilate if you are new to it all: The micro-controller, the IDE, writing the software, messing with interfacing and a bit of electronics etc etc. That is a lot of time, effort and frustration.
He is into Biology and Chemistry and is a teacher perhaps he has enough to be doing already!
Of course I believe it would serve him well to get into programming a bit. And being able to control experiments or just log data from them might be great in the class room. Good for the kids to. To that end I would have him trying out coding on a PC. Perhaps using Python or Javascript. I would stay a way from C/C++, too much to learn and too many fiddly details that are nothing to do with whatever problems he may be tackling.
But what about the real-world interface part?
That's where you come in John Set him up with a Propeller system, linked to a PC with USB-serial. Have it provide the input and output interfacing he needs. Have it programmed to enable control of outputs via commands over serial and provide sensor telemetry data at regular intervals.
With that in place he could experiment and hack with code in the comfort of his PC and get real-world interaction. Without having to take time away from his expertise in Biology and teaching.
Over time he may be curious as to how to work with the MCU itself. Or not.
As if by magic someone on another thread has posted a link to a simple explanation and implementation of PID that does not depend on any sophisticated training in maths to understand. Right here on parallax.com and using the BASIC STAMP
I am trying to comprehend how a microcontroller might make better coffee with PID thermal control.
In all honesty, I can't think of any reason for a microcontroller at all. Just bring the water to a rolling boil, pour it through filtered coffee, and there you go.
Frankly I am very Old School about good coffee. It has to be hot and it has to be fresh to be properly enjoying.
Iced coffee is not coffee.
For good quality...........
A. Everything must be clean as it affects the taste.
B. The water needs to be soft (we have hard water in Kaohsiung and both tea and coffee suffer from it).
C. Using piping hot water for brewing -- even forced steam works; but NEVER EVER boil coffee after it has been brewed as it will sour.
Keeping coffee warm and reheating coffee can easily damage the brew.
It is best to pre-heat a nice thick mug by rinsing with boiling water if you want to drink slowly.
And the worst thing you can do is to serve coffee in a paper cup. It just cools very quickly.
I won't let Starbucks serve me coffee in a paper cup when it is not 'To Go' under any circumstances. You just end up with something as bad as iced coffee.
I am trying to comprehend how a microcontroller might make better coffee with PID thermal control.
I have no idea.
However, yesterday I crated a minor disaster by filling up the coffee machine with filter paper, coffee and water and turning it on. Twenty minutes later I came back to find coffee all over the kitchen work top, all over the floor and a whole mess in between.
I had forgotten to put the coffee pot back into the machine!
Clearly the whole coffee making process needs some MCU's to prevent misuse by us senile, absent minded old codgers!
All in all, it's better to stick to tea. Water boils when it boils. No temperature control required. Put it in the tea pot, wait five minutes, and you are done.
Aside: Strangely tea has more caffeine in it than coffee but it's a lot more relaxing.
Nope, a microcontroller won't work --- you just need a nurse.
It is not about caffeine. There are a couple of hundred oils and acids in coffee that nobody really is clear about what is doing what.
As near as I can figure, coffee is all a flavor extraction process. The green bean is useless. First it requires a dry roast and then a steam or wet heat extraction process.
I did have a friend with a cold water coffee maker that extracted a liquor without any heat and to which you were suppose to add hot water to taste -- but it never did taste right.. a bit oily and sour in fact.
The problem is that once the heat is used to extract the coffee, it is done. More heat will damage the flavor. That is exactly why 'freeze-dried instant coffee' was developed. Conventional instant coffee just boiled off the water and ruined the flavor.
A coffee percolator is a terrible device as it boils unfinished coffee while making the coffee. Even just making 'camp coffee' by tossing a cup of ground coffee into a pot of boiling water and removing it from the heat is far superior to percolator coffee.
++++++++++
Microcontroller sales have actually grown substantially in recent years. But I doubt that I want a microcontroller doing my cooking. It is an art that is well worth preserving. The ritual is as important as the product.
PID is really great for navigation or precision 3D milling, not kitchen arts.
I think my current "nurse" would like to just drag me out to the back of the sauna an finish me off with an axe. Or perhaps leave me out on the ice in the winter.
I have no idea how this works in the human metabolism but my chemistry nerd friends show me diagrams of caffeine, LSD, THC molecules and other mind altering substances and point out how similar they all are. It is striking.
I agree, camp coffee is best. In fact I prefer Nescafe instant coffee to the elaborately cooked by machine style everyone likes around here.
Does anybody cook anything any more? The last person I knew that appreciated food and it's preparation and presentation, yes the ritual, was an Italian.
Cooking is fun once you get the hang of it. When I have the time to do it, I do. Nothing fancy mostly a mix of Mexican, Italian and American dishes. Every young boy should learn the fundamentals of preparing and cooking food. It's empowering.
And you can't go wrong with slow cooking. Great for soups and tender, juicy meat. Toss the ingredients in and 4-6 hours later it's done.
Ooh and it's a money saver if you're on a budget like me. Eating out can get expensive fast. Pretty soon you're eating the equivalent of a new car payment every month if you don't watch it. A person could easily spend $20-30 a day on fast food. It's not cheap like it used to be. Besides the fast food fare isn't that pleasant.
Seriously, one thing every guy should be told early in life, is by a cheap slow cooker for $20.
Wish I had known this earlier....
Throw your beef, potatos and carrots into it, start it up, then go to work.
Return home with a loaf of Italian bread or fresh baguette, and you're good to go.
Prep time, 2 minutes to get plates and silverware, and cut the bread.
Almost as good as Mom made, probably cheaper than McD's $5-6 combo meal, and far better for you, aside from probably more food than you can stuff into yourself.
Seriously, one thing every guy should be told early in life, is by a cheap slow cooker for $20.
Wish I had known this earlier....
Throw your beef, potatos and carrots into it, start it up, then go to work.
Return home with a loaf of Italian bread or fresh baguette, and you're good to go.
Prep time, 2 minutes to get plates and silverware, and cut the bread.
Almost as good as Mom made, probably cheaper than McD's $5-6 combo meal, and far better for you, aside from probably more food than you can stuff into yourself.
Just got one, so still exploring. Chilli is next.
Slow cookers are great. Use it often. One suggestion for making chilli's or other bean dishes with dried beans is to soak them in water overnight and add the rest of the ingredients in the morning before turning it on. Saves time and energy.
P = The further something is away from where you want it to be the harder you push it.
I = The longer something is away from where you want it to be the harder you push it.
D = The faster something moving away from where you want it to be the harder you push it.
Be sure to push in the right direction!
I have always looked at this a little differently:
P: Something is not where it should be, move in the direction to zero the difference
I: but if you just push towards it you may go too far, the closer you get to it the more you slow your approach so you don't run past goal (at least too far)
but I may be too slow to get to the goal in a reasonable period of time so the bigger the difference the harder I drive to the goal
So combining all these parts, somewhere the difference effects will be less than the integral effects and you should stop pushing about the time you get close to zero without going over (by very little) or oscillating about zero. Worked well in X-ray control.
Also, the Caxton Foster Book "Realtime Programming, Neglected Topics" has a good explanations on this topic. But that brings another thought. In this thread, there is one big thing missing that would have a major influence on helping someone to understand this. Graphs. P showing how the difference would zero then overshoot and oscillate about the zero point until stable. Then adding in the effects graphically of integral component to show how slowing (dampening) the response would cause much less overshoot and cause the oscillations to reduce much faster; but of course like all else there is no free lunch. the stability is paid for in reduced speed of achieving equilibrium. Then add in the effects of Differential so that the learner can see that with a greater difference, the effect if very fast and large but as the difference moves to zero, the effect becomes less and the integral begins to dominate, ending with the graph showing a very fast rise time and achieving zero with minimal overshoot and oscillations. I used to use this in training on one of the x-ray devices that went from plain PI control. (analog implementation of PI) then digital control for the PID voltage controller.
How about forgetting about the micro-controller part altogether? At least for a while.
It seems your brother will have no problems with the maths required for PID. He could probably code one up if he knows a little programming. Or could soon learn enough programming skills to do so.
I think we sometimes forget that there is a lot to assimilate if you are new to it all: The micro-controller, the IDE, writing the software, messing with interfacing and a bit of electronics etc etc. That is a lot of time, effort and frustration.
He is into Biology and Chemistry and is a teacher perhaps he has enough to be doing already!
Of course I believe it would serve him well to get into programming a bit. And being able to control experiments or just log data from them might be great in the class room. Good for the kids to. To that end I would have him trying out coding on a PC. Perhaps using Python or Javascript. I would stay a way from C/C++, too much to learn and too many fiddly details that are nothing to do with whatever problems he may be tackling.
But what about the real-world interface part?
That's where you come in John Set him up with a Propeller system, linked to a PC with USB-serial. Have it provide the input and output interfacing he needs. Have it programmed to enable control of outputs via commands over serial and provide sensor telemetry data at regular intervals.
With that in place he could experiment and hack with code in the comfort of his PC and get real-world interaction. Without having to take time away from his expertise in Biology and teaching.
Over time he may be curious as to how to work with the MCU itself. Or not.
Hey,
I didn't include the microcontroller part as he's not entirely familiar with these concepts. Once I heard him asking about building a colorimeter that can detect the change of color just right after titration. Didn't remember much what he asked though, but I'll ask him again later.
By the way the inputs from you guys are very enlightening. These examples can be used to explain to the students too apart from layman.
One can always make coffee too strong and add hot water to get to acceptable taste for everyone. But if you make a pot of coffee to weak, you have to start over with another pot. So if you have a big meeting, don't try to hit a perfect brew for everyone -- just make it strong and provide hot water for those that want it weaker.
So trying to titrate for color is rather absurd. Everyone desires something a bit different.
+++++++++++
Frank Freedman actually makes sense to me. Maybe I am finally getting a layman's understanding of PID.
+++++++++++
I think we could be a automated mug warmer that uses a microcontroller and PID for a conveyor belt that keeps mugs ready according to the number of customers that walk in the door and line up to order.
Oh my! At least I can turn out a good cup of coffee for a big crowd.
Try reading this... (per corrections)
PD: It may be too slow to get to the goal in a reasonable period of time so the bigger the difference the harder I drive to the goal
I P: Something is not where it should be, move in the direction to zero the difference
DI: If you just push towards it you may go too far, the closer you get to it the more you slow your approach so you don't run past goal (at least too far)
It's always a problem putting such ideas into words. How to capture the essence of the idea without being ambiguous or unclear.
P: Something is not where it should be, move in the direction to zero the difference
This is true. But the essence of "P" is "proportional" which is missing here. This could be a "bang-bang" controller.
I: but if you just push towards it you may go too far, the closer you get to it the more you slow your approach so you don't run past goal (at least too far)
True but this is not describe "integral" control. Sounds more like "P".
but I may be too slow to get to the goal in a reasonable period of time so the bigger the difference the harder I drive to the goal
This is true but it is not describing "differential" control. Again it sound more like "P".
@Loopy:
P: It may be too slow to get to the goal in a reasonable period of time so the bigger the difference the harder I drive to the goal
Yep, that says "proportional" to me.
I: Something is not where it should be, move in the direction to zero the difference
Again that is true but it says nothing about integral control. I could be describing a simple babg-bang controller.
If you just push towards it you may go too far, the closer you get to it the more you slow your approach so you don't run past goal (at least too far)
This sounds like a description of proportional control. Differential control says nothing about the size of the error, only the rate
at which the error is changing.
Having said all that I'm sure my descriptions could do with some tightening up. I now think it is necessary to be more explicit
about the "error". There is where you want to be, and there is where you are. The difference between those things is the "error".
We than have three ways to arrive at a corrective output based on that error. Basically the instantaneous value of the error measurement,
the rate at which the error is changing and the cumulative error over time.
I have to think on this...
I agree with frank that pictures might help a lot.
Well,
Proportional, Integral, and Differential to me are all we formal math terms.
And of course, Integral and Differential are specifically Calculus terms.
I think I will reread the Wikipedia presentation in light of all the added commentary. I actually fear that some of us are trying to avoid learning the Calculus, and explaining through some imprecise analogy.
I do agree, "Proportional", "Integral", and "Differential" are all formal mathematical terms. And yes the latter two come from calculus.
However I don't believe a knowledge of calculus or even the use of those words is required to explain the essence of the ideas behind them to your averagely smart ten year old.
Consider: You want to move a car from A to B along the flat road. You want to do it as quickly as possible. But you don't want to overshoot and miss the point B. This suggests the bigger the distance between A and B the harder you hit the gas. As you get closer you hit the gas less. If A and B are the same place you don't hit the gas at all. You have arrived. This is proportional control.
Then: What if A is down hill from B? The rule above will suggest an amount that you hit the gas, dependent on distance, but you may not actually even start moving with that. You have to overcome gravity to even start climbing up the hill! This suggests hitting the gas harder and harder until you actually start moving up the hill. This is integral control.
Then, what if something suddenly starts moving you away from where you want to be? You can tell because the difference between A and B starts rising rapidly. It might be an idea to hit the gas to over come that influence. That is differential control.
My guess is that this kind of intuitive explanation can be developed. I especially believe this because often you will read statements by serious theoretical physicists, think Einstein or Susskind, that indicate they had the picture, the essence of the idea, in their minds long before they had the maths to back it up.
Or, on a slightly more mundane level, the article about PID that you linked to earlier tells how the whole PID thing came about from watching how helmsmen actually steer ships. The inventor of the PID did not just magically conjure it up from calculus. No he watched the helmsmen then developed a mathematical model of what they do. The PID already existed in those helmsmens minds!
@Heater
Okay, just produce a 10 year old that can teach PID to all of us and the debate will be settled.
In the meantime, you are just creating hypothetical 10 year olds to bolster your own believes.
Nothing wrong with developing an intuitive sense of PID. I suppose that is how I manage my motor scooter in traffic, or how the dog manages to stay on while I am driving. I and the dog just can't seem to make our microcontrollers work by intuition.
So I attempt to use maths to visualize the concepts in a way that they can port to a digial logic. Yes,... visualize, or envision.
I teach groups of kids. In the near future I'll try and see how young I can go with this.
Also, Frank did describe it wrong. Heater's initial description is basically correct. It might get worded better, but I can't word it better off the top of my head.
Good point. I may be over estimating 10 year olds, although I doubt it. Sadly I don't know any just now that I could produce as a demonstration. I have vague recollections of one, myself
Mind you, even that 10 year old totally rejected his fathers "intuitive" explanation as to why nothing can move faster than the speed of light.
No way would I compare any 10 year old human to your dog!
It seems that some people think in pictures and visions of a supposed reality, others get immersed in logic and symbolic manipulation.
Something to do with "left brain" and "right brain" they tell me.
To me, those logical manipulations of symbols in the abstract mathematical way are very wonderful things, but often it seems they just obscure a deeper "gut feeling" or picture of what is going on. I have to see the picture, get the idea, before the symbols make any sense.
For example:
Newton's idea about gravity is that F = (G * m1 * m2) / (r * r)
That's great and all and allows one to deduce many things. But what is it actually? Those symbols and that equation do not tell you.
Draw a picture of 3D space and a gravitational field and you become convinced it cannot be any other way!
And so it goes even today. If you are up for an hour long video about how the "intuitive" thinkers in physics arrive at results before the logical symbol manipulators of pure mathematics check out this amazing story by Robbert Dijkgraaf
Seriously, one thing every guy should be told early in life, is by a cheap slow cooker for $20.
Wish I had known this earlier....
Throw your beef, potatos and carrots into it, start it up, then go to work.
Return home with a loaf of Italian bread or fresh baguette, and you're good to go.
Prep time, 2 minutes to get plates and silverware, and cut the bread.
Almost as good as Mom made, probably cheaper than McD's $5-6 combo meal, and far better for you, aside from probably more food than you can stuff into yourself.
Just got one, so still exploring. Chilli is next.
Let me add my 2¢. I live in an apartment. I decided to grow herbs in pots overhanging the railing outside my door. I can snip and add them to meals all season long.
Makes slow cooked meals even better.
When I have been asked to describe it I have generally said something along the lines of the following.
To move an object from position A to position B using PID control:
Proportional - is the applied force that is proportional to the difference between position A and B.
Integral - is the applied force based on the rate of change of the error. If the error changes rapidly I is very low or may even be negative. If the error changes slowly it is higher.
Derivative - is the applied force based on the predicted value of the error.
In this case the derivative element is being driven only from plant feedback. The plant feedback is subtracted from the command signal to generate an error. This error signal drives the proportional and integral elements. The resulting signals are added together and used to drive the plant. I haven't described what these elements do yet-we'll get to that later. I've included an alternate placement for the proportional element (dotted lines)-this can be a better location for the proportional element, depending on how you want the system to respond to commands.
Integral - is the applied force based on the rate of change of the error. If the error changes rapidly I is very low or may even be negative. If the error changes slowly it is higher.
That is not integral. It is differential. "rate of change of the error" is the differential with respect to time of the error.
@xanadu,
Interesting diagram.
It shows the derivative term as being the derivative of the actual feed back signal rather than the derivative of the error. This is not how PID is usually defined but can have advantages, it is less sensitive to rapid changes in set point.
Also I wonder what is going on with that dotted "P" box. Again taking the "P" term from the actual feed back rather than the error. Never seen that before.
Oddly in the example code in that article the derivative and proportional terms are taken from the error not the feedback.
Comments
My brother is an ADP programme Biology and Chemistry teacher, and got some sort of molecular biology Masters, so yeah, he knows basic calculus.
For the PID - I explained the very basic on-off control to maintain the specific temperature, which seemed to allow him to understand. All the maths, I put them aside first (until he asked). I could whip up the PID controller for his coffee-maker, but there are ready made solutions in eBay which is much more cheaper.
However, the Arduino is slightly difficult, as I need to explain to him what is a microcontroller first. However, I did advised him to take up basic C/C++ and Matlab in case if he ever need to go into research again (as molecular biologist).
Arduino buffers the user from a lot that is going on. And gets off into 'metaphorical abstractions" where one is an artist producing sketches and wiring. I prefer to see this as 'metaphorical distraction. You are simply heaped layers of unnecessary code that take you further away from a lean and simple working example.
Yes, it can provide a PID controller, but to get to the fundamentals of microcontroller might take more digging. Arduino C++ uses libraries to create 'black boxes' that contain the details. You might consider the BasicStamp or the Propeller for code that actually shows you what the microcontroller does.
For a coffee maker, industrial thermostats have long been around and switch 115VAC and 240VAC. You just buy one that is the temperature target you desire and wire it in series with the device. If you still desire microcontrolled PID, you might include one of these thermostats at a bit higher setting than the control range to act as a failsafe device if something should go wrong (wrong code, wrong wiring, relay failure, and so on.)
Thermal code is an asymmetrical solution as you only correct error in one direction. Whereas motor control is symmetrical and you correct errors in both directions. So there may well be some additional code to allow timeouts for cooling off. And the sign maths of positive and negative errors might just use data from the positive side while timing out on the negative side.
Thermal control is not the ideal first learners example. But if that is his project and he has the maths already, it can still be done and rewarding.
How about forgetting about the micro-controller part altogether? At least for a while.
It seems your brother will have no problems with the maths required for PID. He could probably code one up if he knows a little programming. Or could soon learn enough programming skills to do so.
I think we sometimes forget that there is a lot to assimilate if you are new to it all: The micro-controller, the IDE, writing the software, messing with interfacing and a bit of electronics etc etc. That is a lot of time, effort and frustration.
He is into Biology and Chemistry and is a teacher perhaps he has enough to be doing already!
Of course I believe it would serve him well to get into programming a bit. And being able to control experiments or just log data from them might be great in the class room. Good for the kids to. To that end I would have him trying out coding on a PC. Perhaps using Python or Javascript. I would stay a way from C/C++, too much to learn and too many fiddly details that are nothing to do with whatever problems he may be tackling.
But what about the real-world interface part?
That's where you come in John Set him up with a Propeller system, linked to a PC with USB-serial. Have it provide the input and output interfacing he needs. Have it programmed to enable control of outputs via commands over serial and provide sensor telemetry data at regular intervals.
With that in place he could experiment and hack with code in the comfort of his PC and get real-world interaction. Without having to take time away from his expertise in Biology and teaching.
Over time he may be curious as to how to work with the MCU itself. Or not.
http://learn.parallax.com/pid-control
In all honesty, I can't think of any reason for a microcontroller at all. Just bring the water to a rolling boil, pour it through filtered coffee, and there you go.
Frankly I am very Old School about good coffee. It has to be hot and it has to be fresh to be properly enjoying.
Iced coffee is not coffee.
For good quality...........
A. Everything must be clean as it affects the taste.
B. The water needs to be soft (we have hard water in Kaohsiung and both tea and coffee suffer from it).
C. Using piping hot water for brewing -- even forced steam works; but NEVER EVER boil coffee after it has been brewed as it will sour.
Keeping coffee warm and reheating coffee can easily damage the brew.
It is best to pre-heat a nice thick mug by rinsing with boiling water if you want to drink slowly.
And the worst thing you can do is to serve coffee in a paper cup. It just cools very quickly.
I won't let Starbucks serve me coffee in a paper cup when it is not 'To Go' under any circumstances. You just end up with something as bad as iced coffee.
However, yesterday I crated a minor disaster by filling up the coffee machine with filter paper, coffee and water and turning it on. Twenty minutes later I came back to find coffee all over the kitchen work top, all over the floor and a whole mess in between.
I had forgotten to put the coffee pot back into the machine!
Clearly the whole coffee making process needs some MCU's to prevent misuse by us senile, absent minded old codgers!
All in all, it's better to stick to tea. Water boils when it boils. No temperature control required. Put it in the tea pot, wait five minutes, and you are done.
Aside: Strangely tea has more caffeine in it than coffee but it's a lot more relaxing.
It is not about caffeine. There are a couple of hundred oils and acids in coffee that nobody really is clear about what is doing what.
As near as I can figure, coffee is all a flavor extraction process. The green bean is useless. First it requires a dry roast and then a steam or wet heat extraction process.
I did have a friend with a cold water coffee maker that extracted a liquor without any heat and to which you were suppose to add hot water to taste -- but it never did taste right.. a bit oily and sour in fact.
The problem is that once the heat is used to extract the coffee, it is done. More heat will damage the flavor. That is exactly why 'freeze-dried instant coffee' was developed. Conventional instant coffee just boiled off the water and ruined the flavor.
A coffee percolator is a terrible device as it boils unfinished coffee while making the coffee. Even just making 'camp coffee' by tossing a cup of ground coffee into a pot of boiling water and removing it from the heat is far superior to percolator coffee.
++++++++++
Microcontroller sales have actually grown substantially in recent years. But I doubt that I want a microcontroller doing my cooking. It is an art that is well worth preserving. The ritual is as important as the product.
PID is really great for navigation or precision 3D milling, not kitchen arts.
I think my current "nurse" would like to just drag me out to the back of the sauna an finish me off with an axe. Or perhaps leave me out on the ice in the winter.
I have no idea how this works in the human metabolism but my chemistry nerd friends show me diagrams of caffeine, LSD, THC molecules and other mind altering substances and point out how similar they all are. It is striking.
I agree, camp coffee is best. In fact I prefer Nescafe instant coffee to the elaborately cooked by machine style everyone likes around here.
Does anybody cook anything any more? The last person I knew that appreciated food and it's preparation and presentation, yes the ritual, was an Italian.
And you can't go wrong with slow cooking. Great for soups and tender, juicy meat. Toss the ingredients in and 4-6 hours later it's done.
Ooh and it's a money saver if you're on a budget like me. Eating out can get expensive fast. Pretty soon you're eating the equivalent of a new car payment every month if you don't watch it. A person could easily spend $20-30 a day on fast food. It's not cheap like it used to be. Besides the fast food fare isn't that pleasant.
Seriously, one thing every guy should be told early in life, is by a cheap slow cooker for $20.
Wish I had known this earlier....
Throw your beef, potatos and carrots into it, start it up, then go to work.
Return home with a loaf of Italian bread or fresh baguette, and you're good to go.
Prep time, 2 minutes to get plates and silverware, and cut the bread.
Almost as good as Mom made, probably cheaper than McD's $5-6 combo meal, and far better for you, aside from probably more food than you can stuff into yourself.
Just got one, so still exploring. Chilli is next.
Slow cookers are great. Use it often. One suggestion for making chilli's or other bean dishes with dried beans is to soak them in water overnight and add the rest of the ingredients in the morning before turning it on. Saves time and energy.
I have always looked at this a little differently:
P: Something is not where it should be, move in the direction to zero the difference
I: but if you just push towards it you may go too far, the closer you get to it the more you slow your approach so you don't run past goal (at least too far)
but I may be too slow to get to the goal in a reasonable period of time so the bigger the difference the harder I drive to the goal
So combining all these parts, somewhere the difference effects will be less than the integral effects and you should stop pushing about the time you get close to zero without going over (by very little) or oscillating about zero. Worked well in X-ray control.
Also, the Caxton Foster Book "Realtime Programming, Neglected Topics" has a good explanations on this topic. But that brings another thought. In this thread, there is one big thing missing that would have a major influence on helping someone to understand this. Graphs. P showing how the difference would zero then overshoot and oscillate about the zero point until stable. Then adding in the effects graphically of integral component to show how slowing (dampening) the response would cause much less overshoot and cause the oscillations to reduce much faster; but of course like all else there is no free lunch. the stability is paid for in reduced speed of achieving equilibrium. Then add in the effects of Differential so that the learner can see that with a greater difference, the effect if very fast and large but as the difference moves to zero, the effect becomes less and the integral begins to dominate, ending with the graph showing a very fast rise time and achieving zero with minimal overshoot and oscillations. I used to use this in training on one of the x-ray devices that went from plain PI control. (analog implementation of PI) then digital control for the PID voltage controller.
Hey,
I didn't include the microcontroller part as he's not entirely familiar with these concepts. Once I heard him asking about building a colorimeter that can detect the change of color just right after titration. Didn't remember much what he asked though, but I'll ask him again later.
By the way the inputs from you guys are very enlightening. These examples can be used to explain to the students too apart from layman.
One can always make coffee too strong and add hot water to get to acceptable taste for everyone. But if you make a pot of coffee to weak, you have to start over with another pot. So if you have a big meeting, don't try to hit a perfect brew for everyone -- just make it strong and provide hot water for those that want it weaker.
So trying to titrate for color is rather absurd. Everyone desires something a bit different.
+++++++++++
Frank Freedman actually makes sense to me. Maybe I am finally getting a layman's understanding of PID.
+++++++++++
I think we could be a automated mug warmer that uses a microcontroller and PID for a conveyor belt that keeps mugs ready according to the number of customers that walk in the door and line up to order.
Try reading this... (per corrections)
P D: It may be too slow to get to the goal in a reasonable period of time so the bigger the difference the harder I drive to the goal
I P: Something is not where it should be, move in the direction to zero the difference
D I: If you just push towards it you may go too far, the closer you get to it the more you slow your approach so you don't run past goal (at least too far)
It's always a problem putting such ideas into words. How to capture the essence of the idea without being ambiguous or unclear.
This is true. But the essence of "P" is "proportional" which is missing here. This could be a "bang-bang" controller. True but this is not describe "integral" control. Sounds more like "P". This is true but it is not describing "differential" control. Again it sound more like "P".
@Loopy:
Yep, that says "proportional" to me. Again that is true but it says nothing about integral control. I could be describing a simple babg-bang controller. This sounds like a description of proportional control. Differential control says nothing about the size of the error, only the rate
at which the error is changing.
Having said all that I'm sure my descriptions could do with some tightening up. I now think it is necessary to be more explicit
about the "error". There is where you want to be, and there is where you are. The difference between those things is the "error".
We than have three ways to arrive at a corrective output based on that error. Basically the instantaneous value of the error measurement,
the rate at which the error is changing and the cumulative error over time.
I have to think on this...
I agree with frank that pictures might help a lot.
Proportional, Integral, and Differential to me are all we formal math terms.
And of course, Integral and Differential are specifically Calculus terms.
I think I will reread the Wikipedia presentation in light of all the added commentary. I actually fear that some of us are trying to avoid learning the Calculus, and explaining through some imprecise analogy.
https://en.wikipedia.org/wiki/Control_theory
I do agree, "Proportional", "Integral", and "Differential" are all formal mathematical terms. And yes the latter two come from calculus.
However I don't believe a knowledge of calculus or even the use of those words is required to explain the essence of the ideas behind them to your averagely smart ten year old.
Consider: You want to move a car from A to B along the flat road. You want to do it as quickly as possible. But you don't want to overshoot and miss the point B. This suggests the bigger the distance between A and B the harder you hit the gas. As you get closer you hit the gas less. If A and B are the same place you don't hit the gas at all. You have arrived. This is proportional control.
Then: What if A is down hill from B? The rule above will suggest an amount that you hit the gas, dependent on distance, but you may not actually even start moving with that. You have to overcome gravity to even start climbing up the hill! This suggests hitting the gas harder and harder until you actually start moving up the hill. This is integral control.
Then, what if something suddenly starts moving you away from where you want to be? You can tell because the difference between A and B starts rising rapidly. It might be an idea to hit the gas to over come that influence. That is differential control.
My guess is that this kind of intuitive explanation can be developed. I especially believe this because often you will read statements by serious theoretical physicists, think Einstein or Susskind, that indicate they had the picture, the essence of the idea, in their minds long before they had the maths to back it up.
Or, on a slightly more mundane level, the article about PID that you linked to earlier tells how the whole PID thing came about from watching how helmsmen actually steer ships. The inventor of the PID did not just magically conjure it up from calculus. No he watched the helmsmen then developed a mathematical model of what they do. The PID already existed in those helmsmens minds!
Okay, just produce a 10 year old that can teach PID to all of us and the debate will be settled.
In the meantime, you are just creating hypothetical 10 year olds to bolster your own believes.
Nothing wrong with developing an intuitive sense of PID. I suppose that is how I manage my motor scooter in traffic, or how the dog manages to stay on while I am driving. I and the dog just can't seem to make our microcontrollers work by intuition.
So I attempt to use maths to visualize the concepts in a way that they can port to a digial logic. Yes,... visualize, or envision.
Also, Frank did describe it wrong. Heater's initial description is basically correct. It might get worded better, but I can't word it better off the top of my head.
Good point. I may be over estimating 10 year olds, although I doubt it. Sadly I don't know any just now that I could produce as a demonstration. I have vague recollections of one, myself
Mind you, even that 10 year old totally rejected his fathers "intuitive" explanation as to why nothing can move faster than the speed of light.
No way would I compare any 10 year old human to your dog!
It seems that some people think in pictures and visions of a supposed reality, others get immersed in logic and symbolic manipulation.
Something to do with "left brain" and "right brain" they tell me.
To me, those logical manipulations of symbols in the abstract mathematical way are very wonderful things, but often it seems they just obscure a deeper "gut feeling" or picture of what is going on. I have to see the picture, get the idea, before the symbols make any sense.
For example:
Newton's idea about gravity is that F = (G * m1 * m2) / (r * r)
That's great and all and allows one to deduce many things. But what is it actually? Those symbols and that equation do not tell you.
Draw a picture of 3D space and a gravitational field and you become convinced it cannot be any other way!
And so it goes even today. If you are up for an hour long video about how the "intuitive" thinkers in physics arrive at results before the logical symbol manipulators of pure mathematics check out this amazing story by Robbert Dijkgraaf
Makes slow cooked meals even better.
Just now I have a balcony full of chilli bushes, looks like they are not going to ripen before winter sets in.
To move an object from position A to position B using PID control:
Proportional - is the applied force that is proportional to the difference between position A and B.
Integral - is the applied force based on the rate of change of the error. If the error changes rapidly I is very low or may even be negative. If the error changes slowly it is higher.
Derivative - is the applied force based on the predicted value of the error.
In this case the derivative element is being driven only from plant feedback. The plant feedback is subtracted from the command signal to generate an error. This error signal drives the proportional and integral elements. The resulting signals are added together and used to drive the plant. I haven't described what these elements do yet-we'll get to that later. I've included an alternate placement for the proportional element (dotted lines)-this can be a better location for the proportional element, depending on how you want the system to respond to commands.
Original text.
@xanadu,
Interesting diagram.
It shows the derivative term as being the derivative of the actual feed back signal rather than the derivative of the error. This is not how PID is usually defined but can have advantages, it is less sensitive to rapid changes in set point.
Also I wonder what is going on with that dotted "P" box. Again taking the "P" term from the actual feed back rather than the error. Never seen that before.
Oddly in the example code in that article the derivative and proportional terms are taken from the error not the feedback.