Hacking the Keurig B40 Coffee Maker – Part 1 – Hardware

The Keurig B40 coffee maker is a masterpiece of engineering marvel. Inside you will find 2 pumps, 3 solenoids, 4 circuit boards, and an exorbitant number of tubes, sensors, and connectors. As a weekend project I’ve taken one of these beasts apart, documented it, and subsequently modified it to solve the complete lack of physical security and auditing, which I consider a serious flaw in the original design. K-cups are a precious commodity, with costs far exceeding that of traditional bulk-purchased coffee, and their usage must be carefully monitored to control costs. Previously we had no way to attribute usage to individuals as to ensure proportional, fair contributions were made to the coffee fund that accurately reflected individual consumption. In this day and age it is frightening to imagine that such a common device lacks the proper physical security interfaces required to properly solve this problem.
To rectify this situation I added an Arduino hardware interface and RFID scanner to track usage of the machine. We had previously distributed RFID devices to all lab members as part of another project to create a keyless entry system, so using RFID was the natural choice. The original brewing interface (push button on the machine) has been secured by being disconnected, and attached to the Arduino, where input is received and processed by the netbook, which performs authentication, auditing, and authorizes brewing.
Disassembly
WARNING: Proceed at your own risk. A coffee maker, by definition, mixes water and electricity, which has generally been considered a bad thing. This coffee maker, in addition to making delicious, bold blends, could easily kill you or permanently damage whatever you might connect to it.
Taking apart the B40 is no simple task. This proved to be one of the most difficult parts of the project. My best advise is to be slow and methodical. Start from the bottom and remove screws, take apart as much of the unit as possible. Once you’ve run out of screws to remove, your goal is to remove the sheath covering the entire unit. The black matte plastic casing will slide off of the entire machine, but 3 plastic clips must be released first. Unfortunately you can not see these clips. When I took the unit apart, the only way I found to release these clips was by inserting a flat-head screwdriver along the upper lip between the matte piece and the top panel, and repeatedly prying. Eventually you’ll hear the clips give way, and the unit will pop open, although it might never be the same again.
In my situation I didn’t complete this procedure without minor cosmetic damage to the plastic edges. Once you remove the sheath you’ll be greeted with a number of wires and circuit boards.

View of the tubing side of the coffee maker.

View of the side containing the main circuit board, with covers removed, and wiring harnesses.
Surprisingly the unit has a total of 4 PCB boards in it. As best as I can identify, their functionality is partitioned nicely:
- Small board sitting above large main board on side of coffee maker – Power conditioning and fuse board, this board receives the main AC voltage and conditions it before it heads to the large transformer.
- Large main board – This board, complete with a PIC microcontroller, handles all the logic and motor / solenoid control. All motors and solenoids are controlled using simple transistor-switch drive circuits. The heater voltage is also distributed using this board in the lower right corner. It appears that the PIC microcontroller exercises some control over heater voltage also, possibly using a triac
- Small board behind main control board – Additional heater control/filtering and power distribution
- Button Interface Board – Handles all the interfacing through the 16-pin connector from the main-board. Also has an op-amp circuit connected to a FPN-07PG pressure sensor, which is used to monitor tank pressure inside the unit
I also went ahead and identified the major connectors on the main controller board for reference:
- J11- Air pump
- J7- Pressure Release Value
- J4- Descaling Value
- J8- Cold Water Level Sensor
- J3- Cold Water Pump
- J15- Boiler Water Level Probe
- J9- Boiler Temperature Probe
- J10- Brew Head Open Switch
While I didn’t directly hack these connections, they might be of interest for future work.
Hacking the Interface
While initially there’s an impulse to hack the entire device and replace the control circuitry entirely, doing so would require a very full understanding of the device’s modes of operation. The Keurig operates to minimize noise, and as such even brewing a single cup of coffee is a multistage process, consisting of pumping fresh water into the boiler, heating the water to a desired pressure, and then expelling the water out through the brewing head, using forced air pressure. Additionally there are many sensors to detect the closure of the brew head, water level, boiler temperature, tank pressure, and button statuses. I decided to take a restrained approach and hack only the upper interface board, replacing human interactions by signals read and written by an Arduino.

The Keurig microcontroller and logic runs on 5V, so an Arduino was an easy choice. Additionally I wanted to make this guide accessible so using a hardware platform familiar to many was a strong consideration. Looking at the interface board, it’s obvious that a single 16-pin connector carries all signals from it to the main controller board. I spent some time and documented this interface below:
Display / Interface Board Connector Pinout
| Pin | Function |
|---|---|
| 1 | Voltage supply for V-ref of Op-Amp |
| 2 | Heating LED |
| 3 | Descaling LED |
| 4 | 10oz Brew LED |
| 5 | Pressure Sensor Voltage Output |
| 6 | Analog Muxed Switches |
| 7 | Add Water LED |
| 8 | VCC (5V) |
| 9 | GND |
| 10 | GND |
| 11 | Not connected |
| 12 | Auto-Off LED |
| 13 | Power LED |
| 14 | Not connected |
| 15 | 8oz Brew LED |
| 16 | GND |
The design decisions that drove this specific layout form an interesting case study. The LEDs are all given dedicated IO lines, due to the PIC’s ability to directly drive them, while the buttons are multiplexed over a single analog line, due to the PIC’s ability to read an analog value. These decisions were certainly motivated by the cost trade offs between running dedicated wires, adding additional ICs, and simplifying the PCB layout. Also of interest is the pressure sensor, a FPN-07PG, placed on this board. The pressure sensor has a proportional current output, and is attached to the tank output of the coffee maker. A quad package op-amp sits on the interface board, along with a reference voltage source, and provides a scaled voltage output from the pressure sensor. Additionally two glued, factory-set calibration pots can be found on the device.

To tap into this functionality I went with the direct approach and simply tapped wires onto the supply signals. LEDs are active low, while buttons pull a common signal wire high, through a resistive divider, which allows the PIC to determine which button was pressed, based on different input voltages. I added wires to the switch solder points, and pre-resistor LED signal wires. Overall I ended up with 9 wires for connection to the Arduino. For inputs to the Arduino, from the LEDs and Buttons, I have Power, Brew Ready, Add Water, and if the 8oz or 10oz button is being pressed. For outputs I have one to the power switch, and the 10oz and 8oz brew buttons. I disconnected the switches for brewing from their original functions, effectively disabling them.

The wires come out of the interface through a hole made on the bottom of the plastic enclosure and snake their way along the back of the unit. They are all connected to the Arduino, which I have placed inside a small plastic bag. While the bag certainly isn’t water tight it should prevent the board from coming in contact with any metal fittings or pump housings, and provides a little bit of splash resistance. The Arduino fits snuggly in the base of the unit, and the USB cable snakes out the hole in the back where power leaves also.

Adding RFID
With the Arduino securely installed, the final step was to add RFID to the coffee maker. I considered wiring the RFID reader directly to the Arduino, but attaching it via a separate USB port gave greater flexibility, which was valued since this is essentially the first-generation prototype of the coffee maker of the future, and the design requirements are likely to shift as exploratory work is done.

Adding RFID was fairly simple. I used Sparkfun’s ID-12 breakout board, and sensor, Luckily the sensor fits snuggly in the brew head, after removing a small bit of plastic for the USB cable. This was honestly the perfect spot for the reader, now you literally tap the top of the machine with your RFID tag, and it will spring to life to do your bidding.
Wrapping Up

This wraps up the hardware section of hacking this device. Next time I’ll be presenting the software side of things, including the Arduino sketch that powers the show, and the scripts running on a Netbook next to the device that provide authentication, logging, and even snap a photo of you as you brew.
Update: Part 2 is now available: read here.
OMG COOL!! LOL HAX
Sami
28 Dec 11 at 4:40 am
[...] his co-workers are lucky enough to have a Keurig coffee maker in their office, though they have a hard time keeping track of who owes what to the community coffee fund. Since K-Cups are more expensive than bulk coffee, [...]
Securing your Keurig with RFID - Hack a Day
4 Jan 12 at 2:20 pm
[...] his co-workers are lucky enough to have a Keurig coffee maker in their office, though they have a hard time keeping track of who owes what to the community coffee fund. Since K-Cups are more expensive than bulk coffee, [...]
Securing your Keurig with RFID » Geko Geek
4 Jan 12 at 2:30 pm
[...] http://andrewbrobinson.com/2011/12/27/hacking-the-keurig-b40-coffee-maker-part-1-hardware/ Share this: « Steve Jobs action figure ̵… No Comments » Click here to cancel reply. [...]
Tim Newton - Hack your Keurig Coffee maker – RFID
4 Jan 12 at 4:42 pm
Nice hack! I have shared your pain in trying to figure out how this thing comes apart, I found one of these in the trash and since I don’t drink coffee I tore it apart. It was worth it though, these things are a wealth of parts!! I have yet to get the pressure sensor working by itself but I will build an altimeter eventually.
TomTheGeek
4 Jan 12 at 9:07 pm
[...] his co-workers are lucky enough to have a Keurig coffee maker in their office, though they have a hard time keeping track of who owes what to the community coffee fund. Since K-Cups are more expensive than bulk coffee, [...]
Securing your Keurig with RFID | Waxnsuds
5 Jan 12 at 2:00 am
[...] his co-workers are lucky enough to have a Keurig coffee maker in their office, though they have a hard time keeping track of who owes what to the community coffee fund. Since K-Cups are more expensive than bulk coffee, [...]
Securing your Keurig with RFID | CisforComputers
5 Jan 12 at 5:05 am
Very nice description! I did you figure out how the level sensor works? Does it use Hall Effect or Reed switches to detect the position of the magnetic float?
Stevo
6 Jan 12 at 3:40 am
Stevo,
My best guess is it’s a reed switch. I don’t think they’d go through the trouble of a hall effect sensor here!
Andrew
6 Jan 12 at 6:40 am
We have the same machine, our issue is the large is not large enough. I would like to hack it to add 1 or 2 more size options.
we normally have to restart the machine (with the same k-cup) and let it run about half the cycle to full out cups. We turn off the machine to do this, and that causes problems with the next cycle (pressure, time to brew, reheating water etc.) Any suggestions?
rgthane
17 Jan 12 at 6:05 pm
Really amazing. Very risky but will satisfy the urges of those who want to try. Hacking is fun. It always is especially with blooming technology.
Martha Hawkins
13 Mar 12 at 12:07 pm