Coffee is On
by Mike Aanenson, on April 21, 2011
A classic issue for people who work at an office is finding out when fresh coffee is brewing. Do you make a pass by the kitchen area every 20 minutes? Maybe wait for the aroma? Take matters into your own hands and fire up a pot? Of course, another common problem is finding what appears to be the remains of a previously brewed pot and debating in your mind on how old it could be and whether or not it is in within the drinkable window. (What's your rule? 2 hours? 2 days?)
Smart-connected appliances are not that far away from kitchens near you. It won't be long before your refrigerator emails you that the milk is almost gone. A freezer that tells you that it is using more power than usual. A blender that connects over WiFi to update it's firmware. A bread machine that you can download new recipes for you.
At the Exosite office, we have a run-of-the-mill Mr. Coffee coffee maker - an economical choice that was probably less than $20. It doesn't have many smarts: you hit the button and it runs for 2 hours. We figured it would be great if Mr. Coffee could get connected not only to let us know when coffee is on but also to provide stats on how often it runs, what the power usage is, etc...
This coffee maker is the right price for not caring if I end up damaging it. Tearing it apart, I found that the LED that turns on when the coffee maker is turned on is a perfect signal to latch onto.
I choose to use a new open hardware prototyping product I found, called Mbed (http://mbed.org/), based on an NXP LPC1768 with an ARM Cortex-M3 Core running at 96MHz . It has a ton of features on that little chip. The reason I was excited about using the mbed device is that it is a small single board that is easy to prototype with. It has 0.100" headers, several serial ports, an Ethernet port, and has an interesting user interface for compiling applications. The mbed team has created a web-based IDE to compile and manage applications. After you compile, your browser downloads a binary (.bin) file which you can put on the mbed device which when connected over USB, it looks like a USB drive on your computer. I found the online compiler (called mbed compiler) easy to use and get started.
My app was simple, it acts as a client on the network and connects to Exosite's server. Each watches for a high signal on a GPIO pin that is connected to the coffee pot's 'on' LED. Simple enough program. I was able to use our HTTP API to use POST requests to the Exosite server.
Warning: Be very careful when taking apart appliances. Always unplug from power and remember what you are taking apart so you can put it back together. Coffee maker's have a heating element in them which adds to risk of fire and injury if careful attention is not applied when making changes to the electronics.
The hardest part was not wiring this up to the coffee maker's circuitry but fitting it into the plastics without burning it up from the heating element. Luckily, you'll find that if you take the bottom off of it, there is a decent amount of space in the back and a big hole where the power cable runs out. I was able to fit the Mbed board soldered onto a prototype board with an Ethernet connector in this back area of the coffee maker and fit both the Ethernet cable and a separate power supply cable (USB cable from USB wall supply) into the already existing hole in the backside. A GPIO (and ground) are connected to the coffee maker's circuit board. Although it would have been nice to use the coffee maker's electronics power supply, I found that it was not suitable for powering my mbed board in addition and for now, will just use an external supply. I had hoped to read more data from the coffee maker's little micro, but for now, I have what I want.
Up on the Exosite portal, I add my coffee maker as a device client and begin to see it reporting data. I can capture the on/off time using a simple event rule, which watches the data source that reports the value of the LED (high/low). I've set up my event to wait 2 minutes to go active and then it generates email alerts to everyone in the office. Everyone knows when the coffee maker is ready and they can go fill up their mugs.
When I have a little more time on my hands, would like to add a sensor to monitor the power/current and a few other features. Having a way to weigh the coffee maker might tell us how much coffee is left in the pot, have to think about that one.