KY-021 Mini Magnetic Reed Switch Module

KY-021 Mini Magnetic Reed Switch Module image

View on Amazon

Overview

The KY-021 is a mini magnetic reed switch module that detects the presence of a magnetic field. It provides a digital signal output, making it suitable for applications like security systems, position sensors, and magnetic field detection projects.

About KY-021 Mini Magnetic Reed Switch Module

The KY-021 Mini Magnetic Reed Switch Module is designed to detect the presence of a magnetic field. It contains a reed switch that closes its contacts when exposed to a magnetic field, allowing current to flow through. This module operates at voltages between 3.3V and 5V, making it compatible with various microcontrollers like Arduino and ESP32. It’s commonly used in applications such as door and window sensors, position detection, and other projects requiring magnetic field detection.

Where to Buy

Get Your KY-021

KY-021 Mini Magnetic Reed Switch Module

Starting from

1$ per unit

Amazon com
Amazon.com Ships worldwide
Amazon de
Amazon.de Ships to EU
Aliexpress
AliExpress Best value option

Prices are subject to change. We earn from qualifying purchases as an Amazon Associate.

Technical Specs

KY-021 Specifications

Complete technical specification details for KY-021 Mini Magnetic Reed Switch Module

πŸ“Š Technical Parameters

Operating Voltage 3.3V - 5V
Output Type Digital
Dimensions 19 x 18.5 x 9 mm
Pin Configuration

KY-021 Pinout

The **KY-021** is a 3-pin mini magnetic reed switch sensor module:

Visual Pinout Diagram

Pinout Diagram Primary
KY-021 Mini Magnetic Reed Switch Module pinout
3
Total Pins

Pin Types

Power
2
Communication
1

Quick Tips

πŸ”Œ

**Interface**: Digital output (magnetic field detection),🧲 **Sensor**: Reed switch (magnetically-activated switch)

πŸ’‘

**Operation**: Reed contacts close when magnet is nearby,⚑ **Power**: 3.3V to 5V operation

🎯

**Detection**: Detects presence of magnetic field,🎯 **Applications**: Door/window sensors, position detection, security systems, proximity sensing

Pin Descriptions

Pin NameTypeDescriptionNotes
1 Pin (-)
Power

Ground connection

2 Pin (middle)
Power

Power supply

3.3V to 5V

3 Pin (S)
Communication

Digital signal output

Changes state when magnet detected

Connection Guide

Wiring KY-021 to ESP32

To interface the **KY-021** with an **ESP32** for magnetic field detection:

Visual Wiring Diagram

Wiring Diagram Recommended
KY-021 Mini Magnetic Reed Switch Module wiring with ESP32
3
Connections

Connection Status

Required
3

Protocol

Digital

Pin Connections

KY-021 PinConnectionESP32 PinDescription
1 Pin (-) Required
GND

Ground

2 Pin (middle) Required
3.3V

Power supply

3 Pin (S) Required
GPIO4

Digital input (any GPIO)

πŸ’‘

**GPIO Selection**: Any digital GPIO pin works, GPIO4 is just an example

⚑

**Voltage**: Use 3.3V for ESP32 compatibility

🧲

**Magnet**: Use a permanent magnet (neodymium works well)

🎯

**Distance**: Detection range typically 10-20mm depending on magnet strength

πŸšͺ

**Door Sensor**: Popular for door/window open/closed detection

Help & Support

KY-021 Troubleshooting

Common issues and solutions to help you get your sensor working

Common Issues

Debugging Tips

Code Examples

KY-021 Programming Examples

Ready-to-use code examples for different platforms and frameworks

Summary

Wrapping Up KY-021

The ESP32 KY-021 Mini Magnetic Reed Switch Module is a powerful KY-0xx module sensor that offers excellent performance and reliability. With support for multiple development platforms including Arduino, ESP-IDF, ESPHome, PlatformIO, and MicroPython, it's a versatile choice for your IoT projects.

Best Practices

For optimal performance, ensure proper wiring and follow the recommended configuration for your chosen development platform.

Safety First

Always verify power supply requirements and pin connections before powering up your project to avoid potential damage.

Ready to Start Building?

Now that you have all the information you need, it's time to integrate the KY-021 into your ESP32 project and bring your ideas to life!

Similar Options

Explore Alternative Sensors

Looking for alternatives to the KY-021? Check out these similar sensors that might fit your project needs.

KY-050 Ultrasonic Distance Sensor Module

KY-050 Ultrasonic Distance Sensor Module

KY-0XX MODULE Digital

The KY-050 is an ultrasonic distance sensor module capable of measuring distances ranging from 2 cm to 300 cm with a resolution of...

View Details
KY-051 Voltage Translator / Level Shifter

KY-051 Voltage Translator / Level Shifter

KY-0XX MODULE Digital

The KY-051 is a versatile voltage level shifter module that enables safe communication between devices operating at different voltage...

View Details
KY-038 Microphone Sound Sensor Module

KY-038 Microphone Sound Sensor Module

KY-0XX MODULE Analog,Digital

The KY-038 is a microphone sound sensor module equipped with an electret condenser microphone and an LM393 comparator. It offers both analog...

View Details