Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

magnetic contact switch

Status
Not open for further replies.

techies

New Member
hi, currently i m doing a home security project..i have a magnetic contact switch..but i dont know how to connect it to PIC..
Magnetic contact is usually Normally Close(NC) and used on door and window. They consists of
two parts, namely a magnet and a reed switch. When the reed switch is in close
proximity to the magnet, the switch will close and vice versa. Usually the magnet is
fitted to the door and the reed switch is fitted to the door frame in close proximity to
one another such that when the door is closed, the two parts are in close contact and
hence the switch is closed.
so there are wires at the reed switch..how should i connect it to PIC port to make it as a magnetic door sensor? when door open then alarm will be triggered.

thanks:)
 
Connect one end of the switch to VCC connect the other end to a PIC pin and to a resistor to ground, 1-10k depending on your power limits (1k if wasting power isn't a problem 10k if it is) While the switch is closed (the magnet is close) the pic pin that has the resistor to ground will read VCC and you'll get a little bit of current through the resistor, when the magnet moves away the resistor will ground the PIC pin, and it will read 0 volts.

You can do the the reverse as well if you want; Connect the previously VCC side to ground and connect the other side with the resistor to VCC (and the pic pin) and the logic will reverse itself.

How you could state how such a switch operates without being able to understand how to connect it to a micro controller makes me slightly question the chances of the project succeeding.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top