The Internet of Coffee: Building a Wifi Coffee Maker

I originally wrote this post for the SocialCops engineering blog,
check it out here - The Internet of Coffee: Building a Wifi Coffee Maker

Here at SocialCops, we’ve begun using Internet-of-Things technology to research solutions for some of the world’s most pressing problems: monitoring pollution, conserving energy, protecting against identity fraud, and…making coffee.

“[If we could] turn on the coffee machine via slack, we’d be set,” Christine wistfully wrote one afternoon on our #coffee Slack channel. Being located in Delhi, good chai is readily available to us day and night, but sometimes a good cup of coffee in the morning (and afternoon, and evening) is required to keep us going. Starting a fresh brew during our commutes and having a full pot waiting at the office once we arrive sounds like a fantastical dream, but here at SocialCops we thrive on turning these types of dreams into reality.

Setting Up Our WiFi Coffee Machine

The basic hardware setup was simple: we got a wifi-enabled Particle Photon micro-controller and hooked it up to a 5v electrical relay to control the power supply to the coffee machine.

Warning: this project deals with dangerous high-voltage electrical currents, so NEVER try to follow these steps if any of the components are plugged in, or if you are unsure of what you are doing.

First we cut an extension cord in half, connected the “hot wire” from each half to the relay, and spliced the ground and neutral wires from the two sides back together.

Relay WiringRelay Wiring.

Then we hooked our microcontroller up to the relay, using the D1 pin on the Photon to communicate with the IN1 port on the relay, sending 5v power from the VIN pin of the Photon to the VCC port on the relay, and connecting the GND on the relay to GND on the Photon in order to complete the circuit.

Relay Connection With Photon MicrocontrollerRelay Wiring.

Finally we packaged the Photon and relay together into a small plastic enclosure, and cut holes for power cords into the sides of the container. By plugging one end of the extension cord into the wall, and the other side into the coffee machine, we were now able to control power to the coffee machine by sending HTTP requests over WiFi to the Particle Photon microcontroller!

High Voltage

There were a few extra wires in this setup, resulting in too much clutter on our kitchen counter, so we packaged the whole setup into a larger cardboard box. Taking advantage of the extra area on top of the box, we gave CoffeeBot a face, complete with LEDs for eyes to monitor the hardware status.

Coffee Bot

Enter CoffeeBot

Our team uses Slack for online communication; one of Slack’s many features is the ability to create Slackbots, or automated users that can respond to chat messages and carry out advanced tasks.

Using BotKit, a NodeJS module for programming Slackbot behaviors, we built CoffeeBot. CoffeeBot is a capable of receiving naturally worded messages on Slack, deciphering them, and sending the corresponding commands to the coffee machine.

For instance:
Slack Chat

Other features of CoffeeBot include:

  • Getting the status of the machine and how long ago the last brew was started
  • Posting to Slack when the coffee’s ready
  • Automatically switching off the coffee machine after an hour, in order to save energy.
  • And a few other secret behaviors

Caffeinated Continuance

Now every morning before leaving for work, we can start the coffee machine directly from Slack! In the future we want to add more advanced features, such as automatically loading coffee grounds and water, and measuring how many cups of coffee the office consumes per week. Someday we might even have a robot to deliver the fresh coffee directly to our desks, which admittedly sounds like a crazy and fantastical dream right now.

But you know how we feel about fantastical dreams.

Patrick Triest

Full-stack engineer, data enthusiast, insatiable learner, obsessive builder. You can find me wandering on a mountain trail, pretending not to be lost.

Subscribe to Break | Better

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!

Note - Disqus is a great commenting service, but it also embeds a lot of Javascript analytics trackers. If you want to keep your browsing data private, you can disable these trackers from your "Disqus" account settings, in the Acount -> Personalization page.

Get the latest posts delivered to your inbox.

I hate spam. I promise not to send many emails.

or subscribe via RSS with Feedly