Chapter 3. Adding Another Sensor

Just as when writing code, taking an iterative approach to building hardware is always advisable: change one thing, test, and then change another. In later chapters, we’ll take the evolutionary approach one more step forward and move our sensors off the breadboard, but for now, let’s add another sensor.

The Sensor

The next sensor we’ll add is one to detect motion.

PIR Sensor

We’re going to make use of a Passive Infra-Red (PIR) motion sensor (see Figure 3-1).

A typical PIR sensor, front (left) and rear (right) with connector and potentiometers to adjust the sample rate and sensitivity of the sensor

Figure 3-1. A typical PIR sensor, front (left) and rear (right) with connector and potentiometers to adjust the sample rate and sensitivity of the sensor

PIR sensors are commonly used in alarm systems, as they’re an inexpensive and fairly easy-to-use way to detect motion. While there are a number of different PIR boards commonly available (and each will have slightly different specifications), they all pretty much work the same way.

A PIR consists of a pyroelectric sensor that can detect levels of Infra-Red (IR) radiation split into two halves. The halves are wired to cancel each other out if the amount of IR radiation is constant. However, if the levels are changing, such that one half of the sensor sees more (or less) than the other, then the combined output of the two will be pulled high or low.

The PIR board in Figure 3-1 contains a pyroelectric sensor underneath a Fresnel lens (the plastic dome on ...

Get Distributed Network Data now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.