Somewhere near the beginning of my journey into programming, a visiting instructor mentioned — offhand — that her company had a system that would start brewing coffee with a Slack command. As a person who is 90–95% fueled entirely by coffee, and a Turing student with absolutely zero time to make it: this was all I needed to hear. I decided to make a Coffee Bot for the Turing Slack team. It would be a system that users could (at first) use to let people know that that coffee was brewing, and then eventually use to actually start the brewing process remotely.
This post will go through the later part of the process: building the Coffee Maker Bot.
Not As Easy As It Seems
So let’s say you’ve got a coffee pot. How do you turn it on? Just flick the switch. Well, not so fast. There are things you need to do before you can even get to that point: fill the water tank, grind the coffee, put it in a filter, put the filter in the pot. Then flick the switch. Sure. Fine. But I can’t just send a Slack command and that’s all done for me. I have to use the Slack command to talk to a server (Coffee-Bot Central), which then has to reach out to something else that can interact with the real world, and then that something else needs to (at least) flip the switch.
Brewing Coffee With Pi
I decided that my “something else” would be a Raspberry Pi, partially because my roommate was merciful and let me borrow his, partially because I didn’t know for sure how complicated this would get and wanted the expandability/power of a Pi, as opposed to the slightly more limited Arduino.
A few hours of messing with various configurations as well as a brand new Coffee-Bot Central endpoint later, and Coffee Maker Bot was born. I could send type
/make in Slack and get a response from the server + API running on the Pi.
In Which Our Hero Tempts The Blue Smoke Of Electronic Death…
Here’s where things get tricky. Now that I can remotely control the Pi, how do I actually make it, you know, brew some delicious coffee? Time to hit the books. I read documentation for various coffee brewing implementations (one day…) and scrolled through endless lists of servos, solenoids, and circuits. My original dream was to set the Pi up to brew via pour-over, but I would need a pump to accomplish this and high-temperature controllable pumps just weren’t within my price range. So I set my sights on Mr. Coffee. I wound up purchasing a relatively high powered Servo, an Adafruit Servo HAT*, and a battery pack. But these items alone didn’t solve the problem: now I had to learn how to put all these pieces together and make delicious, delicious coffee.
There’s something fairly impressive about using your computer to make something happen in the real world. Unfortunately, this success was short lived as I experienced two unrelated failures in quick succession. Failure the first: the battery pack I purchased relied on two fragile connecting cables to power the HAT. I somehow managed to bring those wires into contact with the Pi itself, and in a brief puff of blue smoke, blew the fuse on the Pi. The second failure involved a mistaken belief that I would not have to solder anything — which caused the servo to actually run ~10% of the time.
Fortunately I went ahead and begged/borrowed a functional Raspberry Pi from the good folks at Turing School, replaced the battery pack with a more stable power supply, and then after some asking around in Turing’s Slack was able to secure a quick soldering lesson.
Great. Now everything ran smoothly. I could send the Slack command and milliseconds later hear the dulcet tones of the servo moving back and forth.
Which just left one more problem: how was I going to set this up so that it would actually flip the switch and start the brew process?
Nothing Is Ever Easy
As the big bold words up there say: something that comes so naturally to us is incredibly difficult for a robot. The servo needs to be properly positioned to hit the switch. It also needs to be securely fastened to the surface it’s standing on, otherwise it will only end up pushing itself over — not the switch. Once that’s been taken care of the coffee machine itself needs to be secured (otherwise it’ll start moving around, too). This requires a great deal of testing and angst and hearing whirring noises in your dreams and ultimately a surprising amount of packing tape. Whew. At long last, though, the coffee bot could reliably start the brewing process when it received the right command. Coffee Maker Bot — once a mere gleam in a young Turing student’s eye — could now brew delicious coffee whenever asked.
It doesn’t look like much but this is the first ever Coffee-Bot / Coffee Maker Bot brewed cuppa’. Tastes like success.
Okay Great Congratulations And Stuff But What’s Next?
I’m glad you asked. In a future blog post I’ll talk about the Coffee-Bot Central API. I’m in the middle of moving it from Digital Ocean to AWS, which gives me the perfect opportunity to figure out how to connect it to AWS IoT, a mystical magical system that hopefully will enable people not-myself to take advantage of my APIs and software on their own Raspberry Pi.
For the bot itself I’m working on making the brew script customizable for different coffee beans, and giving the user more fine-grained control than just “hey, make me a pot of coffee.” Long term: I haven’t given up on the dream of remote-control pour over. Just imagine waking up, tapping a button on your phone, and minutes later there’s a delicious cup of pour over coffee waiting for you downstairs. (Or wherever.) I would also like to experiment with streamlining the physical processes involved, with the hopes of maybe deploying Coffee Maker Bot to other, real world locations in the near future.
Thanks for reading and I hope you enjoyed!
Many thanks are in order for the people who helped me put this together — too many to list reasonably but you know who you are, and thank you again!
* I assumed that HAT stood for something extremely cool. As it turns out: Hardware Attached on Top. Which is in its own understated way quite cool, but not what I was expecting.