Arduino Reed Switch
Reed switch is radically an electrical switch which is determined when a magnetic field is conducted near to it.
Supplies
Hardware Components
Arduino Uno
Reed Switch
Resistors
LED
Magnet
Connecting wires
Software
Arduino IDE
About the Project
Reed Switch
Reed switch is primarily an electrical switch that is managed when a magnetic field is conducted near to it. It is made up of two small metal pieces managed inside a glass tube under a vacuum. The switch will be initiated when there is a presence of the magnetic field around the switch.
There are two types of the reed switch:
Normally open reed switch Normally open reed switch normally closed reed switch Normally closed reed switched a normally open reed switch, the switch is open in the absence of a magnetic field and it is closed in the presence of the magnetic field.
In a normally closed reed switch, the switch is closed in the absence of a magnetic field and it is open in the presence of the magnetic field.
Applications of Reed switch
1. Utilized in the telephone exchange
2. In laptops to set the screen on sleep if the lid is closed
3. Utilized in window and door sensors in the burglar alarm system.
Working of Reed Switch Using Arduino
To interface reed switch with Arduino, we require to develop a voltage divider circuit. Vo is +5V when the switch is open and 0V when the switch is closed. We are using a usually open reed switch in this project.
The switch is closed in the presence of a magnetic field and it is open in the lack of a magnetic field.
Reed Switch Interfacing With Arduino
Learn more about IoT Devices with the help of IoT Training Online.
Run a Program
int LED = 7;
int reed_switch = 4;
int reed_status;
void setup()
{
pinMode(LED, OUTPUT);
pinMode(reed_switch, INPUT);
}
void loop()
{
reed_status = digitalRead(reed_switch);
if (reed_status == 1)
digitalWrite(LED, LOW);
else
digitalWrite(LED, HIGH);
delay(1000);
}