Coffee Data Science

Headspace in Espresso: Optimization

Another experiment to isolate headspace

Robert McKeon Aloe
Towards Data Science
3 min readApr 21, 2023

--

Headspace is the amount of room between the top of the coffee bed and the shower screen during an espresso shot. It is one of the variables of the puck that interact with grind size, dose, and tamp pressure. More specifically, headspace is the amount of room a puck has to expand during a shot, and this can impact how water and gas flow through coffee.

The challenge in optimizing for headspace is that it is convoluted with grind, dose, and tamp. I have generally found less headspace to be optimal, but I wanted a better experiment to isolate variables.

Enter Spent Coffee

I decided to add spent coffee on top of the fresh coffee which would act similarly to coffee in terms of expansion and water flow, but it would not interfere with extraction.

I did this testing using salami shots on the Decent Espresso machine. A salami shot can be used to measure extraction as well as better understand when different taste components are extracted into the cup.

I also used coffee that was 3 months post-roast, which has been my experimental coffee for some recent tests. The aim is to have coffee that has been degassed, and I can focus only on TDS and EY in terms of data metrics in a more ideal setting.

Total Dissolved Solids (TDS) is measured using a refractometer, and this number combined with the output weight of the shot and the input weight of the coffee is used to determine the percentage of coffee extracted into the cup, called Extraction Yield (EY).

Small vs Large Headspace

The first test set I used was on the Blooming Ramp profile, which ramps until it hits a certain pressure (4 bars), blooms for 30 seconds, and then infuses at 2.2 ml/s. However, this profile didn’t work well for a larger headspace because by the time the pressure built up, the target output was already reached.

All images by author

So I don’t think the results are as fair because the larger headspace (using 3g of spent coffee) because the baseline didn’t have a bloom phase.

Flat Profile

I redid the experiment using a flat 2 ml/s profile. This controlled for the bloom phase, and it allows us to focus only on headpsace. This showed that pressure built up better with a smaller headspace.

These extraction yield results were much clearer.

Headspace is a variable that is easy to change and doesn’t require any special tools. I hope this small study inspires people to try less headspace because the data points towards less headspace as the optimal parameter choice.

If you like, follow me on Twitter, YouTube, and Instagram where I post videos of espresso shots on different machines and espresso related stuff. You can also find me on LinkedIn. You can also follow me on Medium and Subscribe.

Further readings of mine:

My Book

My Links

Collection of Espresso Articles

A Collection of Work and School Stories

--

--

I’m in love with my Wife, my Kids, Espresso, Data Science, tomatoes, cooking, engineering, talking, family, Paris, and Italy, not necessarily in that order.