Pretty simple, actually!! This model (B31) contains:
- 12VDC air pump to push water from tank into coffee pod
- 10K thermistor, stuck in the tank
- 1400 Watt heating element
I wired all three to the Arduino through a transistor for the pump, a resistor divider to use analogRead() and calculate temperature, and a mechanical relay.
The Arduino uses 4 buttons: heating element toggle, temperature up/down, and pump engage. I didn't bother with the water sense non-sense Keurig uses (to know if water is in the tank or reservoir), so it pretty much checks temperature and if it is low engages the relay. When it's done I then hit the button to dump the water through the coffee (so it's not as automated as Keurig, but better than buying a new one). Code is here:
The thing was a pain to disassemble too. It's one of those "oooooooohhhh that's how it's put together" products where you have completely destroyed the plastic tabs before you see the one magic screw holding it together.
Looking through the code I got flashbacks to "Agile Principles, Patterns, and Practices" because of Robert C. Martin's "Mark IV Special Coffee Maker" [1] sample problem.
Old fashioned non-automatic electric kettles had such a device that handily pushed out the kettle lead thus disconnecting the mains. I was saved from some embarrasment and redectoration by this a third of a century ago.
PS: how could you detect the presence of water? Photocell? Ultrasound? Conductivity between two small contacts 20% of the way up the jug?
The old way in industrial automation is a float sensor, which is basically a reed switch with some buoyancy on the end. With substances that are corrosive, or where there's a cross contamination concern, you drop down to load cells or a rangefinder, both of which are more expensive and fussy. :)
At least in my Keurig: there are 2 tanks, 1 external, 1 internal. There is a float in the external tank that detects if there is enough water in the external to fill up the internal. If so, then it brews the internal tank and then fills it up from the external after the coffee is made. If there is not enough water to fill up the tank, it won't start.