Discussion in "PIC Microcontroller Discussion" started by    ixole    Dec 2, 2009.
Wed Dec 02 2009, 01:42 pm
#1
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
Thu Dec 03 2009, 12:52 am
#2
Reed switch is a potential free input, connect one wire to ground and other to PIC's Port pin. connect a pullup at port pin. when door is closed you get low and when door is open you get high.

[Topic moved to PIC Microcontroller Discussion forum]
 ixole like this.
Thu Dec 03 2009, 10:00 am
#3
Thanks for the reply mr.Ajay. What is the different between normally close or normally open reed switch? the circuit should be something like below?either high or low for my input..and i can trigger buzzer after getting either 1 input, correct?By the way, how to interface LDR with PIC?


[ Edited Fri Dec 04 2009, 12:55 am ]
Sat Dec 05 2009, 04:45 pm
#4
normal open or normal close defines the state of switch not the logic. so logic can be either low or high depending upon construction.

In the diagram shown above, switch is normally open and you will get high on pin in ideal state. when you press the switch, state will be closed and you get low on pin.

For LDR take a look at this
http://www.8051projects.net/forum-t14237-post.html

you can drive a transistor which can switch o/p to either high or low depending upon state of LDR, threshold can be adjusted by changing resistances. or you can connect it to ADC and then to controller.
Mon Nov 26 2012, 06:58 am
#5
hello guys.
i have the same project, and i want to connect contact magnetic to pic18f2520
Can you help with the code please because i am novice with c18 compiler.
thank you
Mon Dec 03 2012, 01:14 am
#6
@kle0ps, Post a new thread for yourself.

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

Gordonfax
Fri May 17 2024, 10:28 am
Davidspils
Fri May 17 2024, 10:19 am
Patricknoind
Fri May 17 2024, 09:53 am
JeremyCycle
Fri May 17 2024, 09:46 am
FrabSeby
Thu May 16 2024, 07:31 pm
PeterGem
Thu May 16 2024, 06:27 am
Timothywalay
Thu May 16 2024, 04:40 am
Timothypet
Wed May 15 2024, 06:14 pm