Door / Window Sensors

Difficulty Level
Easy
Introduction

A door contact sensor is the most common type of sensor in a home security system. Knowing if and when a door was opened will be your best indicator if somebody was in your house when you were away.

Contact Sensor Types

There are two main types of door/window contact sensors: recessed or surface mounted. Recessed contact sensors are your best option if you can get a wire to them as it is more difficult to tamper with them. However if you don't have a wire run into your door/window trim, a surface mounted option will work just fine.

Wiring Diagrams

The hookup for a door or window sensor only takes two wires. One wire goes to GND and the other goes to any GPIO pin on your board.

Note: It doesn't matter which wire you connect to ground (GND). They can be interchanged and will work the same.

Click to enlarge
  • Black wire: Connected to GND (ground)
  • Orange wire: Connected to any available GPIO pin
Click to enlarge
  • Black wire: Connected to GND (ground)
  • Orange wire: Connected to any available digital pin
Finished Result

Below is a simple setup example of a door contact sensor connected to a Raspberry Pi on GPIO-23.