KY-025 Reed Switch Module – Adjustable Magnetic Sensor for Arduino & ESP32
The KY-025 Reed Switch Module is a compact magnetic detection module designed to sense the presence of a nearby magnet without physical contact.
Featuring a magnetic reed switch and an LM393 comparator circuit, the module provides both digital and analog output connections. The digital output allows a microcontroller to detect changes in the reed switch state, while the onboard potentiometer provides adjustable switching behavior.
The KY-025 is ideal for Arduino, ESP32, Raspberry Pi, robotics, magnetic position detection, door and window sensors, security systems, and DIY electronics projects.
Key Features
-
Model: KY-025
-
Sensor Type: Magnetic Reed Switch
-
Detection Method: Magnetic Proximity
-
Switch Type: Normally Open (Typical)
-
Comparator IC: LM393 or Equivalent
-
Operating Voltage: Typically 3.3V–5V DC (Module Dependent)
-
Digital Output: HIGH / LOW
-
Analog Output Connection: Available on Common KY-025 Versions
- Adjustable Comparator Threshold
- Onboard Potentiometer
- Status Indicator LED (Typical)
-
4-Pin Interface: AO, DO, VCC, GND
- Compact PCB Design
Technical Specifications
| Parameter |
Specification |
| Model |
KY-025 |
| Product Type |
Magnetic Reed Switch Sensor Module |
| Sensor Technology |
Mechanical Magnetic Reed Switch |
| Detection Type |
Magnetic Proximity |
| Switch Configuration |
Normally Open (Typical) |
| Comparator |
LM393 or Compatible |
| Operating Voltage |
Typically 3.3V–5V DC |
| Digital Output |
HIGH / LOW |
| Analog Output |
Switch-Dependent Voltage Signal |
| Digital Threshold |
Adjustable on Common Versions |
| Number of Pins |
4 |
| Pin Configuration |
AO / DO / + / - |
| Detection Distance |
Depends on Magnet Strength and Orientation |
| Board Dimensions |
Approximately 35 × 15mm (Variant Dependent) |
| Interface |
Digital GPIO / Analog ADC |
Pin Configuration
| Pin |
Function |
| AO |
Analog Output Connection |
| DO |
Digital Comparator Output |
| + |
Power Supply (VCC) |
| - |
Ground (GND) |
How It Works
The KY-025 contains a reed switch with two metal contacts enclosed inside a sealed glass capsule.
When a suitable magnet approaches the sensor, the magnetic field causes the contacts to close. When the magnet moves away, the contacts return to their original state.
Digital Output (DO)
The comparator circuit produces a digital signal indicating the detected switch condition. The output changes between HIGH and LOW depending on the reed switch state and the module's circuit configuration.
Analog Output (AO)
Some KY-025 versions expose a voltage signal related to the reed switch circuit.
Unlike a linear Hall effect sensor, the reed switch does not provide a continuous measurement of magnetic field strength. Its output primarily represents an open or closed contact condition.
Arduino Connection Example
| KY-025 |
Arduino Uno |
| DO |
D2 |
| AO |
A0 (Optional) |
| + |
5V |
| - |
GND |
The Arduino can monitor the digital output to detect the presence or absence of a nearby magnet.
Arduino Example Code
const int reedPin = 2;
void setup() {
pinMode(reedPin, INPUT);
Serial.begin(9600);
}
void loop() {
int reedState = digitalRead(reedPin);
Serial.print("Reed Switch Output: ");
Serial.println(reedState);
delay(100);
}
This example displays the module's digital output in the Arduino Serial Monitor.
The relationship between HIGH/LOW and magnet detected/not detected depends on the module's circuit configuration.
Applications
- Door and Window Security Sensors
- Magnetic Proximity Detection
- Arduino and ESP32 Projects
- Raspberry Pi GPIO Projects
- Robotics and Automation
- Magnetic Position Detection
- Smart Home Systems
- Alarm and Security Systems
- Object Counting with Magnets
- Equipment Position Monitoring
- Educational STEM Projects
- DIY Electronics and Prototyping
Important Notes
-
The KY-025 uses a mechanical magnetic reed switch, not a Hall effect sensor.
- The reed switch typically closes when a suitable magnet approaches.
- Detection distance depends on magnet strength, positioning, and orientation.
- The module does not measure magnetic field strength.
- The analog output, where provided, should not be interpreted as a calibrated magnetic field measurement.
- Mechanical contact bounce may occur when the reed switch opens or closes. Software debouncing is recommended for reliable detection.
- The glass reed switch capsule is fragile and should be handled carefully.
- The potentiometer and comparator behavior may vary depending on the supplied board version.
-
For ESP32 and Raspberry Pi, ensure that output signals do not exceed 3.3V.
- Verify the module's pin configuration and operating voltage before wiring.
- The KY-025 is designed for low-voltage sensing and should not be used to switch high-power loads directly.
Package Includes
1 × KY-025 Reed Switch Module