Join David Ross for an in-depth discussion in this video Explore a basic alarm system written in Python, part of Home Monitoring and Control with Raspberry Pi.
- Our alarm system program…is written in a scripting language called Python,…so let's take a look through the code.…As before, the top line is called the shebang…and you should never change that.…There's a couple of import statements…and GPIO.setmode is important…because it's saying we're going to be using…the Broadcom pin numbering system in our code.…And we're going to shut off our warning messages.…But here's where the interesting part comes.…We're going to set pin 27 to be Output…because that's the thing connected to the Solid State Relay…and we need to drive voltages out on the Solid State Relay.…
We have to be able to control voltages.…That's why it has to be Output.…Pin 22 is Input because the Motion Detector…is going to change the voltages on pin 27…and our program is going to look at those voltages…and make decisions whether or not…motion is detected or not.…If you remember, pin 16…is connected directly to pin 18 using a wire,…and because of that, we're making pin 16 Output…and by pressing on pin 16,…we can change whatever is on pin 18.…
This DIY electronics project provides simple directions for getting your home monitoring system up and running. Author David Ross helps you select a power supply, camera, motion detector, enclosure, and other components and accessories, and make your system "smart" by connecting to web services frameworks such as Weaved and WebIOPi. Then he helps you program the logic to make your Pi camera take pictures and stream video, connect to home peripherals, and mount your alarm system. With this training, and a little elbow grease, you can create a fully autonomous system that helps you and your family feel more secure at home and away.
Note: These instructions work with Raspberry Pi B, Raspberry Pi B+, and Raspberry Pi 2 models.
- Selecting hardware, including a Raspberry Pi camera and a Pi Cobbler
- Configuring VNC, SSH, and WebIOPi services
- Sending SMS messages with the Raspberry Pi
- Taking and accessing pictures remotely
- Setting up video streaming with a Raspberry Pi camera
- Connecting the Pi to the development board
- Connecting the relay and motion detector
- Programming the alarm in Python
- Mounting and securing the alarm system