

A Reed switch is an electromagnetic switch that opens and closes in response to a magnetic field. It consists of two ferromagnetic contacts sealed within a glass tube, which close when exposed to a magnetic field and open when the field is removed. Reed switches are widely used in applications requiring non-contact switching, such as proximity sensors, security systems, and automotive electronics. Their simplicity, reliability, and low power consumption make them ideal for a variety of use cases.








Below are the key technical details of a typical Reed switch. Note that specifications may vary depending on the manufacturer and model.
Reed switches typically have two leads (pins) that serve as the switch terminals. These leads are not polarized, meaning the switch can be connected in either orientation.
| Pin Number | Description |
|---|---|
| 1 | Switch Terminal 1 |
| 2 | Switch Terminal 2 |
Below is an example of how to use a Reed switch with an Arduino UNO to detect the presence of a magnetic field.
// Reed Switch Example with Arduino UNO
// This code reads the state of a Reed switch and turns on an LED when the switch
// is closed (magnet present).
const int reedSwitchPin = 2; // Pin connected to the Reed switch
const int ledPin = 13; // Pin connected to the onboard LED
void setup() {
pinMode(reedSwitchPin, INPUT_PULLUP); // Set Reed switch pin as input with pull-up
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 == LOW) { // LOW means the switch is closed (magnet present)
digitalWrite(ledPin, HIGH); // Turn on the LED
Serial.println("Magnet detected!");
} else {
digitalWrite(ledPin, LOW); // Turn off the LED
Serial.println("No magnet detected.");
}
delay(100); // Small delay for stability
}
Q: Can I use a Reed switch to detect non-magnetic objects?
A: No, Reed switches only respond to magnetic fields. For non-magnetic object detection, consider using other sensors like infrared or ultrasonic sensors.
Q: How far can the magnet be from the Reed switch?
A: The activation distance depends on the magnet's strength and the sensitivity of the Reed switch. Typical distances range from a few millimeters to several centimeters.
Q: Can a Reed switch handle AC signals?
A: Yes, Reed switches can handle both AC and DC signals, but ensure the voltage and current ratings are not exceeded.
Q: How do I protect the Reed switch from high currents?
A: Use a current-limiting resistor or a relay to handle higher currents indirectly.
By following these guidelines and best practices, you can effectively integrate a Reed switch into your projects for reliable and efficient operation.