Coffee Roasting with Linux

The plan

Roast coffee at home using a computer controlled popcorn roaster requiring no intervention other than putting in raw green beans and then putting cooled roasted beans into storage bags.


Hardware required



Popcorn roaster Sunbeam popasaurus which has been sitting in its box for 5 years.  Air roasted popcorn sucks, so no issues canabalising it :P
Computer Old Toshiba Tecra 8100 laptop.  The laptop is missing a battery, and is pretty useless for anything else. It has a 450 MHz processor, 192MB ram and 6GB HD.  Not a powerhouse, but a roast controller could run on a 8088...
Case for controller I used an old ATX powersupply case.  Try and find one with monitor pass through power connector.

2 x 240 volt switches

1 light dimmer

I bought the switches and dimmer on a light swich plate for $6 at a local market.

I wouldn't bother with the light dimmer unless you get it dirt cheap, I normally have it set to full power.

1 x ~24 volt Transformer I bought a 56v primary, 28v secondary transformer from Dick Smith (model M0144) for $9.98.  I think they are no longer stocked.  The secondary 28v winding is used for the popper.  Its rated at 2 amps for 56v which is more than sufficient.  If you use a light dimmer a higher voltage transformer should be OK, just make sure you calibrate the max voltage out and restrict the dimmer knob from going past that point.
Solid state relay (SSR) 20 amp Mitsubishi SSR bought from oatley electronics for $11.
9 pin serial socket & cable Junk box
low voltage connector, IEC leads Molex power connector chopped off from old Hardisk drive.  IEC power cable from junk box.  I chose these parts as they are readily available for free so you can potentially modify a spare standby popper, or try making a corretto using a heat gun.
VA18 multimeter with USB interface From ebay user/shop multimeter_depot for $59.95USD.  This cryptic search URL on ebay might find a current listing for  it.



Circuit diagram

circuit diagram


For the software I decided to write an app using gtk/Gnome under ubuntu.

Install Attempting to install ubuntu 8.10 on the old Toshiba Tecra 8100 laptop was a straight off failure. It took ages to boot off the CD into X windows, and then hung.  Luckily I have another Dell D600 laptop which uses 2.5" PATA drives, so I swapped the HD out of the Toshiba into the Dell and installed Ubuntu with no issues. Surprisingly after putting the HD back into the Toshiba everything worked fine. Ubuntu booted and detected all the hardware with no issues. It runs dreadfully slow by default, so I killed off a heap of useless daemons and gnome junk, and now it runs a bit better. I have no idea how I tolerated X with Netscape on an 8MB 486 linux box back in the day!

Network The old Toshiba has no network ports built in (wireless/twisted pair). Hunting through my box of junk i found an old 10meg 3com card i modified ages ago. Back when onboard Ethernet didn't exist on laptops, most people had to use pcmcia network cards which required a crappy dongle cable to connect to the RJ45 plug. Most heavy business users went through about 3 or 4 network cards during the laptop life span as the dongles were always lost (left in hotels normally). For some reason nobody ever bothered to buy new dongles, just get new cards, so most IT departments had a draw full of cards missing dongles. Before home netgear/linksys type routers were cheap and mainstream, I used an old 486 laptop with a broken screen with a broken screen as a router. I got 2 of the PCMCIA cards, cracked them open, and soldered cat5 directly to the card.

Software install First i updated the machine with the latest packages/patches: apt-get update apt-get upgrade





Gnome coding

Getting the basics going

Documentation is sometimes not a strong point when coding in gnome :P

It pays to keep a close eye on any documentation dates and try and stick to things under 6 months old if possible.

First step was to whip up a test GUI.  I played with glade about 5 years ago, and some digging around showed that using glade is still the way to go when designing the interface.

So I did an "apt-get install glade" in Ubuntu, and designed a quick test program following some tutorials.    After having a play around in glade and comparing some different tutorials I realised I was running a depreciated version of glade, and that glade 3 is the way to go for new applications.  I'm not quite sure why the glade 2 package is installed by default when you choose to install glade.

So I installed glade 3 and made a test program.  The documention was rather confusing.  In the previous glade versions you generated a .C file from the glade source.  Not in glade 3.

Glade 3 parses the GUI layout file on demand when the program loads.  Its actually a very awesome feature.  You can distribute a binary, and users can change the GUI layout themselves using the glade GUI designer.

However, try as I did, I could not get my test programs to parse in the XML files from the glade designer.

After much head scratching and googling, I finally worked out that you need to parse the glade GUI designer XML file into another XML file for the program to read!

It would be nice if they put a comment at the start of the glade designer XML, something like:

<!-- *** NOTE: you must convert this file before your application can read it, ie. gtk-builder-convert popper.xml -->

Having both the input and output in XML format makes it a tad confusing :)


Serial code

This code is based on the com.c file written by Mark Zehner/Peter Baumann.  This was the first hit I found on google and worked out of the box.  It is also GPL.

This code works fine with a no-name USB to serial port adapter I use on my development laptop (the diminutive size of the dell 9400 wouldn't allow for a serial port).  The opto isolation also stops mis-wiring blowing the laptop up.

USB multimeter code

The USB multimeter code is heavily based on program from

There were 3 reasons for buying the VA18 Multimeter:

  1. It was cheap

  2. The Linux driver from Martin Schewe existed.

  3. The USB connection was optically isolated, again avoiding risk of frying dev laptop.

Graphing code

Purdy graph is drawn using gtkplot from the gtkextra project.

PID code (free for non-commercial use).  This pdf file also gives a good overview of PID control.


Linux hey........

Wouldn't you just run top while you ls and ifconfig?