Chapter 6. Extend Your Pi

The real magic of the Raspberry Pi happens when you make it a part of something else. Use the GPIO to connect it to new devices ([Hack #56]). Connect Arduino shields ([Hack #58]). Add a tiny screen ([Hack #57]), numeric keypad ([Hack #60]), or heat sink ([Hack #61]). Do all of them, and make something amazing. This chapter is to help get you started taking the Pi beyond mere Linux computer into something more.

Hack 56. Control GPIO from a Web Browser

Your Raspberry Pi GPIO interface is a gateway to an entire Internet of Things. Here is a simple way to access it from a web browser.

Every day, more and more devices become network-aware, either intentionally or as a result of clever hacks. This phenomenon has many names, but the most common seems to be “Internet of Things.” You can use your Raspberry Pi to help your dumb devices get smart and join the Internet of Things.

The best way to connect your Pi to other devices is via the GPIO expansion ports. If you’re not sure what that means, go take a quick read through [Hack #14]. These digital pins will let you wire almost anything into your Raspberry Pi, but once the physical connection is made, you’ll want a framework in place to actually do something.

Eric PTAK created a REST framework and web app to control the Raspberry Pi and its GPIO through the Web. Called WebIOPi, this framework allows you to use and control your Pi’s GPIO over the Internet (or through a number of language bindings and APIs).

To install it, ...

Get Raspberry Pi Hacks now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.