The KY-025 Modulo Reed Switch, manufactured by Arduino (Part ID: HH), is a versatile sensor module designed to detect magnetic fields. It operates using a reed switch, a small mechanical switch that closes its contacts when exposed to a magnetic field. This module is widely used in applications such as door and window sensors, security systems, and other projects requiring magnetic field detection. Its simplicity and reliability make it a popular choice for hobbyists and professionals alike.
The KY-025 Modulo Reed Switch has the following technical specifications:
The KY-025 module has three pins, as described in the table below:
Pin | Name | Description |
---|---|---|
1 | Signal (S) | Outputs the signal. Can be connected to a digital or analog input on a microcontroller. |
2 | VCC | Power supply pin. Connect to 3.3V or 5V. |
3 | GND | Ground pin. Connect to the ground of the circuit. |
Wiring the Module:
Magnetic Field Detection:
Example Circuit:
Below is an example code snippet to use the KY-025 Modulo Reed Switch with an Arduino UNO:
// KY-025 Reed Switch Example Code
// Connect the Signal pin to digital pin 2 on the Arduino UNO
// Connect VCC to 5V and GND to GND
const int reedSwitchPin = 2; // Pin connected to the KY-025 Signal pin
const int ledPin = 13; // Built-in LED pin for visual indication
void setup() {
pinMode(reedSwitchPin, INPUT); // Set reed switch pin as input
pinMode(ledPin, OUTPUT); // Set LED pin as output
Serial.begin(9600); // Initialize serial communication
}
void loop() {
int reedState = digitalRead(reedSwitchPin); // Read the state of the reed switch
if (reedState == HIGH) {
// If magnetic field is detected, turn on the LED
digitalWrite(ledPin, HIGH);
Serial.println("Magnetic field detected!");
} else {
// If no magnetic field is detected, turn off the LED
digitalWrite(ledPin, LOW);
Serial.println("No magnetic field detected.");
}
delay(500); // Wait for 500ms before reading again
}
The module does not detect the magnet:
False triggering or unstable output:
No output signal:
Q: Can the KY-025 module detect the polarity of a magnet?
A: No, the KY-025 module cannot detect the polarity of a magnet. It only detects the presence of a magnetic field.
Q: Can I use the KY-025 module with a 3.3V microcontroller?
A: Yes, the KY-025 module is compatible with both 3.3V and 5V microcontrollers.
Q: What type of magnet should I use with the KY-025 module?
A: Any small neodymium or ferrite magnet should work, as long as it is within the detection range of the reed switch.
Q: Is the KY-025 module suitable for outdoor use?
A: The module is not weatherproof. If used outdoors, it should be enclosed in a protective casing to prevent damage from moisture or dust.