// Coffee PID controller - Hardware

I'd like to present my last project, a coffee PID controller. It has been designed to be used with La Pavoni Domus Bar coffee machine, but it can be attached to any similar hardware. This article describes hardware part, next part will discuss software.

 Controller on coffee machine

 PID Controller chassis

 Espresso Machine PID Controller

Preliminary design guidelines

  • minimal alteration of internal connections in coffee machine,
  • safety of use,
  • heater control (using embedded triac - external SSD is not required),
  • solenoid valve control,
  • pump control (for shot duration control, pressure profiling in future release),
  • timer and clock,
  • parameters shown in realtime on LCD
  • interface to change parameters of PID controller,
  • design similar to coffee machine.


Majority of home coffee machines use a simple dual-state (on-off) algorithm to keep constant temperature of boiler. As a result temperature varies considerably around a set point (SP). My device was originally equiped with 95°C thermostatic switch, which has a hysteresis of ±5 Celsius deegree. Please refer to circuit diagram. Using a more precise temperature measurement and clever algorithm allows to keep temperature aproximately constant during whole brewing proces.



Controller is based on Atmel ATMega16 microcontroller, which has 16KB flash memory to satisfy memory usage by LCD fonts/graphics. It has enough ports to connect all external I/O peripherals. All ICs are supplied to 3.3V VCC, because LCD and ADC doesn't support higher voltages.

I/O section

Controller has three fast optoisolated outputs and one optoisolated input. Fast means fast enough to control 50Hz AC using phase-control. BT138 triac used in project can control up to 8A on-state current (I_T_RMS), according to datasheet. Without radiator this current is significantly lower, but continuous control of 2kW heater doesn't make IC hot. Warning! Mounting base of triac is connected to 230V mains supply, so do not touch any part of device when powered.

Process value input section

Temperature is measured by a thermocouple mounted at top of boiler. MAX31855 IC is used to convert temperature to digital value. This IC has included a specialized signal conditioner with 14 bit A/D converter.

IC can also detect open circuit and shortcircuit to ground or VCC. Controller ground must not be galvanicaly connected with thermocouple (what is equivalent to coffee machine ground, unless thermocouple has isolated housing). Controller is galvanicaly isolated from controlled device, but if you connect serial port to grounded computer unit, foregoing condition is not met.

MAX31855 has built-in cold junction compensation and linear converter, so temperature value is available directly. IC is interfaced to MCU using SPI protocol.

User interface section

User interface is provided by LCD display and 4 keys on front panel.

Runtime parameters are displayed on LCD display. LCD is adopted from Nokia 6100/6110. It is based on Epson PCF8833 chipset.

Other peripherals

DS1307 is a RTC with I²C interface, but it includes also 56B of battery backed-up RAM memory.

EEPROM memory and battery backed-up RAM allow to keep settings when machine is powered off.

Board has an ISP connector to upload/download firmware. Additionaly, communication is provided using RS-232C UART interface with DB9 connector.

Chassis & front panel

Chassis is made of some stainless steel sheet, bended into box shape. Basis is made of PVC sheet, it holds PCB, rubber feet and steel chassis, and provides additional electrical insulation.

 Chassis is made of some stainless steel sheet, bended to box shape

Front panel PCB holds LCD socket and buttons. Front label is laminated into transparent foil. Proper displacement between PCB and foil is realized using spacer cut from 5.25” bay cover.


All parts are placed on double-sided PCB (main unit) and one-sided PCB (front panel).

 Schematic diagram - use link in text to see full sized version Schematic diagram (png) Schematic diagram (pdf)

 PCB PCB (png)

 Assembled PCB - top

 Assembled PCB - bottom



No. 1 @ 24-01-2017 17:16

Hi Tomasz

Nice work on your machine! I am currently working on a similar project for my own La Pavoni Domus, but Arduino-based instead. Out of curiosity, which values of P, I and D did you use? I built one with a friend for his Silvia and that turned out really well. However I have to tune the parameters differently for my own machine being that both boiler and heating element are smaller. It would be nice to compare the values I intend to use, with the ones you use in yours.

Best regards,


Leave a comment…

ESI If you can't read the letters on the image, download this .wav file to get them read to you.
  • E-Mail address will not be published.
  • Formatting:
    //italic//  __underlined__
    **bold**  ''preformatted''
  • Links:
    [[http://example.com|Link Text]]
  • Quotation:
    > This is a quote. Don't forget the space in front of the text: "> "
  • Code:
    <code>This is unspecific source code</code>
    <code [lang]>This is specifc [lang] code</code>
    <code php><?php echo 'example'; ?></code>
    Available: html, css, javascript, bash, cpp, …
  • Lists:
    Indent your text by two spaces and use a * for
    each unordered list item or a - for ordered ones.
Hello World!

Tomasz Głuch
Hi! I'm Tomasz Głuch, sysadmin - IT specialist and electronics enthusiast from Kraków, PL . You'll find here articles about electronics, Linux. Welcome to my site.

QR Code: URL of current page