Magnetic Contact Switch (Door Sensor)


SKU: SB-044 Category:


This is a very easy and straight forward to use Magnetic Contact Switch (Door Sensor). This basically is compose of a Reed Switch inside. You can use this to detect an Open or Closed door. The 2 wires are connected (Closed) when the 2 white plastic contact switches are stick together and the 2 wires are not Connected (Open) when the 2 contact swithces are not in contact.

Features / Specifications

  •  Easy to use application
  • Wire Connected (Closed) when the contact switches are in contact AND Wire NOT connected (Open) when contact switches are not in contact.
  • Sticker included to attach the contact switches

Tutorials / Manuals / Documents

(Upload the Code directly)

Connect one end of the wire to the GND and one end on Arduino Digital PIN 3.
Touch the contact switches and the LED (Arduino PIN 13) on the Arduino board will turn ON
and OFF when the contacts are not in contact

// digital pin 3 is where the contact switch attached to read.
int contactPin = 3;

void setup() {
// make the contact switch (contactPin) pin an input.
pinMode(contactPin, INPUT);
pinMode(13, OUTPUT);

void loop() {
if (contactPin == LOW) {
digitalWrite(13, HIGH);
else {
digitalWrite(13, LOW);