A contact sensor is the simplest device in a smart home, and it is still the one people most often mount wrong. Two pieces go on a door or window: a body with the electronics and a battery, and a smaller part with a magnet. When they are close, the sensor reports "closed". When the magnet moves away, it reports "open". Most problems come from those two parts being a few millimetres too far apart, or facing each other the wrong way.
Reed switch or Hall sensor
There are two ways to detect the magnet.
A reed switch is a small glass tube with two springy metal blades inside. The explainer at Explain that Stuff describes it well: bring a magnet close and the blades become opposite magnetic poles, attract each other and snap together. Take the magnet away and the springiness of the metal pushes them apart. That basic form is normally open (NO): the circuit is open with no magnet nearby.
A normally closed (NC) reed switch works the other way round. Reed sensor makers such as Standex explain that it is usually made by biasing a normally open switch with a permanent magnet, so the contacts sit closed. A second magnet of opposite polarity then cancels the bias and opens them. That makes NC switches sensitive to polarity: turn the magnet around and it may not work.
A Hall sensor is a semiconductor that measures the magnetic field instead of moving metal. Aqara's Door and Window Sensor P2, for example, uses a built-in Hall sensor, according to the product listing. For a user the difference is small. You still have a main unit and a magnet, and the same rules about distance and alignment apply.
Reading the specifications
The one number that matters most is the maximum gap between the sensor and the magnet. Manufacturers state it in different ways:
- Aqara says the main unit and the magnet part of the P2 should be no more than 22 mm apart for a stable connection.
- ABB's MRS reed contact set for alarm systems is mounted with the two parts at most 10 mm apart. If the distance grows, the contact opens and interrupts the alarm zone.
- Sensaphone's FGD-0006 wired reed switch should have the magnet housing no more than 1/8 inch (about 3 mm) from the switch.
So the range is anything from a few millimetres to a couple of centimetres, depending on the product. Do not guess. Measure the gap on the door or window you plan to use before you buy, especially on windows with deep frames or sashes that sit well back from the frame.
The rest of the data sheet decides where you can use the sensor:
- Radio. The P2 runs on Thread, with Bluetooth only for setup, and needs a Matter controller with a Thread border router. Other sensors use Zigbee, Z-Wave or Wi-Fi. Pick the one your hub already speaks.
- Battery. The P2 takes one CR123A cell. Aqara does not give a battery life figure and says it varies with the border router and Matter apps used. Treat any battery life claim as a best case.
- Operating temperature. The P2 is rated for -10 to 50 °C and 0-95% humidity without condensation. That rules it out for an outdoor gate or an unheated shed in a cold winter.
Mounting: which part goes where
Wired alarm contacts follow a simple convention, and it is worth copying for wireless sensors too. Sensaphone's instructions put the switch on the fixed frame and the magnet near the edge of the moving door or sash. ABB says the same for its set: the contact on the fixed part, the magnet on the moving part. ABB also says installation should in principle be done inside the monitored area.
Putting the electronics on the frame has a practical side. The part with the battery does not move, so nothing gets knocked loose each time the door swings.
A few rules that save time:
- Mount near the opening edge, not the hinge. Near the hinges a door barely moves when it opens a little. A sensor there will still report "closed" while the door stands slightly ajar.
- Align the parts as the manual shows. Explain that Stuff points out that reed switches respond differently depending on whether the magnet is parallel or perpendicular to them, and that a magnet sliding past can switch the contacts on and off several times. Most sensors have a mark on both parts. Line those marks up.
- Use spacers if the gap is too big. Sensaphone and ABB both include spacers for alignment. On a wireless sensor, a small block or a second strip of tape under the magnet does the same job.
- Test before you peel the tape. Hold both parts in place with your fingers, open and close slowly, and watch the state change in the app. Only then stick them down.
Checking whether it works
A sensor that reports "open" and "closed" in the right places is not finished yet. Check three things.
First, the opening point. Open the door slowly and note how wide it is when the state changes. If a door can stand a few centimetres open and still read "closed", move the magnet closer to the edge or reduce the gap.
Second, bounce. As the magnet passes, a reed switch can change state more than once. If you see a burst of open-closed-open events, an automation may fire twice. If your platform offers a short delay or debounce filter on the input, use it.
Third, latency and range. The P2 listing gives a response time of 1 second. A sensor at the edge of the mesh, or behind a metal door, may be slower or drop messages. If you rely on it for a security alert, open the door a dozen times and see how many events arrive.
Wired contacts for alarms and DIY boards
Wireless sensors are convenient, but a wired reed contact still makes sense in two situations: an alarm system, and a DIY board such as an ESP32 with a free input.
Alarm systems usually use NC contacts. Sensaphone's instructions mount the switch so that it is closed while the door or window is closed and set the input to normally closed. This choice has a useful side effect: a cut wire looks the same as an open door, so tampering with the cable raises the alarm instead of silencing it.
Sensaphone also allows several NC switches in series on one circuit, as long as all of them are closed at the same time. That gives you one input for a whole row of windows. The catch is obvious: the system can tell that one of them opened, but not which one. If you need to know the exact window, give each one its own input.
On the data sheet, look for the contact type (NO or NC), the gap and the cable. ABB's set, for example, comes with a 4 m cable with four 0.14 mm² cores, two surface mount housings, spacer plates and flanges for fitting into a drilled hole.
Which one to choose
For a typical home where you want to know whether a window was left open before the heating comes on, a wireless sensor on your existing radio is the easy choice. Check the maximum gap against your frames and the operating temperature against the location.
For an intrusion alarm, or a door where battery changes are a nuisance, a wired NC reed contact is still hard to beat. It has no battery, it has no radio to jam or drop, and a cut cable reads as an alarm.
Either way, the work that matters is the same: measure the gap, mount near the opening edge, align the marks, and test before you stick anything down.