Hardware Reference
In-Depth Information
If you wanted to have the WEBrick HTTP server start on boot of the Raspberry Pi, you could simply add the two
lines listed in Listing 10-7 to your /etc/rc.local file.
Listing 10-7. A Simple Command to Start the WEBrick HTTP Server on Boot
# start the webrick server for GPIO
cd /root/power-ctl/ && ./server-power-control.rb &
Summary
Congratulations! You can now turn a mains device on and off safely. Your Raspberry Pi is protected by two layers of
electrical separation. This chapter has talked a lot about the AC mains and how it works. I also stressed how dangerous it
can be to you and, of course, to your Raspberry Pi. I then talked about the main ways that low-voltage circuits are isolated
from high-voltage circuits. This is where you found out all about relays and the big part they play in this chapter. Then
I stripped down my mains unit and remote control so you could see what they look like and what parts they use. Then
I guided you though hacking the remote control unit so that you could connect it to your breadboard. I then described
how to use a relay and talked about the funny patterns on the sides of them and lastly we returned to WEBrick to build
another web site to control the GPIO pins. In the process you gained an understanding of simple CGI scripts. In the next
chapter I leap away from the hardware and the GPIO pins in order to focus solely on alternative operating systems.
Yes, that includes Android and, more important, some operating systems you may have never heard of.
 
Search WWH ::




Custom Search