Hardware Reference
In-Depth Information
your garage door is open for a period of time. So by combining sensors, rules and actions, you
can create a more intelligent home environment.
A door switch contains a reed switch (see Figure 13-1) that is triggered when the two pieces
come apart. One piece is attached to the door and the other to the door frame. One of the
two halves contains a magnet and the other a reed switch that is held closed when the mag-
net is near. When the two come apart the magnetic ield loses its strength, and the switch is
broken. his type of switch is closed when the pieces are together and open when they come
apart. So when the door is closed current lows through the switch, and when the door is
open the current is broken. his type of switch is called normally open. he motion sensor,
sometimes known as a passive infrared (PIR) sensor (see Figure 13-2), is packaged with an
integrated circuit and a lens that will focus the moving objects for the sensor. A motion sen-
sor is also normally open, so both of the sensors interact with the Raspberry Pi through the
GPIO port in the same manner, which makes the software for both identical. You will be
writing some Python script to monitor the sensors and produce an action when either sensor
is triggered. In this tutorial you will trigger a message to the screen, but you could take any
number of other actions as explained before.
Figure 13-1:
A door switch.
 
Search WWH ::




Custom Search