

The Keyestudio Reed Switch Sensor Magnetron (Part ID: KS0038) is a magnetic proximity sensor that detects the presence of a magnetic field. It operates using a reed switch, which is a small, sealed glass tube containing two ferrous metal contacts. When exposed to a magnetic field, the contacts close, completing an electrical circuit. This sensor is widely used in applications requiring non-contact magnetic detection.








The Keyestudio Reed Switch Sensor Magnetron is designed for ease of use and compatibility with microcontrollers like Arduino. Below are its key technical details:
| Parameter | Value |
|---|---|
| Operating Voltage | 3.3V to 5V |
| Output Type | Digital (High/Low) |
| Sensor Type | Normally Open (NO) Reed Switch |
| Dimensions | 30mm x 20mm x 10mm |
| Mounting Hole Diameter | 3mm |
| Operating Temperature | -40°C to 85°C |
| Pin Name | Pin Number | Description |
|---|---|---|
| Signal | 1 | Outputs HIGH or LOW based on the presence of a magnetic field. |
| VCC | 2 | Power supply input (3.3V to 5V). |
| GND | 3 | Ground connection. |
Wiring the Sensor:
VCC pin to the 5V pin of your microcontroller (e.g., Arduino UNO).GND pin to the GND pin of your microcontroller.Signal pin to a digital input pin on your microcontroller (e.g., D2 on Arduino UNO).Circuit Example:
Signal pin will output a HIGH signal.Sample Arduino Code: Below is an example of how to use the Keyestudio Reed Switch Sensor Magnetron with an Arduino UNO:
// Define the pin connected to the reed switch signal
const int reedSwitchPin = 2; // Digital pin 2
const int ledPin = 13; // Built-in LED pin for output
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 sensorState = digitalRead(reedSwitchPin); // Read the reed switch state
if (sensorState == HIGH) {
// If the reed switch is closed (magnet detected)
digitalWrite(ledPin, HIGH); // Turn on the LED
Serial.println("Magnet detected!");
} else {
// If the reed switch is open (no magnet detected)
digitalWrite(ledPin, LOW); // Turn off the LED
Serial.println("No magnet detected.");
}
delay(500); // Wait for 500ms before reading again
}
Sensor Not Detecting Magnet:
Signal pin is connected to the correct digital input pin.False Triggering:
Signal pin to stabilize the output.No Output Signal:
Q: Can this sensor detect any type of magnet?
A: Yes, the sensor can detect most permanent magnets, but the detection range depends on the magnet's strength.
Q: Is the sensor waterproof?
A: No, the sensor is not waterproof. Avoid exposing it to moisture or water.
Q: Can I use this sensor with a Raspberry Pi?
A: Yes, the sensor can be used with a Raspberry Pi. Connect the Signal pin to a GPIO pin and use a pull-down resistor if necessary.
Q: What is the maximum detection range?
A: The detection range depends on the strength of the magnet. Typically, it ranges from a few millimeters to a few centimeters.
By following this documentation, you can effectively integrate the Keyestudio Reed Switch Sensor Magnetron into your projects for reliable magnetic field detection.