Coffee roasting is an art.
Roasting times and temperatures vary, depending upon the method of roasting used and the roast desired. Coffee roasting produces a wonderful fragrance, unobtrusive with the light roasts, but smokier if you roast dark.
After extensive experimentation, I found that I prefer most of my beans roasted about a minute or two after the 'first crack' (City Roast). I try to get it somewhere between a Light and medium roast.
I use several senses during the roasting process. By listening for the cracks, smelling the changing fragrances during the roast, and observing the beans changing from green to cinnamon to various shades of brown, I can best determines when to cut off the heat source.
Some coffee aficionados prefer coffee roasted between first crack and second crack (medium roast), where the beans retain the nuances attributable to the bean’s origin and type. Others prefer roasting into second crack (Full City Roast), where many beans develop a full, smoky, caramelized flavor.
Where the roast is stopped ... is left up to the tastes and preferences of the roaster.
The lenght of time you should roast your beans has a lot to do with the type of bean, the grade, it's country of origin, etc. Different beans will require different roasting times ... to insure that you reach it's peak flavor. I've found that I've destroyed the subtile flavors of several types, by roasting them too dark.
Coffee is best 4 to 24 hours after roasting. I find that it is best, if the freshly roasted beans are stored overnight ... to develop flavors. During this time, coffee emits enough C02 to keep the oxygen (that will eventually make it stale) at bay. The essential flavor oils are delicate, and fade or become tainted quickly despite all our interventions. Stored as whole beans in an airtight glass jar in a dark place, coffee can stay "fresh" for roughly 5 days.
You can roast coffee in a pan or wok, or in the oven. You can even roast them in a microwave, but all these methods are not uniformily successful, so you really dont get to enjoy the simplicity and quality of super-fresh home roasted coffee ... unless you have really got the science down.
I enjoy roasting coffee. The steam becomes fragrant. Soon I hear that "first crack," an audible cracking sound as the real roasting starts to occur. The sugars begin to carmelize, bound-up water escapes, the structure of the bean breaks down and oils migrate from their little pockets outward.
After the first crack, the roast can be considered complete, any time, according to your taste. The cracking is an audible cue, and, along with sight and smell, tells you what stage the roast is at.
Carmelization continues, oils migrate, and the bean expands in size as the roast becomes dark.
At this point a "second crack" can be heard, often more volitile than the first. Small pieces of the bean are sometimes blown away like shrapnel!
As the roast becomes very dark, the smoke is more pungent as sugars burn completly, and the bean structure breaks down more and more.
For those who like their coffee on the espresso side ... this stage has to be monitored very carefully. Left in too long ... and you will end up with a cup of 'charcoal' water.