Chapter 16. The Internet of Things
16.0 Introduction
The Internet of Things (IoT) is the rapidly growing network of devices (things) connected to the internet. That doesn’t just mean more and more computers using browsers, but actual appliances and wearable and portable technology. This includes all sorts of home automation, from smart appliances and lighting to security systems and even internet-operated pet feeders, as well as lots of less practical but fun projects.
In this chapter, you learn how your Raspberry Pi can participate in the IoT in various ways.
16.1 Controlling GPIO Outputs Using a Web Interface
Problem
You want to control general-purpose input/output (GPIO) outputs using a web interface to your Raspberry Pi.
Solution
Use the bottle Python web server library (Recipe 7.17) to create an HTML web interface to control the GPIO port.
To make this recipe, you will need the following:
-
Breadboard and jumper wires (see “Prototyping Equipment and Kits”)
-
Three 1kΩ resistors (see “Resistors and Capacitors”)
-
Three LEDs (see “Opto-Electronics”)
-
Tactile push switch (see “Miscellaneous”)
Figure 16-1 shows the breadboard layout for this.
Figure 16-1. The breadboard layout controlling GPIO outputs from a web page
An alternative to using a breadboard is to attach a Raspberry Squid and Squid Button (see Recipe 9.10 and Recipe 9.11). You can plug these directly into ...