Mini Reed Magnetic Switch Module KY-021

Mini Reed Magnetic Switch Module KY-021

Components
DET571
Part.No: KY-021
€1.95
In Stock
Immediate Dispatch
KY-021 Mini Reed Magnetic Switch Module — digital NO reed switch, 3.3V–5V, 3-pin interface. Compatible with Arduino, ESP32, Raspberry Pi. Ideal for detecting magnetic fields in door/window sensors, security systems, and automation projects.

 

The KY-021 Mini Reed Magnetic Switch Module (also known as HW-497) is a compact, easy-to-use digital sensor that detects the presence of a magnetic field. At its core is a normally open (NO) reed switch: when a magnet is brought close, the reed contacts close and the Signal pin is pulled LOW, delivering a clean digital output directly to your microcontroller. With an operating voltage of 3.3V to 5V and a built-in pull-up resistor, the KY-021 works out of the box with Arduino, ESP32, and Raspberry Pi — no additional components required.

Key Features

  • Normally Open (NO) Reed Switch: Contacts close in the presence of a magnet → reliable, passive magnetic detection with no power needed at rest
  • Digital Output: Signal pin reads LOW when magnet is detected, HIGH when absent → clean, noise-free reading in code
  • Built-in Pull-up Resistor: No external resistor needed → plug-and-play simplicity
  • Wide Voltage Range 3.3V–5V: Compatible with both 5V and 3.3V logic boards → maximum versatility across platforms
  • 3-Pin Male Header: Standard KY-series connector → direct fit on breadboards and sensor shields
  • Mounting Holes: Fixing bolt holes on PCB → easy permanent installation in enclosures
  • Compact Form Factor: Mini footprint → fits in tight spaces and small project enclosures

Pinout & Wiring

PinSymbolDescription
1SSignal — Digital output. LOW when magnet detected, HIGH when absent
2 (middle)VCC (+)Power supply input — 3.3V or 5V
3− (GND)Ground

Wiring note: Connect S to a digital input pin on your board, VCC to 3.3V or 5V, and to GND. Because the module has a built-in pull-up resistor, configure the pin as plain INPUT (not INPUT_PULLUP). The middle pin is always VCC — on HW-497 clones, if readings appear inverted, swap the S and − wires.

Compatibility

  • Arduino UNO / Nano (5V): Connect VCC to 5V — fully compatible, use a digital input pin
  • ESP32 / ESP8266 (3.3V): Connect VCC to 3.3V — fully compatible, 3.3V-safe digital output
  • Raspberry Pi (3.3V GPIO): Connect VCC to 3.3V — compatible for GPIO digital input reading

Typical Applications

  • Door & window sensors: Detect when a door opens or closes in home automation systems
  • Security & alarm systems: Trigger alerts when magnetic contact is broken
  • Lid/enclosure detection: Know when a box, lid, or hatch is opened in IoT devices
  • Position & proximity sensing: Detect the position of moving parts in robotics and machinery
  • Revolution counting: Count rotations of wheels or shafts with a magnet attached

Technical Specifications

ParameterValue
InterfaceDigital output
Sensor TypeReed switch (normally open, magnetically activated)
Operating Voltage3.3V – 5V DC
Output SignalLOW when magnet present, HIGH when absent
Pull-up ResistorBuilt-in (on-board)
Connector3-pin male header
MountingFixing bolt holes
MPNKY-021

Frequently Asked Questions

Q: Do I need an external pull-up resistor for the KY-021?
A: No. The KY-021 has a built-in pull-up resistor on the PCB. Simply configure your microcontroller pin as INPUT and read the signal directly.

Q: What does the signal read when no magnet is present?
A: When no magnet is nearby, the reed switch is open and the Signal pin reads HIGH. Bringing a magnet close pulls it LOW.

Package Contents: 1 × KY-021 Mini Reed Magnetic Switch Module

Note: A magnet is not included. Use any standard permanent magnet to activate the reed switch. On HW-497 clone boards with different silkscreen labelling, always verify that the middle pin is connected to VCC before powering the module.
16 other products in the same category:
Product added to wishlist
Product added to compare.