Coffee is one of the world's most popular beverages. In Canada, two thirds of adults drink at least one cup of joe a day. 

But beyond the caffeine kick, cups of coffee can differ wildly. Whether you have a Tim Hortons habit, swear by Starbucks or prefer to brew your own beans at home, you never quite know what you're going to get.

That's why researchers at Ireland's University of Limerick are working on brewing the perfect cup of coffee. 

What makes a 'perfect' cup of coffee? 

Researchers devised a mathematical model specifically for drip coffee machines, hoping to unlock the secret to the smoothest, most predictable, and most efficient brew.

Although it might seem simple, passing hot water over roasted and ground coffee beans is an incredibly complex process.

Coffee Model

A model showing the transfers of water and coffee that go into brewing a cup of drip coffee. (Kevin M. Moroney)

There are over 1,800 chemicals in a typical cup of coffee and many of those contribute to the taste. There are mechanical variables, too: the size of the coffee grounds, the temperature of the hot water, the rate at which the water passes over the grounds, and the density of packing of the grounds all affect the flavour and texture of a humble cup of joe.

How much coffee did the researchers have to drink? 

All the authors involved in the study admit that coffee is a part of their daily routine — but their research wasn't as simple as touring the coffee shops of Limerick. Instead, the team considered all the possible variables that go into making coffee and developed a mathematical and computer model that can predict the amount of coffee extraction that will take place under the conditions of a drip coffee machine.

Their initial equations included so many variables that it was far too cumbersome to ever actually use in practice. So the researchers decided to ignore things like brew time and water quality and focused their model on what could truly be measured.

However, if the orders at Starbucks are any indication, what constitutes a good cup of coffee is really based on personal preference. So it wasn't so much about researching the quality of the coffee but more the efficiency of the brew.

What's the biggest variable that changes coffee quality? 

According to researcher Kevin Moroney, the size of the grounds is "vitally important" to the extraction of coffee. The larger the grind in drip coffee the less bitter the taste, partially because there are more gaps between the grinds and the hot water can circulate more easily.

Coffee Grounds

While there are a number of factors that affect coffee quality, grind size is the most important variable. (Irene Coco / Unsplash)

The bitterness occurs when the surface area of the grain is high (a fine grind), preventing water from easily flowing between the grounds and increasing the amount of coffee extracted from the beans.

What this means is that bitterness is determined primarily by the size of the coffee grounds. The largest setting of grind size will give you the least bitter taste. But it's a trade off, since smaller grinds pack more of a caffeine punch. 

Will this research help us make the perfect cup of coffee?

Yes. In fact, this work has helped them quantify just how many molecules you want to extract from a coffee bean.  

"You want to extract about 20 per cent," said Moroney, "because if you extract too little of the mass of the coffee grain, you only get the flavours that come from chemicals of a small molecular mass which extract fast so you don't get that complex flavour you want in the coffee." 

There's no way to calculate the perfect 20 per cent extraction at home, but you can bet that coffee machine makers are taking note.

The next step researchers want to take is to determine how specific brewing configurations affect the quality of coffee — and how you can maximize flavour extraction without verging on bitterness.