Before applying code to the espresso machine components, the methodology of the code was tested in situations that replicate what occurs in the machine itself. The flow diagram of the code is shown below.
The pumping mechanism was replicated by using a blue LED to represent the pump, a red LED to represent machine stand-by and a potentiometer was used to imitate the flow meter.
So, when the espresso button is pressed, the pump should turn on until the pre-infusion flow has been achieved (potentiometer turned a small amount), then delaying before pumping the main cycle until main flow is achieved (potentiometer turn a greater amount). This was successfully demonstrated below.
To emulate the heating mechanism, my body heat was used as the “heater”, with an LED to represent power to the heater (i.e. if the light turns off, take the sensor away from my arm).
The target temperature was set at 30 degrees and the aim was to fluctuate the temperature about that point.