Magnetic contact switches are most used as a way to detect if a door or window is open. Basically one side has a Reed Switch in it and other side has a magnet in it. When the two side get close to each other, the two wires become connected and this can be read just like a binary button press using Arduino code.

Top view of magnetic contact switch with three screws.
This sensor is essentially a reed switch, encased in an ABS plastic shell. Normally the reed is 'open' (no connection between the two wires). The other half is a magnet. When...
$3.95
In Stock

This door sensor has two white wires but it doesn't matter what wire you connect to what pin because the sensor basically just connects the two wires together when the magnet gets close to it.

Connect one of the White wires to the GND pin.

The other White wire should be connected to the Signal 5 pin on the Crickit.

 

Once wired in, attach the Door Sensor to the part of the door frame farthest from the door hinge. This will ensure that the door sensor has the best chance of detecting that the door is open. The other side to the door sensor is just a magnet, but due to the small scale of the mini smart home you will want to space it about 0.5 inches away from the other side of the sensor so that the two sides get farther away from each other faster.

This guide was first published on Oct 02, 2019. It was last updated on Mar 18, 2024.

This page (Door Sensor) was last updated on Mar 08, 2024.

Text editor powered by tinymce.