The button I/O board (first picture) was built by Bret Victor and Peter
Maresh. It used to be hooked up to an array of solid-state relays, but
they didn't do their jobs properly, so that was replaced by the
relay board (second picture), built by Bret Victor and Jeremy Boulton.
The button I/O board allows the controller to read the current state
of the buttons on the front of the Coke machine. The controller can
also write to the board to switch the relays, which are hooked up to the
Coke machinery that the buttons used to be hooked up to. This allows
the controller to fake the Coke machine into thinking a button has been
pressed. There are six relays because there are actually six soda stacks
in the Coke machine which can be controlled independently. The button
input and relay output used to be related, but they are now completely
seperate (pressing a button does not affect the relays). There is
no schematic, but the PAL code makes it clear what's going on.
Chip List (button board)
U1: PAL20V8 - controller PAL #1:
U2: PAL20V8 - controller PAL #2:
RP1: 2.7Kohm pull-up resistors for the buttons
Chip List (relay board)
U1: ULN2003A - transistor pack to drive relays
R1-6: SPDT relays for each soda stack
Read the button state from address 0. Only the low 5 bits are valid, and
they are active high (1 means pressed). Read back the relay latch number from
address 1. Set the relay latch by writing a binary number to any
address. If the number is between 1 and 6, the appropriate relay is switched
on. If the number is 0 or 7, all relays are off.
The stuff you see in the lower-right of the button board is a simple
audio amplifier which used to be used for one-bit audio output. This is
not used anymore because (hopefully) the real audio board, with a DAC and
LM386, will be built someday.
The relays are hooked up in such a way as to mimic how the the buttons on
the Coke machine were originally hooked up, with the common connection flowing
from the NC (normally closed) terminal of one relay to the C (common)
terminal of the next relay, which ensures that only one relay can be
"active", no matter how many are switched.