Zbotic Logo Zbotic Logo
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

  • Shop
  • About Us
  • Contact Us
  • Reseller
  • Blogs
020 69134444
1800 209 0998
[email protected]
Help Desk
Facebook Twitter Instagram Linkedin YouTube
Zbotic Logo Zbotic Logo
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

All departments
  • 3D Print Service
  • 3D Printer
  • Batteries & Chargers
  • Development Boards
  • Drone Parts
  • EBike parts
  • Sensor Modules
  • Electronic Components
  • Electronic Modules
  • IoT and Wireless
  • Mechanical Parts and Workbench Tools
  • Motors & Drivers & Pumps & Actuators
  • DIY and Robot Kits
  • Show more
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
Return to previous page
Home Security & Surveillance

Magnetic Door Sensor: Window and Door Alert with Arduino

Magnetic Door Sensor: Window and Door Alert with Arduino

March 11, 2026 /Posted byJayesh Jain / 0

Table of Contents

  • Reed Switch Basics
  • Hardware
  • Arduino Code
  • Multi-Door System
  • Integration with Alarm
  • FAQ

Reed Switch Basics

A magnetic door sensor for window and door alert with Arduino uses a reed switch – a pair of metallic reeds that close when a magnet is nearby and open when the magnet moves away. The sensor has two parts: a magnet (attached to the moving door or window) and the reed switch housing (attached to the fixed door frame). When the door opens, the magnet moves away, the reed opens, and the Arduino detects the change.

Reed switch door sensors are available in India for Rs 30-80 each (surface mount) or Rs 80-150 (recessed, flush-mount type for wood doors). They require no power to operate – the Arduino only reads the switch state.

Recommended: 37-in-1 Sensor Kit for Arduino – 37-in-1 sensor kit includes a magnetic reed switch module ready for door/window alarm integration with Arduino.
Recommended: MH-SR602 Mini Motion Sensor – Combine magnetic door sensors with PIR sensors for comprehensive zone protection – PIR covers movement, reed covers entry.

Hardware

  • Arduino Nano (controls entire system)
  • Reed switch door sensors x 4 (one per entry point: front door, back door, 2 windows)
  • 5V relay module (for siren)
  • Buzzer (local alert)
  • SIM800L GSM module (SMS alerts)
  • I2C LCD 16×2 (status display)
  • Arming button + LED

Wiring reed sensors: NC (Normally Closed) configuration – connect one wire to Arduino input pin with INPUT_PULLUP, other wire to GND. Door closed = LOW signal (magnet holds reed closed). Door opens = HIGH signal (magnet removed, pull-up pulls pin HIGH). This way, a cut wire also triggers the alarm (intrusion-proof).

Arduino Code

#define DOOR_FRONT   2
#define DOOR_BACK    3
#define WINDOW_1     4
#define WINDOW_2     5
#define RELAY_PIN    8
#define ARM_LED      9
#define ARM_BTN      10

const char* ZONE_NAMES[] = {
  "Front Door", "Back Door", "Window 1", "Window 2"
};
int ZONE_PINS[] = {DOOR_FRONT, DOOR_BACK, WINDOW_1, WINDOW_2};

bool armed = false;
bool entryDelay = false;
unsigned long entryTimer = 0;

void setup() {
  Serial.begin(9600);
  for(int i=0; i<4; i++) pinMode(ZONE_PINS[i], INPUT_PULLUP);
  pinMode(RELAY_PIN, OUTPUT); digitalWrite(RELAY_PIN, HIGH);
  pinMode(ARM_LED, OUTPUT);
  pinMode(ARM_BTN, INPUT_PULLUP);
}

void triggerAlarm(int zone) {
  Serial.print("ALARM: "); Serial.println(ZONE_NAMES[zone]);
  digitalWrite(RELAY_PIN, LOW); // Siren on
  // Add SMS sending here
}

void loop() {
  // Arm/disarm toggle
  if(!digitalRead(ARM_BTN)) {
    armed = !armed;
    digitalWrite(RELAY_PIN, HIGH); // Reset siren
    digitalWrite(ARM_LED, armed ? HIGH : LOW);
    Serial.println(armed ? "ARMED" : "DISARMED");
    delay(500);
  }

  if(!armed) return;

  // Check all zones
  for(int i=0; i<4; i++) {
    if(digitalRead(ZONE_PINS[i]) == HIGH) { // Door/window OPEN
      if(i == 0 && !entryDelay) { // Front door: 30-sec entry delay
        entryDelay = true;
        entryTimer = millis();
        // Play warning beep
      } else if(i != 0 || 
               (entryDelay && millis()-entryTimer > 30000)) {
        triggerAlarm(i);
      }
    }
  }
  if(entryDelay && armed) { // Disarmed during entry delay
    // Would have been disarmed if armed became false
    entryDelay = false;
  }
  delay(100);
}

Multi-Door System Design

For a complete Indian home (3BHK typical):

Zone Sensor Type Entry Delay 24-Hour Zone
Main entrance door Reed + PIR inside 30 seconds No
Back door / service entrance Reed switch None (instant) No
Bedroom windows (ground floor) Reed switch None Yes (always active)
Kitchen window Reed switch None No
AC unit openings Reed switch None Yes

24-hour zones remain active even when the alarm is disarmed – protecting sleeping family members from ground-floor window entry without requiring everyone to re-arm the system after moving around at night.

Integration with Alarm Panel

Reed sensors integrate with any alarm panel supporting NC (Normally Closed) zone inputs. Commercial alarm panels from CP Plus, Honeywell, and DSC (all available in India) accept reed sensor wiring directly. For DIY Arduino panels, each reed switch connects to one digital input pin. An Arduino Mega handles 16+ zones with one input per zone.

Recommended: Tiny RTC DS1307 I2C Module – RTC module to timestamp all door opening events – create an entry log showing when each door was opened during the day.

Frequently Asked Questions

Can I use surface mount or recessed sensors for Indian wooden doors?

Surface mount (Rs 30-80) are easiest to install – no drilling required, just stick/screw to door surface. Recessed sensors (Rs 80-150) install inside a routed channel in the door edge and frame for a clean look. Indian solid wood and hollow-core flush doors both accept recessed sensors. Sliding doors and aluminium-frame windows need surface mount sensors with extended mounting brackets.

How do I prevent false alarms from vibration?

Implement a debounce period: alarm only triggers if the door remains open for 500ms or more. This eliminates false triggers from slamming doors and vibration from passing trucks (common near Indian roads). Also ensure the magnet and reed housing are within 5-10mm gap when door is closed – excessive gap causes reed to barely hold and minor vibrations open it.

What about steel doors and windows?

Reed switches work through any non-magnetic material. Indian steel doors and aluminium windows are not magnetic, so the reed switch works normally. The magnet is attached to the moving part; the reed is in the fixed frame. Keep the gap between magnet and reed less than 10mm for reliable operation.

Can reed sensors work with a metal door frame?

Yes – the reed switch housing is plastic and the sensor operates through the air gap, not the frame. Metal frames do not interfere with the reed’s magnetic operation. However, nearby strong magnets (like those on refrigerator doors or security tags) within 15cm can occasionally trigger the reed switch.

How do I connect the alarm to my existing bell or chime?

Connect the siren output relay in parallel with your existing doorbell bell transformer secondary output. When the alarm triggers the relay, it completes the bell circuit causing your existing doorbell bell to ring continuously. This avoids purchasing a separate alarm siren and uses hardware already installed in Indian homes.

Shop Security & Surveillance at Zbotic

Tags: door sensor India, home security Arduino, magnetic door sensor, reed switch Arduino, window security alert
Share Post
  • Facebook
  • Linkedin
  • Whatsapp
Lattice ICE40 FPGA Board: Firs...
blog lattice ice40 fpga board first project with verilog india 599056
blog impedance controlled pcb when and how to specify it 599059
Impedance Controlled PCB: When...

Related posts

Svg%3E
Read more

Trail Camera: Wildlife and Property Monitoring India

April 1, 2026 0
Table of Contents Trail Cameras for Indian Wildlife PIR-Triggered Camera Design ESP32-CAM Configuration for Trail Use Night Vision with IR... Continue reading
Svg%3E
Read more

Solar Powered Security Camera: Off-Grid Surveillance

April 1, 2026 0
Table of Contents Off-Grid Surveillance Needs in India Solar Panel and Battery Sizing Power Management Circuit ESP32-CAM Low Power Optimisation... Continue reading
Svg%3E
Read more

Remote Viewing Setup: Access Cameras from Anywhere

April 1, 2026 0
Table of Contents Remote Viewing Options P2P Cloud vs Port Forwarding Dynamic DNS Setup VPN for Secure Access Mobile App... Continue reading
Svg%3E
Read more

Motion Detection Zones: Reduce False Alarms

April 1, 2026 0
Table of Contents The False Alarm Problem How Motion Detection Works in Cameras Setting Detection Zones Sensitivity Adjustment Object Size... Continue reading
Svg%3E
Read more

Security Camera Placement: Best Positions for Coverage

April 1, 2026 0
Table of Contents Camera Placement Principles Height and Angle Guidelines Coverage Overlap Strategy Indian Home Layouts Commercial Property Placement Avoiding... Continue reading

Add comment Cancel reply

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

Facebook Twitter Instagram Pinterest Linkedin Youtube

Get the latest deals and more.

Download on Google Play Download on the App Store

Call us: 020 69134444 / 1800 209 0998

Monday - Saturday 09:30 AM - 06:00 PM
For Technical Supports Email: [email protected]
For Sales / Enquiries Email: [email protected]

  • My Account

    • Cart

    • Wishlist

    • Checkout

    • My Orders

    • Track Order

    • My Account

  • Information

    • FAQs

    • Blogs

    • Career

    • About Us

    • Contact Us

    • Payment Options

  • Policies

    • Privacy Policy

    • Terms & Conditions

    • GST Input Tax Credit

    • Shipping Return Policy

    • E-Waste Collection Points

    • Our Sitemap

© Zbotic.in is registered trademark of Moxie Supply Pvt Ltd – All Rights Reserved
Login
Use Phone Number
Use Email Address
Not a member yet? Register Now
Reset Password
Use Phone Number
Use Email Address
Register
Already a member? Login Now