Building a simple alarm system
The Raspberry Pi’s GPIO pins can be configured for specific communication protocols such as I2C or set as standard input/output pins to gauge conditions or levels.
In this final section of the chapter, we will use our knowledge to build a simple alarm system. Our alarm system will consist of a pushbutton, a PIR sensor, and a buzzer. All components are connected to the GPIO port (Figure 5.9).
Figure 5.9 – Buzzer, pushbutton, and PIR sensor connected to the GPIO port through extension ribbon
In Figure 5.9, we are using a GPIO extension ribbon to connect the GPIO port to a breadboard so that we can easily prototype and reconfigure connections. The ribbon simplifies the process and keeps the wiring organized. Using the GPIO extension cable is entirely optional. Just as we did in Chapter 4, our Raspberry Pi is installed with the Raspberry Pi seven-inch touchscreen with the associated case.
We connect the components...