Reed Swtich Module (KY-025) [S044]



https://www.youtube.com/watch?v=y5TX4BnN1v4


*GitHubhttps://github.com/rdiot/rdiot-s044.git


* Specs

Reed module and the interface comes with digital 13 LED build a simple circuit to produce a Reed warning lamp 13 comes with digital interfaces of the LED, the Reed sensor access number 3 interface, when Reed sensors Sensed a key signal (magnetic field change near the module), LED lights, otherwise off.


* Contents

- Connect

A0 ----- X

G ----- GND

+ ----- 5V

D0 ----- D2


- Key Code

#include <Wire.h> 

#include <LiquidCrystal_I2C.h>


LiquidCrystal_I2C lcd(0x27,20,4);  // LCD2004

int pin = 2;


void setup()

{

  lcd.init();  // initialize the lcd 

  lcd.backlight();

  lcd.print("start LCD2004");


  pinMode(pin,INPUT);

  delay(1000);


  lcd.clear();

}


void loop()

  lcd.setCursor(0,0);

  lcd.print("S044:Read Swtich");


  int val = digitalRead(pin);


  lcd.setCursor(0,1);

  lcd.print("val=" + (String)val + "  ");


  if(val==1)

  {

    lcd.setCursor(0,2);

    lcd.print("detected");    

  }

  else

  {

    lcd.setCursor(0,2);

    lcd.print("        ");    

  }

}

'2) Sensor > Reed' 카테고리의 다른 글

Mini Reed Switch Module (KY-021) [S045]  (0) 2016.09.09
Posted by RDIoT
|

Photo Interrupter Module LM393 Comparator (FC-03) [S158]




https://www.youtube.com/watch?v=qZZzFIRGd_k


*GitHubhttps://github.com/rdiot/rdiot-s158.git


* Specs

Module Features:

Use imported groove coupler sensor

Groove Width: 5mm

Output state indicator lights

Obscured output high; unobstructed output low

The comparator output, the signal is clean, the waveform, driving ability, more than 15mA

Operating Voltage: 3.3V-5V

The output in the form: Digital switching outputs (0 and 1)

A fixed bolt hole for easy installation

Small plates PCB Dimensions: 3.2 x 1.4cm / 1.25 * 0.55"

Using a wide voltage LM393 comparator

Module Using The Instructions:

Module slot unobstructed, receiver tube conduction module DO output low, shelter, DO output high

Module DO connected to the relay, composed of the limit switch functions can also be connected to the active buzzer module, composed 


Pins Connection:

VCC: positive power supply 3.3-5V;

GND: Ground;

DO:  Output frequency pulses;

AO:  analog output, real-time output voltage signal. (not useful)


* Contents

- Connect

VCC ----- 5V

GND ----- GND

D0 ----- D2


- Key Code

#define encdpin   2

volatile int count, countold;

unsigned long ignoremilli = 10;  

unsigned long oldtime = 0;

unsigned long time = 0;


  count = 0;

  countold = 0; 

  oldtime = millis();


  attachInterrupt(digitalPinToInterrupt(encdpin), sensor1, FALLING);


  if(countold != count)

  {

    Serial.println(count);

    lcd.setCursor(0,1);

    lcd.print("CNT : "+(String)count+" ");

    countold = count;

  }

Posted by RDIoT
|

Photo Interrupter Module (KY-010) [S041]



https://www.youtube.com/watch?v=J3O2_PgEOBI


*GitHubhttps://github.com/rdiot/rdiot-s041.git


* Specs

Photo interupter module use the buildin arduino led. If the sensor is broken the LED is turned on.

Device senses a signal, LED lights, otherwise off.


* Contents

- Connect

S ----- D2

Middle ----- 5V

G ----- GND


- Key Code

int pin = 2;


void loop()

{

  int val = digitalRead(pin);

  Serial.println("digital=" + (String)val + " ");


  if(HIGH == val)

  {

    Serial.println("interrupt=detected---------------------------------------------------------");

    delay(100);

  }

  else{

    Serial.println("interrupt=NONE   ");

    delay(100);

  }

}



Posted by RDIoT
|