The Virtual Coffee Roasting App
21 December, 2022
The Virtual Coffee Roasting App

By Prof Steven Abbott


If you roast coffee you might like to play with a virtual roasting machine to see what’s going on. You can create your perfect roast or make “crashes”, ‘”flicks of death” and even set the beans on fire. And you can also deepen your understanding of what’s going on in your own machine. The app is free and free from ads. Just head here and enjoy playing with it. Each time you close the app, it remembers your previous settings. If these have taken you to a wild place (or you are lost while playing with the app), click Restore Defaults to return you to the settings in the screen shot.

In this tutorial, Professor Abbott walks us through how to use his new Coffee Roasting App


Why a roasting app?

It started by accident. The Barista Hustle team asked me some questions about crashes and flicks in coffee roasting and as I started to think about it, I realised that I had to disentangle multiple effects. This was not only for my own benefit, but because there are many debates and opinions out there about what’s going on, and many of the ideas were rather vague. The great thing about writing an app is that you can’t wave your hands. You have to follow the physics, as best you can, and see what happens.

The current version is the result of many false starts and rewrites thanks to the BH team’s critiques. They can take the credit for lots of the good stuff in the app; all blame for the bad stuff goes to me.

To get a feeling for the app, let’s first do the physics trick of tackling a simpler problem. This lets us understand the core effects so that we can then introduce the real-world issues


The basic processes

Let’s imagine some dummy beans that have a similar shape, size, density, heat capacity as real beans but which don’t lose moisture on heating, and don’t crack or burn. The physics of what happens when they are first added to a hot roaster is straightforward. The hot air in the drum will be cooled, the drum itself will be cooled and the bean temperature will start to rise. As we tumble the beans in the drum, the hot air from the inlet will transfer heat via convection and emerge cooler in the exhaust, the drum will transfer heat by conduction, and from both causes the bean temperature will rise. The rate of rise, ROR, will be large at first because it depends on the large ΔT (“delta-T”) values, the differences in the air-to-bean and drum-to-bean temperatures. As the beans get hotter, ΔT gets smaller, the ROR decreases … until the beans reach an equilibrium value and ΔT = 0. Note that in the timescales of interest, there is no significant temperature gradient from outside to inside each bean.

In addition to the ΔT effects, the ROR depends on the contact area of beans with the drum (the higher, the more conductive transfer takes place) and on the flow of air around the beans – the faster the flow, the higher the heat transfer coefficient.

The bean-to-drum contact area won’t change much up to a drum speed where beans are flying all over the place. Instead, up to a point, drum speed helps to randomise bean-to-drum contacts, reducing the chances of any given bean lingering too long in contact. By imparting velocity to the flying beads, the drum works together with airflow to increase the heat transfer coefficient from the hot air. If the drum spins too fast then beans get pinned to the wall by centrifugal forces. If the airflow is too high, then too much cold air is sucked in. In both cases, the ROR via convection goes down.

There’s one more key feature. Hot air comes in at one end of the drum and exits cooler towards the exhaust. This means that the beans experience varying ΔT values along the drum, hence a key aspect of drum design is a mechanism to circulate beans along the length of the drum. In an ideal world we’d have temperature sensors in the first quarter, the middle and the third quarter of the drum length to better know what’s going on. For now we’ll go with the assumption that a single probe provides enough information for us to roast reliably.


What are we measuring?

If we know our drum temperature, DT, inlet temperature, IT, bean temperature, BT and exhaust temperature, ET and if we continue with our dummy beans, then it’s not so hard to be able to test and validate a model of the basic thermal processes. Indeed, the hardest part of this is finding a sack of suitable dummy beans. Once we’ve validated our model, we can start roasting real beans. The differences we find will be due to the interesting parts of the roasting process: the loss of water and the events around first (and second) crack – those things that inspired the questions about crashes and flicks.

The problem is that most roasting systems provide us with only indirect measures. In such cases, the trick is to do the best you can with whatever information you have and to push for whatever can give you somewhat better information for reasonable extra effort.

Unlike the app which has 4 curves, the majority of roasting graphs have 3: ET, BT and ROR. Let’s see why I had to add the 4th curve, IT. 

The ET is often called the Environmental (or Exhaust) temperature and those who call it environment temperature might think that this indicates the environment in which the beans are roasting. This cannot be true. ET values often show surprisingly little response to things like burner settings and, most confusingly of all, would sometimes read lower than the BT. This means that ET cannot be driving the roasting process, because a higher BT would mean a negative ΔT which would cool the beans. Instead, because it’s more like an exhaust temperature (the ET probe is often in the exhaust duct) it is reflecting what has happened in the drum, it’s old news. So if, for example, you increase the burner setting but all that extra heat gets absorbed by the beans, the ET will remain unchanged. Similarly, the heat in the beans will keep the ET relatively constant if you reduce the burner setting. The fact that ET can be lower than BT in some roasting curves is more to do with where the ET probe is (and how much cooling of the exhaust air takes place) than with the roasting process.

The BT is also a misleading term. It starts high (usually similar to ET) when there are no beans, then sinks to a low level before reaching the Turning Point which is a key indicator used by roasters. The term is misleading because the beans themselves start at ambient temperature and rise steadily in temperature. The beans themselves never experience “the turn”, how could they? So the BT is, in reality, the Bean-Probe temperature, which is a mix of the local air temperature and the bean temperature and past history.

The ROR is the rate of rise of the bean-probe temperature. Later on in the roast it is closer to being the ROR of the beans, but we must always remember that the values we see are a mixture of effects.

To complete our measurements we, obviously, need the drum temperature, DT and the inlet temperature IT. To my surprise, DT seems to be unknown for most machines. Given that it can’t be that hard to measure the temperature of a large chunk of metal I find it surprising that it is not a routine part of all good roasting setups. If I had a machine I would certainly expend some effort to get a meaningful DT output. But for the rest of this article I just have to assume that it’s unknown, and the app, for now, makes no attempt to include conductive heat transfer from the drum.

I get the impression that IT is available on many machines but is seldom used – I’ve seen it on very few roasting charts. This seems unfortunate because it is IT which is driving the roasting process and is responsive both to burner and airflow settings so gives us precious direct data. I’m told that it is an unreliable, even meaningless, measurement because it depends strongly on where it is placed in the inlet – values can change by many 10s of degrees just by raising or lowering it a little. If I were a roaster, I would do whatever I could in order to get a stable, meaningful measurement of IT – and use it as my key driver for controlling the roasting process.

Under the circumstances, I have no choice but to provide an idealised IT input to the app and use it for the core calculations on BT. My implementation of IT is constrained by the fact that the results of BT and ET must give a good match to the curves commonly found out there. Because my ET follows the process rather than drives it, by focussing on IT, the chain of cause and effect should be clearer. 

By the time you read this, the app may look different, but you get the general idea. The user can specify bean weight, moisture, starting T, the maximum burner output and various fancy options such as relative drum/air speed (with the setting 3 being optimal) and system response speeds (with 3 being nominal). Before trying out the app and sliding sliders, remember the main rule: You have the Power.


You have the power

During a roast the power (flame, burner …) is adjusted, usually stepped downwards as the roast progresses. It’s a bit tricky to specify this in an app and I’ve chosen the least bad way. You enter a set of T and P% values, i.e. the % power to be set when the roast reaches temperature T. To set the initial % you start with, say, 0,90 (to use 90% of your maximum burner power) then follow with, say, 145,80 160,70 170,60 180,40 190,20 to set the power to 80% at 145°C, 70% at 160°C etc. The rule is to provide comma-separated pairs, with a space in between, and with T values rising from left to right, but the app can correct for many imprecise entries.

The nice thing is that you can type away in the T,Power% box till you have what you want, then you press enter/return to do the calculation. This makes it less stressful to enter your settings. If you don’t like that 60% at 170°C, just change it to 55 and press return to see if the results are better.

Some of you would also like to alter the drum speed or the airflow during the roast. Although I could add this feature, it makes the app even more complicated. And my scientific instinct is that changing multiple variables during a run is a sub-optimal strategy unless you really know which factors are changing which other factors.


Looking at the results

The top graph shows the IT, ET, and BT and the BT’s rate of rise, ROR. Note that as in all my apps I refuse to use US units. The lower graph shows the power (to give you a visual check of your T,Power% inputs and the time at which the power changes), the bean weight and the water content. 

The default settings do a reasonable job of creating a set of curves that are recognisable to most roasters, though the IT curve which drives the app is not usually recorded. At the start you see the ET fall (modestly) and the BT fall (a lot) and you see the Turning Point which is output as tTurn. Remember that this is a bogus reading as the beans do not show any turning point – it’s just a useful fingerprint for your machine setup. As the roast goes on, the power settings decrease, with the IT in the top graph decreasing accordingly, with effectively instant response. Although the reduction of the IT is important it is relatively modest. The major effect comes from the amount of heat available which is a key part of the calculation – temperature and heat have a complex relationship. The ROR shows a fairly steady fall then there’s a blip at first crack (with tFC being shown in the outputs) which is scientifically reasonable (sudden cooling as water evaporates).  The dark red and light blue curves in the lower graph show the steady loss of total mass and of water, with sudden losses at first crack.

Note that the T values we measure are often lagging many seconds behind reality. This is for the good reason that measurements are noisy so we use an “integration” time to average out the noise. The Rel. Response factor in the app lets you see what happens to the graphs if the response is slower or faster.

Note, too, that the app, for the moment, doesn’t have a “soak” option. I currently don’t have enough information to know how to implement this.

In this version of the app, the events at first crack are my best attempt to show what can go right … and what can go wrong. The plan is to refine the code once we know more. With some settings you might find a temperature spike happening some time after first crack. That’s not the flick of death, that’s your dry beans burning. 


Calibrating the system

The whole point of the app is to explore how the ROR depends on gradual moisture loss, and the various events around first crack etc. and how our changes to the roaster settings can influence these effects. But first we need to know that the app can do a decent job of simulating the overall T effects, which in turn means that we need more data that reliably shows what’s going on.

How could we know if the app is doing an OK job? By roasting some dummy beans. 

Going back towards the start of this article, imagine we have several kgs of bean-like pellets which are thermally stable, tough (so don’t break and leave residue), zero odour and with approximately the same thermal properties as green beans (we can mathematically correct for any differences in heat capacity and density). We now “roast” these. Because they don’t do anything tricky like give off water or crack under internal pressure, we see the purely thermal behaviour of our system. This lets us increase our understanding of what happens when we adjust our roaster settings (we can go wild, with no worry about wasting or burning precious coffee beans). Once we understand the basics, we can run these calibration beans using our standard real roasting protocol then run some real beans under the same protocol. Differences between the two will be due to water loss, cracks, and chemical reactions, all the interesting and important stuff. This will give roasters deep insights into the subtleties of their roasts and help resolve questions such as the origin of the flick of death.

I look forward to this happening. 



One of the key debates is about the cooling effect of the water that comes slowly out of the beans before first crack. My view is that the effect on ROR is small, simply the effect of the “enthalpy of vaporisation” of water. Others think that the escaping water somehow shields the beans from the hot air, significantly lowering the heat transfer coefficient and, therefore, the ROR. These are the sorts of complex issues that we will be able to resolve once we have good comparison data.

Another debate is about how much of the flick is due to chemical reactions and how much is due to the larger ΔT caused by the cooling effect of the rapidly evaporating water? Again, with more confidence in the basics of the model, we might be able to disentangle these effects.

And there are facts and factoids out there. For example, if it’s true that washed coffees crash more than naturals, what might be the root cause? Do harder beans crack more violently and, if so, is there a bigger crash and a larger flick? If the roast process is too uniform and the first crack is super violent as the beans explode in one go, is the crash and flick worse?

My hope is that the app-based approach will help us resolve these issues as a community.


A work in progress

The app and this article are only the start of a journey. Those readers with reasonable knowledge of JavaScript can click the ShowCode button and see what’s behind the calculations (they are also welcome to take the code and use it any way they want – my site is Open Source, Creative Commons). There are numerous fudge factors to allow a plausible simulation. If we had sacks of dummy beans to roast under wildly different conditions, we could refine these fudge factors, ready to tackle the more complex issues of the real beans. To help this process, I could add options to save the app settings as a simple text file which we can load later or send to others.  Till then, please contact me directly at [email protected] with your criticisms, suggestions and questions.




About the Author

Professor Steven Abbott’s free online resources of apps and ebooks are a go-to for anyone serious about the science of extraction. His extraordinary career has taken him all around the world, with gigs that have included working with banana growers in the Philippines, printing companies in Colombia and a coffee bag valve company in the USA.

Abbott is a world expert on drying science and diffusion. He has worked for many years in the coating and printing industry, specialising in nanocoatings and nanostructures. He now works as an independent consultant, and divides his time between writing free apps for formulators, consulting for industry, and running his technical software business. He manages all this whilst possessing a passion for good coffee — in particular the Ibrik brew method.