Hardware Reference
In-Depth Information
That is because your web browser expects to find a little file called favicon.ico for every web site you go to. The
quick and dirty fix for this is to run the following command in the same directory that the Ruby scripts are in:
# touch favicon.ico
You can now also see that your access.log file has entries in it now. When you are done with the WEBrick server,
just hit Ctrl+C; I have trapped this exit code so that my scripts will clean themselves up nicely when you hit Ctrl+C.
Congratulations! You now have a very simple security system.
Summary
In this chapter you gained an understanding of how simple a pressure mat is and that it is not some mystical security
device. Next up you learned about the PIR and that it's an infrared heat-wave sensor and not a motion sensor. After
the basics of the two devices in question, I gave you the methods to connect them to the Raspberry Pi; in turn you also
gained the knowledge of how to use other similar devices like tilt switches and magnetic door switches.
This was also the first time you manipulated the Raspberry Pi's GPIO pins at the command line. There are a lot of
other tools and scripts that can do this as well. You could use Python or the WiringPi tools; the latter can be found at
https://projects.drogon.net/raspberry-pi/wiringpi/ .
You then wrote a small and simple (but effective) shell script to detect movement on the pressure mat. After
connecting the PIR you faced the issue of how to monitor more than one device on the Raspberry Pi: reading the
output of a special file would no longer cut it. Ruby once again saves the day with WEBrick. In this last section you
created an HTTP web server inside Ruby that polled the special GPIO value files and displayed the output on a very
simple web page.
 
Search WWH ::




Custom Search