My Roaster Controller Hardware

Mark 1

As mentioned on the main page, the controller is built round a Microchip PIC (specifically, a 16F877A).

The not quite complete board. The advantage of using a PIC microprocessor is that you get something useful with minimal external components.

This is built on strip-board, using mostly components I had lying around already.

oscillator

Clock for the chip is a 16MHz oscillator, with a couple of capacitors. A 3-pin oscillator would reduce this to just one part.

clock

I also use a 256Hz clock signal for timing purposes. The photo shows the first version, which was a 32kHz-ish RC oscillator through a chain of divide-by-two (the counter chip I used as an oscilator driver built in). I've now replaced it with a crystal oscillator using a dedicated crystal driver chip, so the capacitor, resisters and trimmer have been replaced by an 8-pin chip and a 32768Hz crystal, giving timingaccuracy at least as accurate as any digital watch.

The jumper to the left lets me also feed 1024Hz to the PIC instead, that makes everything triggered by the clock run at 4x speed, which is useful (sometimes) for debugging.

i2c

I have sockets for two i2c bus eeproms. One of these is used to store program information, and one is spare. I could use the eeprom on the PIC chip, but I wanted more space - the PIC has 256 bytes of eeprom, and I've installed 8192 byte chips. This gives me space to store 256 program steps with 32 bytes per step. In the first version I use 12 bytes per step (two for duration, one for heat power, one for fan power, eight for a name for the step), leaving 20 for future use (I'm not sure what, but I'm sure feature creep will come up with something).

Having implemented i2c, it might be useful for some other off-chip device too, but I don't have any idea what yet.

fans switching

There's hardware to control two fans with a PWM signal. By using MOSFETs intended for logic-level gate inputs, the external circuitry reduces to the MOSFET, a diode to protect it from the inductor of the motor windings, and a resistor to protect the PIC from the MOSFET. The MOSFETs aren't actually installed yet (see below). The black wires are the high current returns from the MOSFETs to the transformer

Obviously, there's only one fan in a popper. I'm not sure where I might put a second, but the PIC had two PWM modules, so I thought I'd set up both, in case I think of something to do with the other one.

drive to SSR

The output of the PIC is good enough to drive an SSR directly, so that's how I control the heater element.

other bits and pieces

There's also assorted other bits and pieces on the board, including:


With the fan MOSFETs (and their heatsinks) in place.

The jumpers by the i2c eeprom sockets are to write-protect the eeproms. Left floating (like this) the eeprom is unprotected, but if the pins are shorted by moving the jumper across, the eeproms are protected against writes or erasure.

Even this view is incomplete. All the wires to the front panel still need putting in. The design is such that most of these (16 out of 20) go into the gap between the PIC socket and the nearest board edge, which makes routing the wires a bit easier. I could have used a ribbon cable and socket, but I didn't have anything suitable, so just used wires.

Also missing are the pull-up resistors for the i2c bus, connections to a back-panel reset switch and connections to take RS232 signals from the chip. The PIC has a USART built in, and I've programmed it to talk to an attached terminal (or PC pretending to be a terminal) via a MAX232 buffering the levels appropriately. This makes debugging easier.

In place in the case. I had the case already (a previous project, now unused), but cut new front and rear panels from some aluminium sheet. The SSR is from ebay and uses the back panel plus some external fins as a heatsink. You can also see that I decided to put a ZIF socket (ebay again) in place of the normal socket in the photos above, because it's more compatible with iterative code development (take out PIC, reprogram, reinsert, repeat).

The wiring is a mess because it's all long enough for me to take the board right out and turn it over without disturbing anything mounted in the case. This is so that I can modify the hardware without too much aggravation.

In early testing I had problems with the PIC resetting when the fan was running. Suspecting noise getting back onto the supply, I added a capacitor between the supply and ground near the PIC, which seemed to resolve the problem. Other than that, this is the hardware in just about its final state.

Mark 2

The mark 1 was simply programmed with heater and fan power by measn of trial-and-error too give the desired roast profile. Mark 2 added some thermocouples so control could be on the basis of actual temperatures.

There's a mineral-insulated thermocouple probe (stainless steel) in the bean chamber, held in place by large dollops of high-temperature silicone sealant under the lid. This is arranged straight down the centre of the chamber, with the tip about 10mm clear of the floor of the chamber, by means of judicious bending. This is the thermocouple that's used to control the programmed temperatures.

A second thermocouple (just a bare bead this time) is inserted in the surround to the chamber, in order to measure the temperature of the air being fed in to the beans. This isn't actually used for any control - I just thought it would be more information nice to know (and I had some spare ADC channels).

The thermocouples connect to a daughter board that does some amplification of the signal (using a dual instrumentation amp chip) and rudimentary cold junction compensation. I do actually have a cold junction thermocouple, it's normally stuck on a solid-state temperature sensor (that's the thing that looks like a transistor just below the junction block), but in this picture it's just hanging off the side of the desk. The cold junction thermocouple connects to both thermocouples in the roaster. It's not a particularly accurate way of doing it, but it should be fairly repeatable, which is what matters.

The amplified output of the two roaster thermocouples and the ambient sensor are fed back to the main board where the PIC converts them to digital with its built-in 10-bit ADC.


back to the main coffee-roasting page
back to Ian's contents page
back to www.astounding.org.uk top contents page

To comment on anything (please do) email ian@astounding.org.uk