Ks0118 keyestudio EASY plug Reed Switch Module

From Keyestudio Wiki
Jump to: navigation, search
Keyestudio EASY plug Reed Switch Module

Introduction

This is a small device called a reed switch on the module.
When the device is exposed to a magnetic field, the two ferrous materials inside the switch pull together and the switch closes.
When the magnetic field is removed, the reeds separate and the switch opens. This makes for a great non-contact switch.
You can mount reed switch on the door for alarming purpose or as switches.
Note: this sensor needs to be used together with EASY plug control board.

Features

  • Connector: Easy plug
  • Working voltage: DC 3.3V-5V
  • Working current: ≥20mA
  • Working temperature: -10℃ to+50℃
  • Detection distance: ≤10mm


Technical Details

  • Dimensions: 39mm*20mm*18mm
  • Weight: 4.6g


Connect It Up

Connect the EASY Plug reed switch module to control board using an RJ11 cable. Then connect the control board to your PC with a USB cable.
thumb


Upload the Code

Copy and paste below code to Arduino IDE and upload.

int Led=13;//define LED interface
int buttonpin=8; //define reed switch sensor interface
int val;//define digital variable val
void setup()
{
pinMode(Led,OUTPUT);//define LED as output interface
pinMode(buttonpin,INPUT);//define reed switch sensor as output interface
}
void loop()
{
val=digitalRead(buttonpin);// read and assign the value of digital interface 3 to val if(val==HIGH)//When a signal is detected by reed switch sensor, LED will flash
if(val==HIGH)//When a signal is detected by reed switch sensor, LED will flash
{
digitalWrite(Led,HIGH);
}
else
{
digitalWrite(Led,LOW);
}
}


What You Should See

If you put some magnetic beads around the reed module, once the reed module detects the magnetic field, LED will turn on.
thumb


Resources

Download the PDF:
https://drive.google.com/open?id=1UAujQHnyqXk3Ie6ypzHywBe0B1U6xuPq


Buy from