Magnetic door sensors

Introducing Magnetic door sensors
Published: by
Last updated:

Magnetic door sensors, also called reed switches, are sensors that use a magnet to establish whether a door is open or closed.

Magnetic door sensor on a door
Magnetic door sensor mounted on a door. Image from

Introduction to magnetic door sensors

Magnetic door sensors are commonly used in alarm systems to trigger the opening and closing of doors and windows.

It consists of two parts encased in a plastic shell — a magnet and a sensor/switch.

In combination, it basically works by opening/closing a reed switch by using the magnet’s magnetic field. When the two parts are next to each other the switch is closed and when they are far apart the switch is open.

Basics of a reed switch
Basics of a reed switch. When the two parts are close together, the reed switch is closed — allowing current to flow — and when they are far apart the reed switch is open — allowing no current to flow.

When mounted on a for example on a door or a window, the switch is open when the door or window is closed the switch is closed.

This can be used by an alarm system, or for example an Arduino microcontroller or Raspberry Pi, to monitor the activity and trigger an alarm when needed.

Sample uses & alternatives

Magnetic door sensors are mainly used for monitoring doors and windows for security purposes. It can also be used to monitor headcounts, e.g. how many times it was opened in a set period of time.

What makes magnetic door sensors so special?

These little sensors are readily available, easy to mount, easy-to-use and fairly cheap.

The current flowing through the switch can be used to signal a digital read pin on a microcontroller.


Because magnetic door sensors need to be mounted on doors and windows, choosing the correct placement and hiding the wires can sometimes be a bit tricky.


To get started with magnetic door sensors, you might need some of the following accessories.

Please support us by using these links they come at no additional cost to you, but we get a little commission each time they are used. These and others are available from and BangGood.

We have tested most of these products ourselves. Other selection criteria include affordability, quality, availability and average user rating and popularity by other buyers.

Links will open in a new window.
(Dead or old links can be reported in the comments section below.)

Featured products

Magnetic Door Sensor (5pcs. excl. screws and wires)
Magnetic Door Sensor (5pcs. excl. screws and wires)

5 pieces magnetic door sensor (excl. screws and wires).
Available from BangGood
Magnetic Door Sensor (incl. screws and wires)
Magnetic Door Sensor (incl. screws and wires)

Single magnetic door/window sensor (reed switch) with wires and mounting screws.
Available from BangGood

Related products


With their ease of use, price and availability, magnetic door sensors are fairly easy to incorporate into projects for example with Arduinos and Raspberry Pis.

They are great to be used as a trigger switch for windows and doors in home automation projects.

About the author
Renier busies himself with improving his English writing, creative web design and his websites, photoshopping, micro-electronics, multiple genres of music, superhero movies and badass series.
Behind the Scenes is a free, informative website. If you find value in any of our content, please consider making a donation to our cause, or becoming a Patron for exclusive content.
Donate via PayPal Become a Patron

Save, share & discuss

Your comment is important, but don't be a knob. Keep it constructive and polite.

Leave a Reply

Your email address will not be published. Required fields are marked *

More electronic module related posts

Relay switch modules
26 March 2016 | Updated 27 January 2018
Relay switch modules are used as high voltage AC switches by connecting a signal and DC power supply to it. These modules are made up by a relay (the ‘heart’), screw terminal connectors, a resistor, diode, capacitor, transistor and LED – making it perfect for electronic hobbyists to use in projects. More…