# Gaggia Paros PID controller with Arduino



## thecardella (Mar 22, 2020)

Hi,

a few months ago, just in time for the lockdown to start, I bought a second hand Gaggia Paros. It's a beautiful machine and it took me a little while but eventually I learnt how to pull a decent espresso. I have already replaced the steam wand and I did the OPV mod (without really any benefit, so I might have done it wrong). What I was really curious to do was to add a PID controller for the water heater despite the risk of ruining the beauty of these analogical machines.

I have some experience with electronics and coding so taking inspiration from other similar projects (very helpful) I decided to make my own PID controller instead of buying a kit. I ended up using an Arduino, TSic306 digital temperature sensors and the usual cheap SSR from eBay. As said there are several other posts or blogs about adding a PID controller to a Gaggia Classic and I am sure they are better explained than mine, my hope is to help any owner of the Paros which is slightly different to the Classic in terms of electrical connections.

I am still polishing up the last bits but I have pushed the source on Github for anyone to use or contribute and I am also writing the documentation trying to explain what I did. I am sure that this work can be applied to a Gaggia Classic with the required considerations, probably the code won't even need any change.

Source code: https://github.com/ilcardella/GaggiaPIDController

Documentation: https://gaggiapidcontroller.readthedocs.io/en/latest/

Currently I am trying to tune the PID gains, I get a small overshoot that I'd like to remove, it's not too bad but I'm worried to break the sensors when heating up the water to steam temperature. Any advice on that is welcome. Also when the temp get over 145Deg C I get water out of the OPV valve (with the pump off) and a weird whistle noise, not sure if that is expected, but I guess it's due to the pressure.

After the PID tuning I still have to design and figure out how and where to set the external display enclosure, the documentation refers to my first approach that was to keep everything outside but eventually I decided to place all the electronics inside the machine and leave only the display out.

Any feedback or suggestion is welcome


----------



## justi (Jun 14, 2020)

Hi thecardella, I registered in the forum just to say a thank-you to for putting up your log and source code and I would love to see your pictures added! By chance I had also started on a similar venture also with a Gaggia Paros. (I've had mine for 20 years but had been underused for the past few years as we got good bean-to-cup machines at work and I got my fix there, now those ones are underused...)

I'm working on using a modified Sonoff TH device (cased and fits inside the Paros case) with Tasmota. Unfortunately I got stuck with the sensor, DS18B20 being not wide enough in range and then a terrible (fake? cheap) MAX31855 plus thermocouple combination not working at all. Now I've bought the fancy TSIC306 sensor that you used (as well as a LMT01) to try next week. Unfortunately neither of these are built into Tasmota so I'll have to port some Arduino code...


----------



## thecardella (Mar 22, 2020)

Hey thanks for the feedback! I hope you'll find something useful in the code and docs. The Paros is a beatiful machine, I was very lucky to find a second hand very well kept one (and cheap too!).

Since my initial post, I spent more time trying to tune the PID better and I found a much better response, what did the trick was to be more aggressive on the P gain. Now I get a small overshoot of ~3deg C and no oscillations after the target temperature is settled, I have been making coffees with these settings since then and I must confirm with the general considerations that a PID controller improve the consistency of the brewed espresso a lot!

In the repo I included a python script that can be used to read and plot the temperatures from the Arduino serial connection. This is the response after the tuning:



Spoiler














I admit I have been lazy and I did not update the documentation which still describes a different approach than what I actually did in the end. Also I still have not fixed the display in its final position, and currently it's attached with some tape on the right side of the machine, near the water tank. I'd like to move it in the front of the machine, in the gap between the grinder and the main group. But I need to "design" and 3D print some kind of holder first.

I was not aware of the Tasmota project, it seems very interesting and actually using an ESP8266 might just be generally a better approach in terms of updates OTA and PID tuning as you won't need to connect directly to the board. Have you considered using micro python? I recently found out about this python porting for ESP MCU and I am going to experiment with another project I have in the backlog.

I had some troubles with the TSic306 sensor assembly,: he brass standoff female screws are M4 and the TSOC is 4.5mm wide so even after smoothing the sensor corners they didn't really fit in and the only thing keeping everything together is the black heat sleeve and the thermal paste. Overall they works ok but I am afraid of touch them as they might just fall off the hex standoff. For some reason the sensor used for the steam stops giving reads when it reaches 145.9deg C, it might need some calibration. Also both sensors sometimes gives me a very strange read (1000deg C) so there might be room for improvements in there.

I was curious to try a Ktype thermocouple as they come already with a M4 adapter, I think I'll try that if/when one of the TSic breaks.

Let me know how it goes!


----------

