The MC38 wired door sensor is a magnetic reed switch sensor used to detect the opening and closing of doors or windows. It is a commonly used component in security systems, home automation, and various other applications where monitoring access or detecting intrusion is necessary. The sensor consists of two main components: a reed switch and a magnet.
How the MC-38 Wired Door Sensor Works:
- Reed Switch: The MC-38 sensor contains a reed switch, which is a type of electrical switch operated by an applied magnetic field. The reed switch is made up of two thin, flexible, and magnetizable metal reeds sealed within a glass envelope.
- Magnet: A small magnet is typically attached to the moving part of the door (like the door or window frame), while the reed switch is installed on the stationary part (like the door or window itself). When the door or window is closed, the magnet is close enough to the reed switch, creating a magnetic field that causes the reed switch to close, completing an electrical circuit.
- Open State: When the door or window is opened, the magnet moves away from the reed switch, and the magnetic field diminishes. As a result, the reed switch opens, breaking the electrical circuit. This change in the reed switch’s state is used to trigger an alarm or signal that the door or window has been opened.
Wiring the MC-38 Sensor:
To use the MC38 wired door sensor with a microcontroller, security system, or other applications, you need to wire it properly:
- Common Connection: Connect one of the reed switch’s wires to the ground (GND) or 0V of your circuit.
- Signal Connection: Connect the other wire from the reed switch to a digital input pin on your microcontroller or alarm system. When the door is opened or closed, the change in the sensor’s state is detected as a digital HIGH (door closed) or LOW (door opened) signal by your device.
- Magnet Placement: Install the magnet on the moving part (e.g., the door or window) and ensure it aligns with the reed switch when the door is closed.
- Reed Switch Placement: Securely mount the reed switch on the stationary part (e.g., the door frame) so that it aligns with the magnet when the door is closed.
***************************************************************************************************************
/* Company Name:LK Tronics
* Author: Research & Development Department
EXPERT GUIDANCE TO BRING YOUR DREAM PROJECT TO LIFE
* Date: 2020/ 01/ 03
* https://lk-tronics.com/
***********************************************
* All rights reserved. No part of this code may be reproduced, distributed,
* or transmitted in any form or by any means, including photocopying, recording,
* or other electronic or mechanical methods, without the prior written permission
* of LK Tronics, except in the case of brief quotations embodied in
* critical reviews and certain other noncommercial uses permitted by copyright law.
************************************************/
const int doorSensorPin = 13;
const int LED = 2;
int doorState;
void setup() {
pinMode(doorSensorPin, INPUT);
pinMode(LED, OUTPUT);
Serial.begin(9600);
}
void loop() {
doorState = digitalRead(doorSensorPin);
if (doorState == LOW) {
digitalWrite(LED, HIGH);
delay(500);
Serial.println("Door is open");
} else {
digitalWrite(LED, LOW);
delay(500);
Serial.println("Door is closed");
}
delay(1000);
}
***************************************************************************************************************
VISIT OUR FACEBOOK PAGE FOR MORE INFO | MORE PRODUCT IN OUR SHOP