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.

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.
Page last edited March 08, 2024
Text editor powered by tinymce.