Description
The KY-021 Magnetic Reed Switch Module is a compact sensor designed to detect the presence of a magnetic field. It uses a Y213-style magnetic reed switch, making it ideal for detecting when a door, window, lid or other moving object is opened or closed.
When a magnet is brought close to the reed switch, the internal contacts change state, providing a simple digital signal that can be detected by an Arduino, Raspberry Pi, ESP32 or other microcontroller.
The KY-021 is easy to use and particularly useful for security alarms, door and window sensors, position detection, counters and DIY automation projects.
- Module: KY-021
- Sensor Type: Magnetic Reed Switch
- Reed Switch: Y213
- Function: Detects the presence of a magnetic field
- Output Type: Digital
- Operating Voltage: 3.3V – 5V
- Interface: 3-Pin – VCC, GND, Digital Output (DO)
- Switch Type: Magnetic reed switch
- Module Size: Approx. 19mm x 15mm
Key Features:
- KY-021 magnetic reed switch sensor module
- Y213 magnetic reed switch
- Detects nearby magnets and magnetic fields
- Simple digital HIGH/LOW output
- 3.3V – 5V compatible
- 3-pin VCC, GND and DO interface
- Compact and lightweight design
- Easy to connect to Arduino, Raspberry Pi, ESP32 and other microcontrollers
- Ideal for door, window and position detection
- Useful for security, automation and DIY electronics projects
What’s Included:
- 1x KY-021 Magnetic Reed Switch Module
Great For:
- Door & Window Open/Close Detection
- Magnetic Security Alarms
- Arduino & Raspberry Pi Projects
- Position & Limit Detection
- DIY Home Automation
- Robotics & Electronic Projects
- Object Counting Applications
- STEM & Educational Projects
Usage Tips:
- Connect VCC and GND to a suitable 3.3V or 5V supply
- Use the DO pin to monitor the reed switch state
- Position a suitable magnet close to the reed switch for reliable operation
- The switch changes state when a magnetic field is brought sufficiently close
- Use
digitalRead()with Arduino to detect the switch state - Keep strong magnets away from other magnetic-sensitive components where necessary
- The switching distance depends on the strength and type of magnet used


