Since everyone here seems to be going on about the tech side and not the coffee side: if you find that your office's "fully automated" coffee machine produces bad coffee, tune it - they're all PIDs at their core. It may require some hacking in some cases as some manufacturers gate the settings for brew time, temperature, pressure and grind amount behind "service passwords".
In most cases it's the brew temperature that's at fault and "burns" the coffee - you have to match all four parameters to the beans you use and, especially in areas with high calcium carbonate or other minerals in the water, also the water source (if mineral content is too intense, you have to use a dedicated filter, no way of tuning will make good coffee out of shit water!).
Another all too common issue is that no one is responsible for cleaning the machine... these things have to get cleaned daily, deep cleaned weekly and the water filter at least monthly. And for heavens sake: don't use these Brita-style "open" water filters, and put the milk containers into a dedicated fridge, yes, even if it's "pasteurized" milk. Both is a serious risk for pathogen contamination.
tl;dr: good coffee means investing more time than just placing the machine in the kitchen, it actually needs tuning on inputs (beans, water) and processing (brewing parameters) to achieve a high quality output.
Milk is a perfect breeding ground for all sorts of nasty pathogens - it's a nutrient ffs. Better invest ~160€ [1] into a dedicated fridge than have half the office get the shits because someone forgot to put the milk back into the fridge over night. I've seen that happen, and if it's more serious it may actually lead to an OSHA/food safety inspection and serious fines.
And what about a second fridge makes it impossible to forget to put milk back in it?
Milk can be obtained in resealable plastic or glass bottles, which performs the same anti-contaminant task substantially more effectively, incidentally.
I think you have a wrong idea about the size of these milk fridges. These are small, separate units with just enough space to put a milk bottle into it. Via a tube, milk is directly fed from the cooled bottle inside the fridge into the coffee machine next to it without the bottle ever leaving the fridge.
These fridges are used for coffee machines where the machine dispenses the milk as well. They make sure that the machine always dispenses cold milk, instead of the milk (and its tube) being placed right next to the hot coffee machine exterior.
dedicated storage like this one [1] keeps the milk ready to use at all times, and minimizes the risk that someone in a hurry forgets to put the milk back to the fridge after making a coffee.
spot on, most ppl think that the beans are just bad, but making good coffee is complicated, and controlling variables is the key.
I recommend to make espresso right to some glass with ice (not much) and drink that with oat milk, or oat+dairy milk; currently it's my goto coffee that I really enjoy on hot days.
> This is where a PID controller comes into play. This advanced technology optimizes the brewing process
Calling something that first year electrical engineering students were getting taught in an introduction class 20 years ago (well 18 years ago in my case but it had been on the syllabus for at least two years at that point) is a little laughable.
> The first theoretical analysis and practical application of PID was in the field of automatic steering systems for ships, developed from the early 1920s onwards.
All engineering technology is like this. The core of machine learning is multi-variable calculus and optimization that has been taught to math students since at least the 60s.
I bet most EE graduates still couldn't provide a good interpretation of a transfer function or a Laplace transform.
The article has a lot of words and a lot of fluff. Long story short, any PID is always minimizing error (target value - desired value). You can imagine the proportional (the P) is just a linear scale like maybe 10W is required to increase the mass 1 degree). The intergration (the I) of the error takes care of steady state error (since you’re always taking the area between the target and desired). The derivative (the D) takes care of response since you’re taking the derivative of the error, aka the rate of change.
When your espresso machine has some thermal mass (eg E61 group head), then a simple bang-bang controller performs just as well as a PID. After tweaking PID controllers in drones, HVAC systems and my espresso machine, my experience is that PID's do more harm than good in systems with a lot of inertia and slow response.
High inertia/slow response is challenging to control systems in general, especially to linear systems like pure PIDs (especially if your 'slow response' is well modeled as transport delay, rather than just... slow response).
Bang-bang controllers with deadzones/hysteresis are really the simplest form of non-linear controllers, and so can do okay at something like an HVAC system, especially when precise tracking of target isn't needed. But you can strap all sorts of non-linear things (gain scheduling, hysteresis, etc) onto the form of PID to try to get decent macro scale behavior, while still having reasonable fine tracking performance. Though obviously, it becomes much much more complicated to tune.
If you know characteristics of the system, like thermal mass, inertia etc., then coupling feed-forward control along with the PID can help. The idea is that if you know the thermal mass (and you do for a coffee maker's internal elements), then you have a reasonable estimate of how many watts are needed to change the temp of those parts. So, don't make the PID put those watts in, instead just add them separately based on your simple physics model. The PID runs in parallel and corrects all the short-comings of your model.
Thanks, I never really understood feed-forward well, but modeling the thermal mass makes a lot of sense for keeping the terms in check.
(As I understood it in Betaflight, it overrides the PID controller and mixes setpoints directly into the output.)
I found it funny that if you did robotics this is the first thing they teach you, and in control systems they went onto other more "fancy" controllers, but never explained how to make PID work well for a range of systems.
Chances are, you’re probably tuning it incorrectly. Tuning is not an easy thing to do, but you should get much closer if you draw out the block diagram. At a minimum, even fuzzy logic would be better than bang on/off.
I'm familiar with algorithmic and manual tuning, and the more latency the system has, the more time consuming and harder it is to get right. Genuinely curious how a block diagram would help?
PID is the controller for a block diagram [1]. When you have the block diagram, you can predict the response graphs extremely reliably [2]. You should be extremely close to the desired coefficients and requires a little tuning. Especially for stuff like thermal and conduction that’s very well understood. You just need to draw the thermal circuit and know the spec of your hardware.
Most of the time people use PID, they use it as a black box which causes a lot of pain.
Control system was probably one of the hardest class I took for undergraduate. Unfortunately, it really requires a college course (mine had a lab too so you can some “real life” experience) to understand the beauty of PID controllers. Highly recommend sitting in a college course if you like this stuff!
I think you are confusing terms. You are saying latency, but I think you mean the time constant of the poles / zeros. When one speaks of latency in a control system, they general mean a real time delay, like a digital processing delay, communication delay, etc. When you speak of something having low-bandwidth, such as due to the thermal mass and heating element you are describing, then one would say it has a long time constant. I have never seen these systems any harder to implement with a PID provided you select the proper terms to keep it stable. If it is just a linear PID, it is going to need to be a slow loop in this case.
PID controllers require more tuning, which becomes harder with more latency in the system. They are more susceptible to integral windup: https://en.wikipedia.org/wiki/Integral_windup
They require an MCU, whereas a bang-bang controller can be done mechanically (or with analog components), keeping them simpler.
I would concur, especially with control devices that can turn on to heat.
Although, a lot of more basic controllers only handle binary states for input. I'd argue that a calibrated (bang-bang with thermistor/thermocouple) on an analog control would be much easier to tune and easier to implement. That way, the hysteresis could be dynamically tuned out of the system with a constant input to stabilize losses.
I did something similar to that with I experimented with a peltier heated 3d printing bed. I fried the first batch of peltiers since I wasn't aware they *HATED* binary states, and would die in a crack of the ceramic matrix. My next round was to implement "Using PWM to Generate an Analog Output" ( https://ww1.microchip.com/downloads/en/Appnotes/90003250A.pd... )
Since when does a PID controller need an MCU? You can build one out of op-amps, resistors, and capacitors. Whether you should is a different story.
(I’ve never been convinced that a PID controller really makes sense for a heater where there may not be much natural cooling going on, but that’s a different story.)
> Drone PIDs are hard, and a lot of that to do with the quickly moving targets which is not the case in many (most?) scenarios PIDs are used.
You can write a flyable PID in a few lines, and a full PID in a few more. Set the error term to the range-mapped input - angular rate measurement, for each axis. (Assuming you have the control inputs, gyro/acc inputs, and motor output IO setup)
I'm talking industrial PID and other consumer goods. Drones are just one place PIDs are used, though probably the most frequent place for interaction for software engineers on HN.
As for them being hard for drones... PIDs are built into the software which is easy enough to write but the drone characteristic is specific to both the configuration of the drone and the flight preference of the pilot. It can be hard to find an optimal PID setting for both, which is where it seems that most people are finding PID settings to be difficult.
Indeed, most modern approaces to controlling drones use other more advanced techniques that (ab)use the computational power of modern MCUs, PIDs are used only near the actuators to keep the motor torque within an optimal range or things like that. For the flight trajectory fancy drones use things like model predictive control combined with convex optimization algorithms to avoid obstacles very reliably (see for ex. [1]).
And, circling back to your point about where to use the PID: I think that perhaps we need to split things more finely: The fancy part of that video was WRT overall flight trajectory planning. (See also your obstacle avoidance descriptor). You might still use PID for the angular rate control (or not), while feeding those target rates from a higher-level algorithm that commands attitudes, flight paths etc. (Or flight path -> attitude -> angular rates etc)
I went down a rabbit whole of constant angular jerk and time-to-correct targets for a while, but wasn't able to get it working.
So, there are multiple layers involved for something like in the video. A properly-tuned PID works well for manual angular-rate controls, and autopilot commands that reduce down to angular-rate controls. But PID tuning can be tricky; and/or can be done automatically; or replaced with something more sophisticated.
The first image is a Rancilio Silvia espresso machine. If you like DIY, you can add your own PID with an ESP32 (wifi-enabled cheap microcontroler), a thermocouple (to measure the temperature of the boiler) and a solid-state relay (to turn on/off the boiler heating element) for less than $40. I did it in my own machine following this repo: https://github.com/rancilio-pid/clevercoffee. I have perfectly stable temperature, I can turn on the heating from my bed (with MQTT and HomeAssistant) and I used the occasion to fully understand how my machine works (which tbh is always a big part of the motivation for doing these kind of projects).
Although it’s designed for use with a Gaggia Classic a number of users on the Discord server have already successfully installed it on the Rancilio Silvia
The whole site is a dumpster of SEO spam and affiliate links for probably trashy products (hint: if the product was any good you wouldn't need to be paid to promote it).
Measuring at the group head is the critical part here, as opposed to at the boiler, because in most machines there is a lot of thermal mass which will actually equalize temperature fluctuations that happen on the scale of seconds or minutes. This means the effect of having a PID is less about smoothing out the short term fluctuations and more about the ability to set the average temperature
It’s easy to say “PID controllers are audiophile tech for coffee machines”, but the most basic construction for temperature control is a thermostat, and that has been good enough for Italian coffee machines for a very long time. A PID controller is positively space age technology compared to a bi-metal thermostat.
Where PID controllers shine is in well built but small capacity machines. A Silvia has a tiny 300mL boiler. If you’re pulling a double shot (60mL), you’re losing 20% of the heat just from pumping fresh water into the boiler.
Add a PID controller to the mix, the static losses are accounted for by the integral controller, and it will instantly ramp up the heat when you pull a shot via the derivative and proportional action. This would keep the temperature significantly more consistent during a 30 second shot.
A PID controller in this instance is transformative in turning a comparatively cheap machine into a very capable piece of kit.
In a larger machine with a 1L boiler pulling a shot barely causes a ripple in temperature because of the larger boiler capacity and additional heat inertia. They might benefit from a PID controller but it’s difficult to justify over the simplicity of a thermostat, and coffee machines have been around longer than electronics have been cheap.
"PID (Proportional, Integral, Derivative) works by continuously monitoring the boiler’s temperature and making small adjustments to maintain an exact and stable target temperature."
So basically a smart thermostat that accounts for ramp up and cool down times when adjusting the temperatures.
Yes and no. PID loops are linear systems and don't understand ramp-up and ramp-down times. They understand poles and zeros. So normally you would speak of time constants and bandwidths rather than ramp (slew) rates. This is not just semantics, they function differently. However is not unusual to add non-linear constraints on top of of linear control loop so you end up with a hybrid control system.
The PID is helpful to keep the boiler at a stable temperature because its volume is small but does little to keep the group head stable. The group itself gets either too hot or too cold and thats a much more challenging problem. The boiler has to be hotter than the group due to losses but you don’t want to be constantly circulating water either so a lot of trade offs have to happen.
One of the better ways I’ve seen is that the water tank is directly above the group. It makes the group very stable but unfortunately makes the machine itself prone to tipping due to high cg.
A couple days ago there was a thread on Hacker News that devolved into a discussion of what a comp-sci student learns in school that they can't learn by themselves. Control systems are a good example of something that is good to have a basic background in and can be hard to learn by yourself. I think it much easier to learn this topic in school because you have an instructor to answer questions and are surrounded by other students who you can discuss the topic with to help you gain intuition about all the math.
I think historically control theory might have been left out of compsci curricula because of is prerequisites that are not very relevant most other areas of the degree (complex analysis, spectral theory, continous time dynamical systems). Especially the "old" theory from the mid 20th century can get very difficult to study on your own because everything was described in term of continous time stochastic processes (which are very hard!). Interestingly as computers became powerful, throughout the 90s there was a shift towards discrete time or hybrid dynamics, and one could make a case that the former is teachable without too many prerequisited in compsci degrees. Distributed computation would especially benefits from having students that know a bit of control theory, or even networking where for instance control theory explains why a certain set of BGP policies / congestion control algorithms converge to a stable equilibrium and other do not.
Actually the article is wrong about this. "...compared to traditional thermostats found in many older espresso machine steam boilers". Older espresso machines mostly use a "pressostat": an adjustable pressurized diaphragm that triggers the heating element in the boiler.
In most cases it's the brew temperature that's at fault and "burns" the coffee - you have to match all four parameters to the beans you use and, especially in areas with high calcium carbonate or other minerals in the water, also the water source (if mineral content is too intense, you have to use a dedicated filter, no way of tuning will make good coffee out of shit water!).
Another all too common issue is that no one is responsible for cleaning the machine... these things have to get cleaned daily, deep cleaned weekly and the water filter at least monthly. And for heavens sake: don't use these Brita-style "open" water filters, and put the milk containers into a dedicated fridge, yes, even if it's "pasteurized" milk. Both is a serious risk for pathogen contamination.
tl;dr: good coffee means investing more time than just placing the machine in the kitchen, it actually needs tuning on inputs (beans, water) and processing (brewing parameters) to achieve a high quality output.