Elint Labz - Magnetic Door Sensor Plug Manual
Elint Labz - Magnetic Door Sensor Plug Manual
Product Manual
Magnetic Door
Sensor Plug
Updated on: 27th November 2017
Product Manual: Magnetic Door Sensor Plug
Index
About Elint Labz 2
Introduction 2
Specification 3
Operating voltage: 5V 3
Variants 3
Supported cables: 3
Details 4
How to interface? 5
Example Codes 8
Code 1 : Arduino 8
Contributors 9
anywhere using screws.The magnetic door sensor cable is available in different
lengths.
Specification
● Operating voltage: 5V
● Size: 15mm x 20mm
Variants
None
Supported cables:
1. 3-3 A
2. 4-3 A
Details
Magnetic Door Sensor is essentially a reed switch, encased in an ABS plastic
shell. Normally the reed is 'open' (no connection between the two wires) when
there is no magnetic field. The other half of the sensor (without wires) is a
magnet. When the magnet is less than 13mm (0.5") away, the reed switch closes.
They're often used to detect when a door or drawer is open, which is why they
have mounting tabs and screws. The user can also use double-sided foam tape
to mount these, that works well without needing screws.
Magnetic Door Sensor plug is a digital input device to the interfacing system. It
has an interfacing port with three pins named as G, V & D. Here G represents
Ground , V represents VCC and D represents Data pin through which digital
signal from the magnetic door sensor can be obtained.
When the two parts of the magnetic door sensor are close to each other, a HIGH
signal is available at the Data pin (D) and when the two parts are far away, a LOW
signal is available at the Data pin.
LOW
HIGH
How to interface?
Use either of the supported interfacing cables to connect this magnetic door
sensor plug to the controller board. If 4-3A cable is to be used then 3 pin end of
the cable is connected the magnetic door sensor and 4 pin end of the cable is
connected to controller board. If 3-3A cable is to be used then any end of the
cable can be connected to the magnetic door sensor plug. Always ensure that
black wire of the cable is connected to the G pin on both sides.
In the below given pictures you can that see 4-3A cable is used to connect
Magnetic Door Sensor plug to the Pluguino Board. The data pin of the magnetic
door sensor plug is connected to the 12th GPIO pin on the controller board. By
monitoring the voltage at the 12th GPIO pin of the controller you can decide
whether the magnetic door sensor is closed or not. Here in this example code
LED turns on when the door is opened and it turns off when the door is closed.
In order to demonstrate the working of magnetic door sensor plug we have
associated LED plug with the magnetic sensor input signal. Here in this example
code LED turns on when the door sensor parts move apart (door opened) and
LED turns off when the magnetic door sensor parts are close to each other (door
closed).
Example Codes
Code 1 : Arduino
void setup()
{
pinMode(Led_pin , OUTPUT); // initialize the LED pin as an output
pin
pinMode(Door_pin , INPUT); // initialize door sensor pin as an input
pin
void loop()
{
Door_state = digitalRead(Door_pin); // read the state of the door
sensor and store it
if(Door_state == HIGH) // check whether door is
closed
{
digitalWrite(Led_pin,LOW); //turn the LED OFF when door
is closed
}
else
{
digitalWrite(Led_pin,HIGH); // if door is open then turn
ON the LED
}
}
Contributors
List of interns & other contributors who have worked for developing this manual
Leela O V
http://www.elintlabz.in/profile-1807