Video is online! Click here to see the machine in it's full glory.
Arguably the most important feature of a coffee machine is its ability to brew coffee. Thankfully, this machine is actually capable of brewing coffee. Earlier I described the used hardware, in this part I will describe the software.
An advantage of a microcontroller-controlled coffee machine, is that a lot of finetuning of the brewing process is possible. An advantage of an internet-connected coffee machine, is that a lot of statistics can be tracked. For that most exciting part, check http://koffie.ronaldteune.nlAutoBaristaScript (TM)
The brewing code is in the koffiezetter.py module (excuse my Dutch - I tried to at least make it readable with comments). For every number on the quantity dial (1-5), a script is defined:
['Z8','M135','Z16','S60','Z120'] for 1 cup of coffee. This means:
- Give water (Z) for 8/4 = 2 seconds. Due to the control logic, this water is cold. For filter coffee, it's best to first wet the filter. This way, we can spare us the huge effort of doing it by hand.
- Grind (M) 135 half rotations of the grinder.
- Give hot water (Z) for 16/4 = 4 seconds.
- Sleep for 60/4 = 15 seconds. I forgot the fancy 'slow coffee' name for this, but this waiting time after a small bit of water significantly improves the taste of the coffee compared to instantly letting more water pass through the filter.
- Give the bulk of hot water.
The amounts of coffee and water is finetuned for this machine and the beans we currently use. Should we choose to switch beans often, new scripts can easily be created and loaded into the machine.
The temperature measurement comes from the HAL in a scale close to degrees celcius. Measurement is done by an NTC / constant R voltage divider connected to an ADC input of the Atmega daughterboard. I did not calibrate it exactly, but it's close enough. Some trial & error helped in getting the good coffee output temperature.
The script may be extended with a temperature control setting, e.g. to give perfect water for black tea, green tea and coffee. Currently however, a teakettle is still doing a wonderful job for this.
Grinding & brewing process
Both the grinder and the flow meter have two little magnets and a hall sensor. A call back function in the HAL registers the amount of half rotations; the brewing routine waits for the grinding to complete.
The flow meter has recently been installed, but currently the
amount of water is still time-based. The clock ticks at 4 Hz (=4 FPS).
More cups of coffee don't mean a linear increase of coffee powder; the amount of powder per cup slightly decreases.
One thing that needs improving is that the Senseo has a three-way-valve that 'spits' hot water back into the water tank when not pumping. This makes both the time-based and the flow-meter-based measurement inaccurate, so the exact amount of coffee is always a surprise. I think I can remove the three-way-valve since my output setup is totally different from the pad-based machine, but I need to investigate it more.
The temperature control is a simple hysteresis based control, with the addition that it tries to leave the boiler at less than 'totally hot' at the end, so the last 2 seconds the water may be colder than in the rest of the cycle. The advantage of this is that the first 2 seconds that are used for wetting the filter can be done by cold water (which means: don't wait for heating up).
The heater starts after grinding the coffee. The advantage is that while grinding, the water tank can be filled without the three-way-valve spitting hot water over the kitchen floor.