Some times during designing a solution to a given problem in embedded domain its required to respond to a mechanical event. For example it is required to ring the alarm and send an sms to user when ever a particular house door is opened and closed. Do you ever wonder how when you open laptop, folding mobile, oven or fridge makes the status light to switch own? Well this is all done with a small sensor known as contact switch or reed switch.
A reed switch is same like an electrical mechanical switch the only difference is it is operated by magnetic field. In mechanical switches contacts are made by pressing the switch with finger but in reed switch contacts are made by exposing magnetic field to switch.
A reed switch is same like an electrical mechanical switch the only difference is it is operated by magnetic field. In mechanical switches contacts are made by pressing the switch with finger but in reed switch contacts are made by exposing magnetic field to switch.
Reed switch has two open leads. Leads are magnetizable and responds to external magnetic field when ever exposed to. Leads become charged and adopt the characteristics of magnet in present of magnetic field. One lead becomes north pole and the other becomes south pole. Leads attracts or repel each other when magnetic field is applied to them, depending on the configuration of the switch. Contact switch comes in two different polarities Normally open(NO) and Normally closed(NC).
|
Normally open contact switch
A normally open contact switch is one in which the leads are open (Same like open circuit) in normal state. When a magnet is brought near the switch the leads make contact and circuit is closed.
Normally closed contact switch
In normally closed configuration the leads are initially connected and circuit is closed. As soon we bring the magnet close to the switch the leads repel each other and circuit opens.
Reed/Contact switch limitations
Though reed switches consumes no power and are cheap, can work on both AC and DC loads. But there are some serious limitations fist reed switches response time is high. Contact would take few milli seconds to be made, which is a huge time for some applications. Also they have a low shelf life. Limited current can flow through contact switches. They burn out if the current exceeds 2 Amperes.
A typical reed switch is on the left side. Small box with wires exposed out contains a contact switch in it. Wires are contact leads. The other box contains a small magnet in it. Usually the box with switch is attached permanently to a surface and box with magnet is connected with the moving object. Like in door open close case. Switch is attached with the wall and magnet is attached with the door. Read switches are cheap you can get one under $2.
|
In a demo project i am going to show how the sensor can be used to check the door status. I am going to use Stm32f103c8t6 microcontroller for this the project. Stm32f103 Pin#PC13 is used to drive alarm and Pin#PA10 is used to detect the contact status of the switch. Stm32 microcontroller works on 3.3 volt. To drive a load like alarm we need much higher current. So at output i am using a relay to activate the alarm coil. Reed switch equivalent circuit is also shown in the circuit below.
Microcontroller configuration is done using stm32cubemx code configurator, code is written and compiled using keiluvision 5 ide. Each an every statement of code is explained in an another tutorial Click here
Filed Under: Microcontroller Projects, STM32
Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.