

The Magnetic Key Card Switch is a device that utilizes a magnetic strip on a card to control the opening and closing of an electrical switch. It is widely used in access control systems, such as hotel room power management, secure entry systems, and automated locking mechanisms. The switch operates by detecting the unique magnetic pattern encoded on the card, ensuring secure and reliable operation.








| Pin Name | Description | Notes |
|---|---|---|
| VCC | Power supply input (5V to 12V DC) | Connect to the positive terminal of the power source. |
| GND | Ground | Connect to the ground of the circuit. |
| OUT | Digital output signal | Outputs HIGH when the correct card is detected. |
| LED+ | Positive terminal for status LED | Optional connection for an external LED. |
| LED- | Negative terminal for status LED | Connect to ground for LED operation. |
Power Connection:
Output Signal:
Optional LED Indicator:
Card Usage:
Below is an example of how to connect the Magnetic Key Card Switch to an Arduino UNO and read the output signal.
// Magnetic Key Card Switch Example
// This code reads the output signal from the switch and turns on an LED
// when the correct card is detected.
const int switchPin = 2; // Pin connected to the OUT pin of the switch
const int ledPin = 13; // Built-in LED on Arduino
void setup() {
pinMode(switchPin, INPUT); // Set the switch pin as input
pinMode(ledPin, OUTPUT); // Set the LED pin as output
Serial.begin(9600); // Initialize serial communication
}
void loop() {
int switchState = digitalRead(switchPin); // Read the switch state
if (switchState == HIGH) {
// If the correct card is detected, turn on the LED
digitalWrite(ledPin, HIGH);
Serial.println("Card detected!");
} else {
// If no card or incorrect card, turn off the LED
digitalWrite(ledPin, LOW);
Serial.println("No card detected.");
}
delay(100); // Small delay for stability
}
The switch does not detect the card:
Output signal is unstable:
LED does not light up:
Can I use any magnetic card with this switch? No, the switch is designed to detect specific magnetic stripe patterns. Ensure the card matches the system's configuration.
What happens if the card is swiped too quickly? The switch may fail to read the magnetic stripe. Swipe the card at a moderate and consistent speed.
Can this switch be used outdoors? The switch is not weatherproof. Use it indoors or in a protected enclosure for outdoor applications.
Is it compatible with RFID cards? No, this switch is designed for magnetic stripe cards only. Use an RFID reader for RFID cards.