Sale!

Magnetic Reed Switch Module KY-021

Original price was: 1,93 €.Current price is: 1,68 €. Excluding VAT

Magnetic Reed Switch Module KY-021

Available on back-order

Domande su questo prodotto? Scrivi a Lana su WhatsApp

Categories: ,

🎬 The product on video

Description

What it is

The KY-021 Magnetic Reed Switch Module is a magnetic field sensitive device that changes state when activated by a magnetic field presence. It is commonly used in Arduino projects for automatic management and home automation.

Features

  • Sensitive to magnetic fields
  • Refined for Arduino projects and automatic counters

What it is for

The KY-021 module is ideal for creating simple alarm systems, automatic counters, or any application requiring magnetic field detection. It is compatible with Arduino and can be integrated into ESP32/ESP8266 projects.

Tutorial: How to use the Magnetic Reed Switch Module KY-021

The KY-021 Magnetic Reed Switch Module is a simple device that changes state when activated by a magnetic field. It is ideal for home automation and security projects, such as alarms or counters.

What you need

  • Arduino Uno
  • AAA Batteries (for the KY-021 module)
  • USB Connection between Arduino and computer

Steps

  1. Connect the VCC and GND pins of the KY-021 to the Arduino power supply voltage.
  2. Connect the output of the KY-021 (OUT) to digital pin 2 of the Arduino.
  3. Check the connection with a multimeter or an LED connected to a resistor to visualize the state of the output.
  4. Write and upload an Arduino sketch that reads the input from the KY-021.
  5. Approach a magnetometer to the KY-021 module to test its reaction.
  6. Modify the code to send the switch state data to an online platform or an LCD display.

Example code

const int interruttorePin = 2;

void setup() {
  pinMode(interruttorePin, INPUT);
}

void loop() {
  if (digitalRead(interruttorePin) == HIGH) {
    Serial.println("Interruttore attivato");
  } else {
    Serial.println("Interruttore disattivato");
  }
}

Mini project

Create a simple alarm system that sends a notification when activated.

Common mistakes

  • Incorrect connection of VCC and GND pins
  • Insufficient power supply for the KY-021 module
  • Missing magnetometer connection

Recommended accessories

  • JST Connectors
  • 330 Ohm Resistors
  • 16×2 LCD Display
  • Powerful Magnetometers

Frequently asked questions

Does the KY-021 work with Arduino?
Yes, the KY-021 is compatible with Arduino and other microcontrollers.

What types of magnets can I use?
Use powerful magnets like neodymium to activate the switch.

Can it be used without external power?
Check the datasheet, but it generally requires a power source.

Reviews

There are no reviews yet.

Be the first to review “Magnetic Reed Switch Module KY-021”

Your email address will not be published. Required fields are marked *