This is also a project I did a while ago even before knowing about Instructables. So it may be a bit incomplete, but anyhow I think it's worth to be shared.
So I have this nice litte Saeco Aroma which is originally designed to make one cup of espresso a time. And I think this reasonable priced device is doing a good job. Though when brewing a cup of crema coffee the heating is a little bit too weak and the coffee is not really hot but almost lukewarm. So I thought of ways on how to improve it. Once at it I also thought about a timing which stops the machine when the cup of coffee is filled. Furthermore the heating should be cut off completely since in the past I often forgot to turn of the machine and then it just heats the air and wastes energy. Lastly I wanted to run the pump for a second or so after removing the filter so the extra water cleans coffee residuals.
The following steps deal with manipulation of a high voltage device (here in Germany it's 230V AC). Only try this in case you know what you're doing. This is hazardous!
Step 1: Principle Operation
The first to do was to find out the principle operation of the machine. Luckily this was not too complicated as the schematics are available from the vendor's site after a few search attempts.
Basically there is one heating resistor which is turned on with the main switch. It heats the boiler until the 95° C temperature switch opens up. In case the steam switch is pressed the heating will continue until the 127° C switch opens up. There is an additional 152° C switch which cuts off everything for safety reasons.
Another switch just turns on the pump motor. There is a little blue device in line with the pump that cuts off when the pump motor eventually gets too hot.
So what I needed to do was to cut off the heat resistor (Cut Heat in the schematics) with a relay. Further the pump motor needed a relay in parallel to the switch (Pump in the schematics).
Step 2: Afterbrew
A bit more complicated was the automatic cleaning once the filter is removed. I made a little test mount with a LED and an LDR (light depending resistor) which worked. But I did not like seeing a red light shining out of the coffee machine like the red eye of the Terminator. Also I was unsure about the resilience of that. So I switched to infrared light and photo transistor. And that worked perfectly. I only had to find the right place where to mount it.
I made a drawing of the relevant machine parts and placed the LED/Transistor in the space behind the facade and and the water tank. This place is freely accessible and also safe. It just needed two bores for the light to shine through. The filter, when mounted. reflects the IR light and the transistor has a good measure. The position where I placed it has a metal ring in the filter which reflects the light very good. So the only thing I had to do later was to measure the value at start (means the filter is mounted) and after the brewing was done to watch for a significant drop in the reflection.
You can see the measures in millimeters in the above sketches.
Step 3: Designing the Circuit
When designing the circuit I had the following requirements:
- separate high voltage from low voltage circuit parts,
- separate sensor board and
- non-invasive program start button.
While the first and the second point were easily to achieve, the program start button took a bit more of head-scratching. I ended up with a touch sensor after several attempts made from a penny-sized plain PCB which I covered completely with solder. This also made it look like the chromium chassis of the machine.
The pictures above show the final schematics for the controller, which I'll explain a bit below. The first top view shows that there is not very much space inside the housing, but still a bit to hold the high voltage part of the controller. The biggest parts of that are the two relays and the transformer for the power supply. The test fit showed that there's still some room left. The final PCB was set in place with some hot glue and a Plexiglas piece down to the copper side. The tapping and interrupts to the pump and heating were secured with shrink tubing after carefully soldering them. The controller PCB itself is just hanging in the air without any mount. The space where also the IR LED/Transistor PCB is hot-glued is well secured between facade and water tank. The touch sensor is also hot-glued at the right side of the housing.
High voltage PCB
That part of the PCB which is inside the housing holds the power supply, the relays and another part which I so far did mention only peripherally. Since I wanted hot coffee I (thought I) needed a sensor to find out whether the heating has started again (and thus indicating the water temperature dropped below 95° C). So the pump should stop while the heating was bringing up the water temperature again. Later I found out that I simply could have achieved similar results with a simple timing, but this solution is more sophisticated ;-)
So, how does this sensor work? Simply it measures whether theres voltage on the 95° C thermo-interrupt or not. If there is, then the switch is open and the water is hot. If not, then the heating has started again - time to pause the pump. The circuit used here is from somewhere on the internet (more than one source). Unlike what the Fritzing schematic shows, this is a 6N 137 optocoupler and you must use this one because it has anti-parallel diodes. The RC network just cuts down the 230V AC so the current through the diodes is within the limits. The capacitor must be an impulse capacitor at 400V and the resistors are split in series to be safe.
The power supply is pretty much straight forward. I just had to watch that the transformer was not too big. Since the main load is that of the two relays and they draw only quite low current at 12V this was easy to solve. The relays are switched with simple transistors.
The connection to the low voltage PCB outside was done with a flat ribbon cable. This transports 5V/Gnd, the control lines in for the relays and the heat sense from the optocoupler.
Low voltage PCB
This is probably self-explanatory. It holds resistors going out for the relay transistors. The 1Meg resistor with the touch field attached to one side will measure the time difference between loading the (un-) touched capacity directly and through the resistor. This way it finds out whether the sensor is touched or not. As a side note: when I once cleaned the side with a wet cloth the sensor permanently fired a touch signal. It took me a moment to find the reason. After a dry-wipe everything was fine again ;-)
As said, the PCB is just hanging on the flat ribbon going to the high voltage PCB inside. The sensor PCB - simply hot-glued in place - is connected with a 3 wire ribbon cable.
Step 4: The Control Program
The attached zip contains all files needed to program the used Attiny. Since the last available pin of the Attiny is reserved for the reset, it is necessary to blow a fuse. Once done, the Attiny can not easily be re-programmed but only when using a HVSP. This is explained in other tutorials well enough so I'll save me from repeating that.
The Average files are simply used to build averages for the sensor readings. I reused that from another project. So when the sensor reading changed constantly it signals that the sensor field has been touched.
The CapacitiveSensor files are downloaded from github (see inside). It's fairly easy to use. You just need to supply the both pins where the 1Meg resistor is connected (the first which connects also to the touch field). Then you just call capacitiveSensor(30) to get the readings. In my measure if the average exceeds a value of 10 this indicates a touch event.
The program itself is a big state machine (like almost all embedded systems). The State indicates which action to perform currently. Basically it's this flow:
- Wait for sensor touch
- Turn on (eventually switched off before) heating
- Get reflection from IR (mounted filter)
- Turn on pump for a second (wet coffee grains)
- Wait shortly for maceration
- Start pump
- If heat has turned on again then keep on pumping for a short while
- then wait until the heating turns off and resume at Start pump
- After 27 seconds actual brewing time (without pauses) stop brewing
- Turn off heating completely
- Wait until IR reflection drops
- Wait a short time
- Turn on pump shortly for cleaning
- Go to start
Step 5: Make Coffee
So what's left? Make a cup of coffee!
When the filter with the ground coffee has been placed then just touch the sensor plate and the brewing will start. After some time the pump will stop at a filled cup of coffee (in that case the control lamp indicating "water ready" will also be on, while during the re-heat phases it's off).
Enjoy your coffee :-)