Tag Archives: Silvia

Life hack: Add a PID temperature controller to your espresso machine


… does seem to be a fair question. In my case: The brew thermostat of my Rancilio Silvia died. Changing a thermostat is perhaps just as boring as fixing a flat bicycle tire. Adding a PID controller to an espresso machine however is good fun. Which must serve as a good explanation.

Good temperature control is claimed to give both higher quality and more consistent quality of your coffee shots.

The PID controller keeps a much tighter control of the temperature variations compared to the on/off thermostat control – as expected!

But I have to say that the Rancilio delivered superb quality coffee before the PID controller was installed – and it still does after the installation of the PID controller. So at least I didn’t break anything which to a certain degree is also a measure of success.

Please be careful if you disassemble any 220 volt device.

220 volts can and will kill you if you get in contact with live wires!

Unplug the device before you even remove the first screw!


Let’s have a look at the parts list

Parts List

PID cont.SSRTemp. sensorMiscellaneous
Basically any off-the-shelf PID controller should do just fine. Important thing is that it has solid state relay control (SSR) output and not current output since it will be driving a solid state relay (obviously). Looking 10 years back PID controllers were horribly expensive. Nowadays there are some pretty cost effective reliable models for sale on eBay. Actually at the same cost as a genuine Rancilio brew relay.

I chose a DIN 1/16 size since it then fits nicely into my espresso machine or alternatively into  a standard project enclosure so my wife and children are out of harms way when operating the machine. I.e. the 220V terminals are packed away and out of reach. The model I choose was a SESTOS D1S, but you may get even cheaper once.

SESTOS 1DS PID temperature controller
SESTOS 1DS PID temperature controller

There is much to say about PID control. Which I will not. There are plenty of resources elsewhere on the internet. I my self am an engineer and have sort of a basic understanding of what to tune in the controls to get a certain response (without being an expert in any way!). Luckily the PID controller will normally have an Auto Tune program which does a fair job in setting the control parameters. Try it out and if some fine tuning is still needed, in the case of unacceptable temperature overshoot or too long heat-up time, then consult here or drop a post or read further down and see if you get anything useful out of my PID “theory” section 🙂

You will want at least a 10 Amp Solid State Relay (SSR) which can take the net voltage 110-220V. They are cheap and reliable components. SSR’s does consume a bit more power (i.e. generates more heat) compared to electromechanical relay devices. It is not critical since it load it has to carry in your machine is only around 4 Amp for 220V installations. As far as I can see there is a specified voltage drop of 1.6V which must add up to 5.6W heat dissipated. It’s not much. I tried having it running for 2 hours lying on the table when I fitted the PID. it went no warmer than 30 °C… But make sure to install it in a fairly well ventilated space and not too close to other objects. Like wires and plastic shields etc. The SSR is best mounted on a metal surface.

25 Amp Solid State Relay
25 Amp Solid State Relay

One disadvantage of the SSR over your current mechanical relay is perhaps worth mentioning. SSR’s have a tendency to fail “shorted” on their outputs, while electromechanical relay contacts tend to fail “open”. This means that in the unlikely case of the relay failing then the boiler in your espresso machine will continue boiling even after the set temperature is reached. Have this in mind but don’t worry about it. SSR’s are known to as very reliable components.

As you see there are 4 terminals. 1 and 2 should be connected such that they power the heating element. I.e. connect them to the two wires attached to you existing brew thermostat. It does not matter which you put were as long as the two wires goes to terminal 1 and 2. Terminals 3 and 4 are the control input side. So they are for the PID to operate. Note that they have a + and – and this should correspond with the current output on the PID. for the SESTOS the terminals are SSR3 goes to PID8 and SSR4 goes to PID6.
On the advantage side you will have a completely silent relay when the SSR is in operation since there are no moving parts (no more “click-click” sound).

This is a (nearly irrelevant) discussion on it’s own. Several types of thermocouples exist but you just need one which is of the correct input type for your PID (see PID manual) and which covers the temperature range it is operating in. I chose a k-type sensor which was easy to mount and was available with a nicely insulated steel reinforced wire. The sensor type is a general purpose one which covers many applications more aggressive than an espresso machine mount so it will do just fine. As you see it’s response is also squat in the middle of the field when comparing the different thermocouple types available. But make your own pick. You coffee will taste the same I’m sure.

Thermocouple response overview
Thermocouple response overview
K-type thermocouple
K-type thermocouple

Note that you can cut off the end of the thermocouple and basically shorten it to any desired length. Just expose to two wires and twist hard them to ensure a good connection between them.

An important thing is the safety when you are dealing with 220V. So you need to make sure that all live wire terminals are well protected and out of reach. So you will need a casing for your PID control box. In my case I chose a DIN 1/16 size PID and measured out that it would fit inside the espresso machine. You may not want to cut a hole in your favourite household appliance! So alternatively you can mount it on the outside of the machine, but then put it in a project enclosure. These are readily available on eBay. The cut-out size for DIN 1/16 is 45X45 mm. If you find a box with an end plate a bit larger than this it is easy to unscrew the end plate. Make the cut-out and re-mount it with the PID installed.

Search the Electronic Components section on eBay for “project enclosures” and make your pick.

How is it all connected?

Some photos and drawings which may be of help if you want to try this out yourself:
click to enlarge

Connecting PID, SSR and thermocouple
Connecting PID, SSR and thermocouple
Connecting PID, SSR and thermocouple


The PID controller most likely have an auto tune program/feature. Let your espresso machine heat up for 30 min and then deploy the auto tuning. This lets the PID analyse the response of the system and set the gain or time parameters.

Try it out and see if you are happy with the result. In my own experience you will benefit from adjusting the parameters manually afterward. The main reason is that the auto tune wile most likely find the optimal set of parameters to include a good portion of integral action. Where this is a good thing to keep an almost undisturbed system stable it is not necessarily good for the system response you want of your espresso machine. When you press the brew button, cold water will flow to the boiler and the temperature will drop rapidly for a short time as you brew. Having a lot of integral action available in the control strategy will interpret this as a temperature which is offset even though heat is supplied. I.e. the integrated error will increase quite a lot during the seconds you brew. To make up for this, heat is supplied to the system until the error is again low resulting in a temperature overshoot of several degrees after each brew. This was NOT what you wanted. To avoid this set the integral gain/time low and compensate with differential instead. This worked for me. The temperature is at present time not quite as stable as it was using the auto tune parameters. But I manage with the +/- 0.7 °C temperature variations I’m seeing. Speed in getting to the set value and stable post-brew response is more important to me than +/- 0.1°C accuracy of the steady state temperature.

Enough silly talk about control strategy. You basically just wanted a cup of coffee right? 😉
So without further ado:

PID installed and ready to brew ;-)
PID installed and ready to brew 😉