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
|

Linear magnetic Hall sensor (KY-024) [S048]



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


*GitHub https://github.com/rdiot/rdiot-s048.git



* Specs

Linear Hall magnetic module and a digital interface, built-in 13 LED build a simple circuit to produce a magnetic field warning lamp 13 comes with digital interfaces of the LED, the linear Hall sensor magnetometer access number 3 interface, when linear Hall magnetometer Sensor senses a key signal, LED lights, otherwise off.


* Contents

- Connect

: Analog 

A0 ----- A0


G ----- GND

+ ----- 5V

D0 ----- X

 

: Digital

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 = A0;


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("S048:Linear Mag Hall");


  int val = analogRead(pin);


  lcd.setCursor(0,1);

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


  if(val >= 527 && val <= 528)

  {

    lcd.setCursor(0,2);

    lcd.print("nomally = 527~528");    

  }

  else if (val < 527)

  {

    lcd.setCursor(0,2);

    lcd.print("under 527 : N     ");    

  }

  else if (val > 528)

  { 

    lcd.setCursor(0,2);

    lcd.print("over 527 : S      ");       

  }

  delay(200);

}

Posted by RDIoT
|

Hall Magnetic Sensor Module (KY-003) [S047]



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


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



* Specs

The KY-003 is a magnetic switch. If no magnetic field is present, the signal line of the sensor is HIGH (3.5 V). If a magnetic field is presented to the sensor, the signal line goes LOW, at the same time the LED on the sensor lights up. The polarity of the magnetic field is of influence to the switching action. The front side of the sensor needs the opposite polarity as the back of the sensor to switch on.

In the example program the led on the Arduino (pin 13) will be turned on when a magnetic field is present.


* Contents

- Connect

- ----- GND

middle ----- 5V

S ----- A0


- Key Code

#include <Wire.h> 

#include <LiquidCrystal_I2C.h>

 

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

int pin = A0;

 

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("S047:Hall Magnetic");

 

  int val = analogRead(pin);

 

  lcd.setCursor(0,1);

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

 

  if(val>=750)

  {

    lcd.setCursor(0,2);

    lcd.print("nomally >= 750      ");    

  }

  else

  {

    lcd.setCursor(0,2);

    lcd.print("detected : under 100");    

 

  } 

  delay(200); 

}

Posted by RDIoT
|

Analog Hall Magnetic Sensor Module (KY-035) [S046]



https://www.youtube.com/watch?v=knrf0orPK-w


*GitHub https://github.com/rdiot/rdiot-s046.git



* Specs

KY-035 is an analog magnetic field sensor module. The strength of the field is given by an analog voltage at the signal pin of the module KY-035. The sensor is connected to gnd and 5V of the Arduino board. The output voltage is measured by analog pin A5 on the Arduino board.

The example program measures the output voltage of the sensor en presents the measured value in the serial monitor of the Arduino.

The led on the board flashes in a speed depending on the strength of the magnetic field. With a small magnet this can be demonstrated.



* Contents

- Connect

- ----- GND

middle ----- 5V

S ----- A0


- Key Code

#include <Wire.h> 

#include <LiquidCrystal_I2C.h>


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

int pin = A0;


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("S046:Analog Hall Mag");


  int val = analogRead(pin);


  lcd.setCursor(0,1);

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


  if(val >= 527 && val <= 528)

  {

    lcd.setCursor(0,2);

    lcd.print("nomally = 527~528");    

  }

  else if (val < 527)

  {

    lcd.setCursor(0,2);

    lcd.print("under 527 : N     ");    

  }

  else if (val > 528)

  { 

    lcd.setCursor(0,2);

    lcd.print("over 527 : S      ");       

  }

  delay(200);

}

Posted by RDIoT
|