Wiring Reed Switch Module with Arduino Uno

Introduction

In this tutorial, we learn how to Wiring Reed Switch Module with Arduino Uno, The Reed Switch Module is a versatile component that can be used for various applications, including proximity sensing, magnetic field detection, and switching mechanisms. In this tutorial, we will guide you through the process of wiring the Reed Switch Module with an Arduino Uno board. By connecting the Reed Switch Module correctly, we can detect the presence or absence of a magnetic field and trigger corresponding actions in our Arduino projects.

Hardware Required

You will require the following Hardware Components for Wiring Reed Switch Module with Arduino Uno.

Components#Buy From Amazon
Arduino UNO1Buy Now
Reed Switch Module1Buy Now
5mm Led1Buy Now
Resistor 220Ω for Led1Buy Now
Jumper Wires4Buy Now
Breadboard1Buy Now

What is the KY-025 Reed Switch Module?

KY-025 Reed Switch Module is a type of magnetic sensor that is used to detect the presence of a magnetic field. It is composed of a small reed switch and a resistor, which are housed in a small module. When a magnetic field is present, the reed switch will be activated, and the resistance of the module will change accordingly. This change in resistance can be measured and used to trigger other electronic components.

KY-025-Reed-Switch-module-with-Arduino

Specifications

The module is composed of several components including a 49E Linear Hall-Effect Sensor, an LM393 Dual Differential Comparator, a Potentiometer, 2 LEDs, 6 resistors, and 4 male header pins.

Operating Voltage2.7V to 6.5V
Current Consumption10mA
Maximum Contact Rating10W
Maximum Switching Voltage100V DC
Maximum Switching Current0.5A
Sensitivity1.0 mV/G min., 1.4 mV/G typ., 1.75 mV/G max.
Board Dimensions1.5cm x 3.6cm [0.6in x 1.4in]

Features

  1. High sensitivity to magnetic fields
  2. Compact and easy to use
  3. Long service life
  4. Low power consumption
  5. Easy to integrate with other electronic components

Pinout

KY-025-Reed-Switch-module-Pinout

Pin Configuration

Pin NamePin Type
+VPositive supply Pin
GGround Pin
A0Analog Pin
D0Digital Pin

Circuit Diagram

The following circuit shows you the connection of the Wiring Reed Switch Module with Arduino Uno Please make the connection carefully

KY-025-Reed-Switch-module-Interfacing-with-Arduino-circuit

Installing Arduino IDE Software

First, you will require to Download the updated version of Arduino IDE Software and Install it on your PC or laptop. if you Learn How to install the Arduino step-by-step guide then click on how to install Arduino Button given Blow

Code

This Code for Digital Pin, Connect the Digital-0 pin of the module to the D2 pin of the Arduino, and the Analog Pin of the Module is not used here

//For more Projects: www.arduinocircuit.com

int MyLedOutput = 13 ; // Define  as Output  Interface (Optional)
int MySensor = 2; // Define as the REED sensor digital pin 2 on microcontroller
int Value ; // Define as numeric value to hold the sensor input 
void setup ()
{
  pinMode (MyLedOutput, OUTPUT) ; // Define as digital output (LED which is connected to pin 12)
  pinMode (MySensor, INPUT) ; // Define as digital input
}
void loop ()
SunFounder{
  Value = digitalRead (MySensor) ; // Reads the state value of digital input in pin 2
  if (Value == HIGH) // If sensor reads pin 2 is HIGH then turn the LED pin 12 ON
  {
    digitalWrite (MyLedOutput, HIGH);
  }
  else
  {
    digitalWrite (MyLedOutput, LOW); // Otherwise turn off or LOW
  }
}

Code 2

This Code for Analog Pin, Connect the Analog-0 pin of the module to the A0 pin of the Arduino, and the Digital Pin of the Module is not used here

//For more Projects: www.arduinocircuit.com

int AnalogSensorPin = A0; // Define as Analog Input Signal from the Sensor
int LedOutIndicator = 13; // Define as Output indicator (Optional)
int Value = 0; // variable to store the value from the sensor
void setup () {
  pinMode (LedOutIndicator, OUTPUT);
  Serial.begin (9600); // Start Serial Communication
}
void loop () {
  Value = analogRead (AnalogSensorPin);
  digitalWrite (LedOutIndicator, HIGH);
  delay (Value);
  digitalWrite (LedOutIndicator, LOW);
  delay (Value);
  Serial.print("SENSOR PIN A0:")
  Serial.println (Value, DEC);
}

Applications

  1. Proximity Sensing: The module can be used to detect the presence of a magnetic field and trigger actions based on proximity.
  2. Security Systems: Reed switches are commonly used in security systems to detect unauthorized opening or closing of doors and windows.
  3. Automation: By integrating the Reed Switch Module into an automation project, you can detect the position of moving objects or control devices based on magnetic field detection.
  4. Robotics: Reed switches can be used as limit switches in robotics projects to determine the position of robot arms or other moving parts.
  5. Energy Conservation: Reed switches can be employed in energy-saving applications, such as turning off lights or devices when a door or window is closed.

Conclusion

By wiring the Reed Switch Module with an Arduino Uno, you can easily incorporate magnetic field detection into your projects. In this tutorial, we discussed the required components, explained the circuit connections, and provided an overview of the working principle. Now you can experiment with the Reed Switch Module and develop applications that leverage its magnetic field sensing capabilities. Enjoy exploring the possibilities of proximity sensing and magnetic detection with Arduino and the Reed Switch Module!

Leave a Comment


error: