Components / Sensors / Door reed switch MC-38

Door reed switch MC-38

Magnetic door and window contact. Closes when the magnet is near.

MeasuresDoor open or closed (magnet near or away)
RangeCloses with the magnet within about 15 to 25 mm
AccuracyOn/off
InterfaceDry contact: wire like a button with INPUT_PULLUP
SensorsReviewedMPN MC-38Used in 27 projects
In short

What is the Door reed switch MC-38 and what is it used for?

Magnetic door and window contact. Closes when the magnet is near. Makers use it for door-open notifier.

Most MC-38 switches are normally open: closed only when the magnet is present.
In the real world

Door and window alarms

How it works

A reed switch has two thin contacts in a glass tube that a magnet pulls together.

Key specifications

Sensor specValue
MeasuresDoor open or closed (magnet near or away)
RangeCloses with the magnet within about 15 to 25 mm
AccuracyOn/off
InterfaceDry contact: wire like a button with INPUT_PULLUP
Supply voltageNone needed (passive switch)
Operating temperature−10 to 50 °C typical

Pinout

Wire 1To the GPIO pin (INPUT_PULLUP)
Wire 2To GND

How to use it

Screw the switch to the frame and the magnet to the door, gaps aligned. With INPUT_PULLUP the pin reads LOW when closed (door shut).

void setup() { Serial.begin(115200); pinMode(27, INPUT_PULLUP); }
void loop() { Serial.println(digitalRead(27) == LOW ? "closed" : "OPEN"); delay(300); }

Applications

Alternatives

Buy at

Common questions

What is the Door reed switch MC-38 used for?

In products: door and window alarms. In maker projects: door-open notifier.

How does the Door reed switch MC-38 work?

A reed switch has two thin contacts in a glass tube that a magnet pulls together.

What voltage does the Door reed switch MC-38 need?

None needed (passive switch).

How do I connect the Door reed switch MC-38 to an Arduino or ESP32?

Dry contact: wire like a button with INPUT_PULLUP. Pins: Wire 1 (To the GPIO pin (INPUT_PULLUP)), Wire 2 (To GND).

What can I use instead of the Door reed switch MC-38?

Hall Effect Sensor A3144.