Subscribe to Make Magazine Today!

coverWhen Shawn Wallace and I wrote Getting Started with Raspberry Pi, we wanted to include a few projects that demonstrated the strengths of the single-board computer. One of those strengths is the ability to run a fully-fledged dynamic web server that could take direct control of the GPIO pins for turning on and off household appliances. In chapter 10 of the book, we walk you through how to install and use Flask, a Python based web framework for creating dynamic web sites.

The beauty of using Python and Flask is that it can be easily used in concert with RPi-GPIO, the popular Python module for controlling and reading the GPIO pins on the Raspberry Pi. In the book, we show you how you can write a single function to serve dynamic web pages for each of the pins on the Raspberry Pi. Each pin can be connected to a relay or Power Switch Tail to control many different AC appliances in your home. We kept things simple and used it to control a lamp, but you can control many different things such as air conditioners, TV’s, stereos, or even espresso machines:

It explains why I was absolutely delighted to see that Mark Moran created his own web-controlled espresso machine. The project was based on the example in Getting Started with Raspberry Pi. He made a few changes so that now he can pre-heat his machine via his wireless network from anywhere in the house! Thanks for sharing, Mark!

Matt Richardson

Matt Richardson

Matt Richardson is a San Francisco-based creative technologist and Contributing Editor at MAKE. He’s the co-author of Getting Started with Raspberry Pi and the author of Getting Started with BeagleBone.

  • Mark Moran (@markrmoran)

    Thanks, Matt! In the hours since I shared that picture, many people have asked me to “open source” it, but I tell them it’s the script and project straight from Shawn and your book, which even has as a sample iPhone screenshot: The coffee machine is on (turn off)?

    My espresso machine is supposed to pre-heat for 20 minutes, which can feel like a long time when you need an afternoon pickup. Now I can start it from my phone before I drive home, so it’s ready to pull when I arrive. As you suggest on page 133, I went to my router’s settings page and turned on port forwarding to my Pi. It took just a few seconds and works even when my Pi leases a new IP address! I just point my phone to (and even if I didn’t have my own domains, I’d just bookmark my public IP address, since dynamic leases rarely seem to change).

    I set this up a few weeks ago but was waiting for Adafruit’s PiBox case and mini WiFi module to make it look prettier.

    I decided to get a Pi after reading your book. MakerShed was having a year-end sale on eBooks, so I added yours to my cart. I wasn’t planning to get a Pi since I was still having fun with Arduinos, but figured I should see what everyone was talking about. I’d never used Python or Flask (or even Linux), but your book was such a fun, easy read that I immediately bought a Pi.

    How else can you connect your appliances to the web for under $50?

  • Rexford Carl Haugen

    Does this system use the Hyper Text Coffee Pot Control Protocol (HTCPCP / RFC 2324)?

    In seriousness, this is a cool setup that would be very nice if it could be integrated with home automation systems.

  • dtremit

    How did you actually interface the Pi to the coffee machine? Apologies if I’m missing something obvious.

  • zipwhip
  • メンズ レインブーツ ハンター

    バーバリー サイズ メンズ レインブーツ ハンター