Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Component Documentation

How to Use Modulo Mini Interruptor Magnetico: Examples, Pinouts, and Specs

Image of Modulo Mini Interruptor Magnetico
Cirkit Designer LogoDesign with Modulo Mini Interruptor Magnetico in Cirkit Designer

Introduction

The Modulo Mini Interruptor Magnetico (KY21), manufactured by Keys, is a compact magnetic switch module designed to detect the presence of a magnetic field. This module is widely used in security systems, such as door and window sensors, to detect when a door or window is opened or closed. It is also suitable for other applications requiring magnetic field detection, such as proximity sensing and automation systems.

Explore Projects Built with Modulo Mini Interruptor Magnetico

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
ESP32C3 Supermini-Based Smart Environment Monitor and Lighting Control System
Image of Bedside RGB and Lamp: A project utilizing Modulo Mini Interruptor Magnetico in a practical application
This is a smart control system featuring an ESP32C3 Supermini microcontroller for interfacing with various sensors and actuators. It includes temperature and humidity sensing, RGB LED strip control, user input via a pushbutton and rotary encoder, and AC power control through a two-channel relay. The system is powered by an AC source converted to DC by the HLK-PM12 module.
Cirkit Designer LogoOpen Project in Cirkit Designer
Battery-Powered LED Control with Pushbutton and Relay
Image of EXP.3 E: A project utilizing Modulo Mini Interruptor Magnetico in a practical application
This circuit uses a pushbutton to control a 5V relay, which in turn powers a red LED. The MAHIR 1.mini module provides the necessary 3.7V power supply, and the relay switches the LED on and off based on the pushbutton input.
Cirkit Designer LogoOpen Project in Cirkit Designer
Battery-Powered LED Toggle Switch Circuit
Image of EXP. 7 E: A project utilizing Modulo Mini Interruptor Magnetico in a practical application
This circuit consists of a red LED, a toggle switch, and a power source. The LED is powered by a 3.7V supply from the MAHIR 1.mini module, and its illumination is controlled by the toggle switch, which connects or disconnects the LED's cathode to ground.
Cirkit Designer LogoOpen Project in Cirkit Designer
Battery-Powered LED Control with Pushbutton and Relay
Image of EXP-3: Led OFF Using Relay Switch: A project utilizing Modulo Mini Interruptor Magnetico in a practical application
This circuit uses a pushbutton to control a 5V relay, which in turn controls the power to a red LED. The MAHIR 1.mini module provides the necessary power and ground connections for the relay.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with Modulo Mini Interruptor Magnetico

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Bedside RGB and Lamp: A project utilizing Modulo Mini Interruptor Magnetico in a practical application
ESP32C3 Supermini-Based Smart Environment Monitor and Lighting Control System
This is a smart control system featuring an ESP32C3 Supermini microcontroller for interfacing with various sensors and actuators. It includes temperature and humidity sensing, RGB LED strip control, user input via a pushbutton and rotary encoder, and AC power control through a two-channel relay. The system is powered by an AC source converted to DC by the HLK-PM12 module.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of EXP.3 E: A project utilizing Modulo Mini Interruptor Magnetico in a practical application
Battery-Powered LED Control with Pushbutton and Relay
This circuit uses a pushbutton to control a 5V relay, which in turn powers a red LED. The MAHIR 1.mini module provides the necessary 3.7V power supply, and the relay switches the LED on and off based on the pushbutton input.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of EXP. 7 E: A project utilizing Modulo Mini Interruptor Magnetico in a practical application
Battery-Powered LED Toggle Switch Circuit
This circuit consists of a red LED, a toggle switch, and a power source. The LED is powered by a 3.7V supply from the MAHIR 1.mini module, and its illumination is controlled by the toggle switch, which connects or disconnects the LED's cathode to ground.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of EXP-3: Led OFF Using Relay Switch: A project utilizing Modulo Mini Interruptor Magnetico in a practical application
Battery-Powered LED Control with Pushbutton and Relay
This circuit uses a pushbutton to control a 5V relay, which in turn controls the power to a red LED. The MAHIR 1.mini module provides the necessary power and ground connections for the relay.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications:

  • Security systems (e.g., door/window sensors)
  • Proximity detection in industrial automation
  • Magnetic field detection in DIY electronics projects
  • Smart home systems for monitoring doors and windows

Technical Specifications

The following table outlines the key technical details of the KY21 module:

Parameter Value
Operating Voltage 3.3V to 5V
Operating Current < 5mA
Output Type Digital (High/Low)
Detection Range 10mm to 20mm (depending on magnet strength)
Dimensions 32mm x 14mm x 10mm
Operating Temperature -20°C to 70°C

Pin Configuration and Descriptions

The KY21 module has three pins, as described in the table below:

Pin Name Description
1 VCC Power supply input (3.3V to 5V)
2 GND Ground connection
3 OUT Digital output pin (HIGH when no magnet is detected, LOW when a magnet is detected)

Usage Instructions

How to Use the KY21 in a Circuit

  1. Power the Module: Connect the VCC pin to a 3.3V or 5V power source and the GND pin to the ground of your circuit.
  2. Connect the Output: Connect the OUT pin to a digital input pin of your microcontroller or to another circuit that requires the magnetic field detection signal.
  3. Place the Magnet: Position a magnet near the module. When the magnet is within the detection range, the OUT pin will go LOW. When the magnet is removed, the OUT pin will return to HIGH.

Important Considerations and Best Practices

  • Magnet Strength: Ensure the magnet used is strong enough to be detected within the desired range.
  • Placement: Avoid placing the module near strong electromagnetic interference (EMI) sources, as this may affect its performance.
  • Debouncing: If using the module with a microcontroller, consider implementing software debouncing to handle any noise or fluctuations in the output signal.

Example: Connecting the KY21 to an Arduino UNO

Below is an example of how to connect and use the KY21 module with an Arduino UNO:

Circuit Connections:

  • Connect the VCC pin of the KY21 to the 5V pin of the Arduino.
  • Connect the GND pin of the KY21 to the GND pin of the Arduino.
  • Connect the OUT pin of the KY21 to digital pin 2 of the Arduino.

Arduino Code:

// KY21 Magnetic Switch Module Example
// This code reads the output of the KY21 module and prints the status to the Serial Monitor.

const int sensorPin = 2; // KY21 OUT pin connected to digital pin 2
int sensorState = 0;     // Variable to store the sensor state

void setup() {
  pinMode(sensorPin, INPUT); // Set the sensor pin as input
  Serial.begin(9600);        // Initialize serial communication at 9600 baud
}

void loop() {
  sensorState = digitalRead(sensorPin); // Read the state of the sensor

  if (sensorState == LOW) {
    // Magnet is detected
    Serial.println("Magnet detected!");
  } else {
    // Magnet is not detected
    Serial.println("No magnet detected.");
  }

  delay(500); // Wait for 500ms before reading again
}

Troubleshooting and FAQs

Common Issues and Solutions

  1. The module does not detect the magnet:

    • Solution: Ensure the magnet is within the detection range (10mm to 20mm). Use a stronger magnet if necessary.
    • Solution: Verify that the module is powered correctly (3.3V to 5V) and that all connections are secure.
  2. The output signal is unstable:

    • Solution: Check for sources of electromagnetic interference (EMI) near the module and relocate it if needed.
    • Solution: Add a capacitor (e.g., 0.1µF) across the power supply pins to filter noise.
  3. The module outputs a constant HIGH signal:

    • Solution: Ensure the magnet is not too far from the module. Test with a different magnet if needed.
    • Solution: Verify that the OUT pin is properly connected to the microcontroller or circuit.

FAQs

Q: Can the KY21 module detect any type of magnet?
A: Yes, the KY21 can detect most types of magnets, but the detection range depends on the magnet's strength and size.

Q: Can I use the KY21 with a 3.3V microcontroller?
A: Yes, the KY21 operates within a voltage range of 3.3V to 5V, making it compatible with 3.3V microcontrollers like the ESP32.

Q: Is the KY21 suitable for outdoor use?
A: The KY21 is not waterproof or weatherproof. If used outdoors, it should be enclosed in a protective casing to prevent damage from moisture or dust.