Detecting motion – PIR sensor

Ever wondered how those motion sensors work? Usually, we find them in lights that turn up when we move. Almost all of them use a simple and common sensor called a Passive Infrared (PIR) sensor.

Here, we will build one of those annoying movement-sensitive lights, using an Arduino, its built-in LED, and a PIR sensor.

Getting ready

The following are the ingredients needed to execute this recipe:

  • An Arduino board connected to a computer via USB
  • Jumper wires
  • A PIR sensor

How to do it…

Hooking up a PIR sensor is easy:

  1. It has three terminals. One is the voltage input, one is the ground, and the last one is the data pin.
  2. Connect the ground on the PIR to one of the GND pins on the Arduino. Connect the voltage input to 5V, and finally, ...

Get Arduino Development Cookbook 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.