Sunday, November 8, 2015

Saeco Aroma PID Makeover 2.0

It has been a while since I put PID control on my original Saeco Aroma espresso machine and it has been in dependable service ever since, but I have always had a nagging dislike for the way it had mains voltages sitting out in the relative open (behind the display) above the water tank. There were also a few things that I would have done differently in retrospect given further thought and my recent experience adding PID control to my Rancilio Silvia, so with that project still fresh in mind I decided the time was ripe to re-visit the Saeco Aroma.

Here are the improvements that I set out to make over my first version:

  • Improve the temperature resolution: I wasn't using the full scale range of the ADC on the first version since I was using the default 5V analog reference and the temperature sensor output only spanned about 2.5V. This time I used the same dedicated 2.5V LDO for the analog reference that I used on the Silvia conversion.
  • Take control of the pump: I liked having the shot timer on the Silvia, and the ability to lock out the pump when the water level is low (as detected by the float switch, see next item).
  • Add a float switch: To enable the pump lock-out this was needed, and it is also just convenient even though the Saeco is better than the Rancilio in that it has a clear water tank with the level visible from the side through a cutout in the stainless steel body.
  • Install the electronics internal to the housing: No more mains voltages out in the open!
  • Have the control board mounted directly on the display: In my previous version I used a long-ish ribbon cable to connect these, and the E-M pulses from shutting the vibration motor on and off would sometimes couple into these lines and put the display in an unintended state (showing jibberish on the screen). It was easily fixed with a reset, but not ideal behavior. I wanted to keep the lines between the control board and the display short enough that this would not be an issue.
  • Replace the incandescent button backlights with LEDs: the light output of the original button lights was really weak, and by replacing them with LEDs I could both make them brighter and take control of them to make them part of the user interface (for visual feedback on what mode it is in and what the boiler is doing).
And here are a couple of improvements that I made over the Silvia project that I had just done:
  • Use quick connect tabs instead of high voltage connectors: these little tabs are way cheaper than the plastic connectors that I used in the Silvia project, take up way less PCB real estate, and are consistent with the wiring on the rest of the machine.
  • Use a mechanical relay for the pump instead of an SSR: these are way cheaper, and since it won't be switching much noise from it won't be an issue (the main reason I use an SSR for the boiler relay).
And one more feature unrelated to previous builds:
  • Add a keypad so that the machine can be locked unless the correct code is entered: now that the Silvia had displaced this machine from my kitchen for my morning coffee, I wanted to bring it into work so that I could use it for my afternoon coffee (although the baristas at Top Pot Donuts do a great job also). The problem is I work in an office space with a shared kitchen and I wanted the ability to constrain use of the machine to people who had been trained on it and knew how to use it properly. This way I could enable people to use the machine by giving them the code once I knew they were able to use it in a competent manner.
So, with those goals in mind I set out on the re-design. The first step was to figure out where to physically mount the control board/display; the Saeco is a tighter package than the Silvia so the options here were a bit more constrained. I originally wanted to have it in the upper compartment with the boiler so it would be on the faceplate of the machine with the other panel switches, but it was just too tight so after some thought I decided to drop it down to the lower panel, just above the drip tray. The issue with this was that the coffee cup could block the view of the display, so to get around that I decided to use a smaller display (2x8 character LCD instead of 2x16) and place it far enough off to one side so that it would not be blocked by the cup. This location also enabled me to put everything on one board vs. the Silvia which had a main board and a power board, making the wiring a little simpler.

I re-used most the schematic blocks from the Silvia so these went quickly, and the layout was pretty fast too since I still remembered how to use the tool unlike other projects where I have gone a few years between using the tool. Both were done in Eagle based on the merits of it being free, here they are:

I then ordered parts and built everything up, with the most challenging part probably being cutting the opening for the display since the dremel tool access wasn't as good as in the location on the upper face plate. Bring-up went smoothly also, with the most interesting thing I learned being that the Atmel ATMEGA 328 MCU doesn't have pull-up resistors on the pins used for the A6/A7 inputs. I had previously assumed that any of the analog inputs could be configured as digital inputs with full functionality, but this is not true for these pins. I would have thought this would have been documented in the Arduino reference pages, but it was not and I eventually came to this conclusion myself and then confirmed it with searches on a few forums. It wasn't a big deal since I could just tack on some pull-ups and use them as analog inputs (they were reading two of the keypad buttons), but good to know for next time. 

So, without further ado here are the images from the build. Here is the view of the machine after it is just turned on with both buttons illuminated and the LCD displaying a welcome message. You can see the keypad mounted on the side panel, just around the corner from the LCD:

When the machine is powered on it displays the welcome message and then prompts the user to enter the access code before the boiler comes on or any of the front panel buttons (brew and steam) are enabled:

You can see that is just a 4-button keypad, I was GPIO constrained on the ATMEGA 328 and I don't see this as a high value target for code crackers so it seemed acceptable. After typing in the code it goes into the normal mode, pulsing the brew button LED to indicate the warming to brew mode and then putting it solidly on once brew temperature is reached and the same for steam mode.

Here is the view of where the board is mounted, directly behind the display, between the drip tray and the water tank. The large black box is the AC/DC supply, with the relays above that and all of the low voltage circuitry below. I am holding the water tank up in this shot, the black cable going up and to the left connects to the float switch.

And here is a view of the boiler compartment. I didn't have to change much here, other than re-working the switches to replace the incandescent bulbs with LEDs. The astute observer will also notice that the temperature sensor is held on place on the boiler with a piece of metal that has the boot of Italy on it (salvaged from the lid from a jar of pasta sauce). All of the cabling is run down into the lower compartment though the existing opening for the power cord.

And now the most important question: does it work? Of course! Here is a plot of the temperature profile while making a latte (degrees C on the Y axis, time in seconds on the X axis). Here are the events labeled: At (0) the code is entered into the keypad and the temperature rises to the brew temperature of 95 C. There is a bit of overshoot here, I just re-used the PID gain constants from the Silvia project and they could probably benefit from a little tuning. At (1) I begin pulling the shot and you can see that the temperature drop down to about 80 C over the course of the 25 second shot. At (2) I stop pulling the shot and push the steam button, and the temperature then rises up toward the steaming temperature of 130 C. At (3) there is a small inflection where I purge the water from the steam wand, then at (4) a drop while I start steaming the milk. I finish at (5) at which point the temperature begins to rise, then at (6) I shut off the steam button and the temperature begins dropping back to the brew preset of 95 C.

One thing I did notice after having done this conversation and the Silvia conversion before it in quick succession is that the Saeco Aroma rises to temperature WAY faster than the Silvia. A cursory inspection reveals that this is likely due to a much higher boiler power to thermal mass ratio: the Silvia boiler is significantly larger than the Aroma, but the heating element power is not that different (950 W for the Aroma, 1100 W for the Silvia). I think I still prefer the Silvia overall, but if you are after a quick morning cup of coffee and you don't mind a sub-par steam wand then the Aroma might be the way to go.

And finally, here is the victory picture of a shot being pulled from the device under test. From the display you can see that it is 6 seconds into the shot and the temperature has dropped to 86 C.