Alarm Sensor · Contact Sensor · Smart Home Security

Designing a Matter Door/Window Contact Sensor: Reed Switch, Magnetic Gap and the ContactSensor Cluster

Published 2026-10-20 · 9 min read · By Shenan Yangguang engineering

The contact sensor is the quietest device in a security system and the one most often under-engineered. Its reliability is decided in the reed switch, the magnet gap and the enclosure — long before it ever touches a radio. Here is how a magnetic switch becomes a certifiable, dependable Matter product.

Key takeaways

  • A contact sensor turns a magnetic field change into an open/closed report.
  • The magnetic gap — not the chip — sets mounting tolerance and reliability.
  • A tamper switch reports attack on the sensor itself, not just the door.
  • Matter standardises the report via the ContactSensor cluster; the physics stays ours.
  • Contact sensors are usually battery devices that sleep for years between events.

What a contact sensor is, in one sentence

A door/window contact sensor is a two-part device that reports whether an opening is closed or open: one half holds a reed switch, the other half holds a magnet, and separating the two — by opening the door or window — removes the magnetic field that was holding the switch closed, which the device reports as an event. It is the simplest security sensor there is, which is exactly why its quality is easy to underestimate. A contact sensor has no optics, no motion and no processing to hide behind; if the switch, the magnet or the enclosure is wrong, the failure shows up as a missed open or a false open — both unacceptable on a security device.

The reed switch and the magnet

A reed switch is a pair of ferromagnetic contacts sealed in a glass capsule that close when a magnetic field is present and open when it is removed, so the door state is literally a magnetic on/off. The magnet half is a small permanent magnet; when the two halves are aligned and close, the field keeps the contacts closed and the device reads "secured." Open the door, the magnet moves away, the field collapses, the contacts open, and the device reads "open." The elegance is that there is almost no current drawn in either steady state — the sensing is passive and the only active work happens at the transition.

What the magnetic gap really sets

The magnetic gap is the maximum distance between the switch and the magnet at which the contact still reliably closes, and it determines how forgiving the installation is. A larger gap tolerates misalignment, wider door frames and the slight movement of a warping wooden door; a smaller gap demands precise placement and looks cleaner but fails the moment the magnet drifts. Gap is a mechanical design decision, not a specification to guess: we validate it on the bench across temperature and with the actual enclosure and magnet, then publish the number the installer can rely on. The paired overview of contact sensors with PIR detectors is covered in our article on door and window contact sensors with PIR motion detectors.

The second switch: tamper

A tamper switch detects physical attack on the sensor itself — the magnet pulled off, the enclosure pried open, or the unit removed from the frame — so the device can report that it has been defeated rather than silently going quiet. On a security-grade product this is not optional; a sensor that can be disabled without raising an alarm is a liability. The tamper contact is a separate circuit from the door contact, and the firmware treats its trigger as a distinct, higher-priority event. We wire both switches and validate that removing the cover, not just opening the door, produces the expected report.

Putting it on Matter

On Matter, a contact sensor is a device type that exposes the ContactSensor cluster, whose StateValue attribute reports 0 when the monitored opening is open and 1 when it is closed, so any Matter controller understands the event without a vendor app. Matter standardises what the sensor reports; it does not dictate how the sensor senses. The reed switch, the magnet, the gap and the firmware that debounces the transition are the factory's own engineering, and the connectivity is integrated as a standard CSA-certified Matter connectivity module — a purchased component like any other, not the product's identity. A brand gets an interoperable open/closed report and keeps full ownership of the sensing IP.

Reporting, debounce and battery

A raw reed switch chatters as contacts settle, so the firmware debounces the transition before sending state. That debounce is a tuning parameter: too short and you report noise, too long and you miss a fast open-close. We set it per product and confirm it against a real door cycle on the test rig. Because the device only wakes to evaluate and report a change, it spends almost its whole life asleep — which is why a contact sensor, properly designed, runs for years on a single cell.

Power and the battery budget

A contact sensor is normally a battery device because its steady-state current is effectively zero and it only wakes to send a short report when the door state changes, so a small coin or cylindrical cell can last for years in typical use. The dominant power cost is the radio transmitting the report, not the sensing. This is why many security contact sensors use a low-power radio such as Matter over Thread rather than Wi-Fi: the wake is rare and the transmit is brief. The radio choice and its effect on the power budget are covered in our article on Matter over Thread versus Wi-Fi for alarm sensors. The detection side and the radio side must be designed together, because a thrifty switch stage is wasted if the radio wakes too often.

Mechanical and enclosure design

The enclosure does more than hide the parts. It holds the switch and magnet in the alignment the gap was validated for, resists the humidity and temperature swings of a door frame, and presents a surface the installer can mount cleanly — often with adhesive for rentals or screws for permanent fitting. Cover design, wall thickness around the reed switch and the gasket that keeps moisture out are all part of the product, not afterthoughts. We treat the enclosure as a structural component of the sensing system, because a warped or swollen housing directly changes the magnetic gap the field relies on.

Factory stance — we build the sensing, not just assemble

Shenan Yangguang designs the schematic, builds the prototypes, writes the detection and reporting firmware, cooperates on certification and runs mass production — so the reed-switch selection, the magnet gap, the tamper circuit and the enclosure are engineered as one product. A contact sensor bought as a black-box module and bolted to a board inherits someone else's gap and someone else's tamper behaviour; building it ourselves means the "closed when secured" promise on the box is the one we measured. We keep the bench measurement record as part of the product file so the specification is traceable to a test, not to a hope.

Placement is the last half of the product

Even a well-designed contact sensor fails if mounted wrong: magnet and switch aligned but too far apart, or a gap that drifts as the door settles. We document the recommended gap, the alignment tolerance and the mounting method per product, because the final step of does it work is the installer, not the factory. Good installation guidance turns a capable sensor into a reliable alarm, and we treat the mounting guide as part of the deliverable rather than an afterthought — the same discipline we apply across the security line, from contact sensors to the PIR technology explained in our PIR motion sensor deep dive.

Frequently asked

What is a door/window contact sensor?

A door/window contact sensor is a two-part device that reports whether an opening is closed or open: a reed switch sits in one half and a magnet in the other, so separating the two (by opening the door) breaks the magnetic field and changes the switch state, which the device reports as an event.

What does the magnetic gap mean and why does it matter?

The magnetic gap is the maximum distance between the switch and magnet at which the contact still reliably closes. It sets the mounting tolerance: a larger gap tolerates misalignment and wider door frames, while a smaller gap forces precise placement. Gap is a mechanical design decision, validated on the bench, not a number to guess.

Why add a tamper switch?

A tamper switch detects physical attack on the sensor itself — removal from the frame or opening the enclosure. For a security device, the sensor reporting its own defeat is as important as reporting the door, so a separate tamper contact is standard on security-grade units.

How does a contact sensor appear on Matter?

On Matter, a contact sensor is a device that exposes the ContactSensor cluster, whose StateValue attribute reports 0 (open) or 1 (closed). Matter standardises that report; the reed-switch physics, magnet and firmware that produce it remain the factory's own engineering. Connectivity uses a standard CSA-certified module.

Why is a contact sensor usually battery powered?

A door contact draws almost nothing while idle and only wakes to report a state change, so a small coin or cylindrical cell lasts years. Battery choice, sleep current and how often the radio wakes to confirm state together set the service life the brand can promise.

Specifying a contact sensor with a target gap and tamper profile?

Send your door-frame tolerance, mounting method and tamper requirement. We validate the magnet gap on the bench and hand you a measured specification, not a catalogue number.

Request a Quote