Coffee project

This is my espresso machine modification.

The machine is a Rancilio Silvia from 2010. Due to its simple design with thermostat, the temperature is fluctuating a lot. I have made it more stable with electronic PID regulation and I also added some other nice features. The water temperature is now stable at +/- 0.1 degrees instead of +/- 10 degrees.

This is a very popular machine to modify with PID regulation but most people just buy a PID regulator and install it. I have chosen to do it all myself which is not as common even though I have seen some other people doing similar projects with their Silvias. This of course demands that you know something about electronics and programming.

I don't know much about PID regulation so the tuning was a trial and error process for me but it seems like this application needs a low P-gain, a very low I-gain and a large D-gain to work properly. The temperature is sampled all the time and once per second the average of the samples is calculated. this gives a very stable measurement even though the ADC in the MCU is not the best. The PID algorithm then calculates how long the heater shall be turned on during the next second. The heating time is 0-1000ms in 4ms steps.

The new hardware consists of:
Microcontroller Atmel ATMega16 (8-bit)
Temperature sensor
Water level sensor (optical)
Solid state relay for heater
Mechanical relay for pump
LCD display 2x16 characters red on black
Menu buttons
RS-232 interface for logging to PC
Quartz for timekeeping

The state of the original 230V switches are detected with optocouplers

Software tools used were Atmel AVR Studio 4 (GNU Toolchain) and AVR JTAG ICE Mk2 debug interface.
The schematics were made with TinyCAD.

The machine now have these features:
- PID regulation of temperature with individual adjustable setpoints for coffee and steam.
- P, I and D parameters and setpoints adjustable from menu.
- Automatic turn-on in the morning. Different times for weekends and weekdays.
- Automatic turn-off when not used for a while (adjustable time).
- Steam automatically switched off after a timeout to prevent overheating.
- Espresso shot timer that will stop brewing after some time. Manual mode is also available.
- Shot counters that count total cups of coffe made and cups made since the machine was last cleaned.
- A warning pops up when it is time to clean the machine. The number of shots until message shows up is adjustable.
- A message tells when the water reservoir is almost empty and it is time to fill water.
- Time counter that shows how long the machine has been on.
- Serial temperature logging to PC.

I had to make a plastic cap to protect the electronics from steam coming up from the drip tray.

The only visible holes in the chassis is where the logo used to be so the machine can be fully restored to its original if needed.

Feel free to write any comments or questions below.

- Marcus Nilsson, 2011

Hardware listing
Source code
Original 230 VAC wiring
Modified 230 VAC wiring

Picture gallery




2011-03-22 23:10:59 RaphaŽl wrote:

Very nice project !!!

2011-03-20 17:50:32 Marcus wrote:

No offset implemented so far.

2011-03-16 03:37:22 Nathan Van Fleet wrote:


Did you implement a offset for the temperature? I read that usually it needs to be about 25F higher temperature because the outer boiler temperature registers higher heat than the interior (water)?