Coffee machine PID controller

My beloved 1976 La Pavoni Europicolla coffee machine is in need of an upgrade. I’m wanting to add a PID controller to the boiler, and wonder if I’m on the right track. I have an electrician for a father, who is happy to deal with the 240VAC side of things.
Ideally I would like to fit everything in the base of the machine, though if needed I could put it into an external box. ie I would prefer everything to be compact.
I’m thinking of using a RPi Pico for the PID controller, and a screw-in DS 18B20 IC sensor, along with the 40A SSR from Sparkfun.
The machine would have two settings - one full-on for steaming, the other controlled by a PID program on the Pico. I would experiment with different temperatures but probably around 92 deg C is where I’ll end up. I would switch between the two with a 3-way rocker switch. The pico would be powered by a power supply such as this one
Circuit diag 2022_04_06
Am I thinking of the best sensor? Is the Pico the right tool for the job? Any thoughts on waterproofing? Am I right in thinking that I would use a slow PWM for the element (say, 1Hz) to avoid excessive switching?
All constructive comments welcome!

4 Likes

Hi Andrew

Probably. Another thing to think of. The switching pulses whether on or off should be longer than 10ms as the SSR will probably be a zero crossing switch type and anything shorter than 10ms would not guarantee a switch.
As for the Pico being suitable I am afraid I have no idea at the present.
Cheers Bob

2 Likes

Hi Andrew,

Looks like you’ve got most of your ducks in a row already, I can say that the Pico is cheap, fast, and very easy to work with in MicroPython.

Seems there is a simple PID library around already, so most of your work is likely already done!
https://micropython-simple-pid.readthedocs.io/en/latest/

-James

1 Like

Hi again. I’m pretty close to finalising this project and I’m currently tuning the PID controller.



IMG_3071

At the moment I’m looking for a way to display the temperature beside the switch. For reasons of quality finish, I think this would have to be a panel-mount device. I’d be happy with a 7 segment display with 3 or 4 digits, but could also go to a LCD display. Round would be easiest to fit, but also happy with rectangular. Waterproof, pico-friendly, preferably around 25mm diameter.
There are plenty of displays out there with built-in Volt or Amp meters, or built in temperature sensors, but I want one to which I can write from the pico. I would have thought this would be a relatively easy find, but after a couple of hours searching I haven’t had any luck.
Anyone out there have ideas?

3 Likes

Not panel mount, but easy to write to from the Pico using a graphic image for the display. Text on this panel is very small. Placed behind a perspex panel it would probably be ok and its 25.4mm square.

Regards
Jim

2 Likes

HI @Andrew132975
I would love to see a final working version of this when youre ready!
Loving that gorgeous machine. :heart_eyes:
Where are you taking your temperature reading from? The boiler or the basket?

1 Like

Thanks, @Pixmusix!
I will definitely post a final photo.
I had my elderly uncle turn up a brass rod and drill a hole through it that fit the temp sensor exactly. I then drilled a hole in the base of the boiler cap and brazed it into place. So it is separate from the water, but hopefully the brass will conduct heat easily enough.
Cheers

2 Likes

Ah clever!! What are you aiming for temperature wise? Can that thing hit temps above 90?

1 Like

At the moment I’m assuming 93deg for espresso, and likely 120 for steaming. I can hit those temperatures OK. I’m pretty sure I’ve got the PID tuned now. Next step beans!

1 Like

That’s rad! Those lever machines are so impressive!

1 Like

Hi Andrew
I don’t think you can get above 100 until the water is gone and you are heating steam.
Called “Latent Heat” where a liquid turns to vapour, a solid turns to liquid and vice versa without a temperature change. These transformations though do require extra energy. I think the numbers used to be something like it takes 1 BTU to change 1 lb of water 1º F but it takes 11 BTU to change the form from liquid to solid (ice) without a temperature change. Don’t know what the numbers used to be from water to steam. They will be different now with decimal measurement but the principle remains the same.
Probably showing my age here with BTU (British Thermal Unit by the way) and º Farenheight but I have had no reason to look up the metric version as long as I know this sort of thing happens.
Cheers Bob

Add on: Earlier clothes driers I believe used this to detect when clothes were dry before the advent of modern or suitable humidity sensors. While ever there was moisture in the clothes the air could not get above 100ºC but as soon as they were dry the sudden rise in temperature was detected and this info used to shut down the heating.

1 Like

Hi Bob,

Since there coffee machine is a pressure vessel water is able to boil at higher temperatures thanks to the pressure increase, trying to simulate this for the coffee machine would be quite difficult.
Here’s some more info on the Temp, Pressure and Volume (Only 2 are required to calculate the phase) Phase diagram - Wikipedia

1 Like

Hi Liam
Yes this is all modifiable by pressure (such as a car pressure radiator) to increase the actual boiling point and in the case of water the addition of salt to lower the freezing point but the latent heat situation still applies. I the case of pressure you won’t get any steam until the higher temperature is reached. Admittedly this could be an advantage in the coffee making instance where steam is used to heat milk. It would accelerate this task.
Cheers Bob
Interesting graph, will have a look at that article for interest later.

1 Like

Liam’s right. The boiler is a pressure vessel so can boil at higher temperature. In fact the newer models (mine is 1976) use a pressurestat in lieu of a thermostat to maintain temperature. I’ve attached the graph of the fully-tuned controller, though in this instance I only raised the set point from 93 (espresso) to 113deg (steam) for the purposes of testing. I’ve set limits on the integral accumulator (I_accumulator) to prevent integral windup.

1 Like

Nice one! This reminds me… The LG washing machine I bought a few years ago is super annoying; it takes bloody ages to do its job, and lacking one of those old school timer dials, you have no indication how much longer it’s going to take, and no way to hurry it up…

Mechanically it’s pretty sweet, with an integral motor on the drum instead of a belt drive and so on… Maybe one of these days I’ll get ambitious enough to give it a brain transplant, with one of those OLED displays to show remaining time and stuff.

I’d wanna be able to knock it over pretty quick though - the missus would tear me a new one if it sat in pieces for more than a week…

I’m guessing there’s no repository of DIY open-source washing machine intelligence though.

…Anyway, I’m sure it’ll be fine - what could possibly go wrong, lol

Hi Andrew

You probably have the PID totally covered, but I found this series of articles really interesting in optimising PID operation. http://brettbeauregard.com/blog/2011/04/improving-the-beginners-pid-introduction/

Cheers, Steve

Thanks for that, Steve. His name pops up a lot and the original simple_pid module I tried.
Anyhoo, here’s the final product - and seems to make good coffee too.


(It was unfortunate that when I was descaling the group head with dilute vinegar, I caught covid so left it there for a week and discovered that chrome doesn’t like vinegar!)

3 Likes

LOOKS AMAZING :heart_eyes: