Tilt SW-520D Sensor (SW-520D) [S067]



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


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


* Specs

Max voltage : 20V 

Max current : 0.3A


* Contents

- Connect

1 ---- 5V

2 ----- R220 ----- D2

           ------ GND


- Key Code

int pin = 2;

int val = digitalRead(pin);


if(val == LOW)

  lcd.setCursor(0,2);

  lcd.print("Tilt CLOSE");

}

else

{

  lcd.setCursor(0,2);

  lcd.print("Tilt OPEN ");  

}

Posted by RDIoT
|

Tilt SW-200D Sensor (W-200D) [S051]



https://www.youtube.com/watch?v=Awp-0iWdAm4


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


* Specs

the switch using metal manufacturing, electrical characteristics and mercury switches are similar but not the risk of mercury switches and environmental issues, while shaking unidirectional conducting the same characteristics, the assembly of the use of more convenient and safe;

Operating Characteristics: Switch in the stationary state, as shown in Figure (ON) side below the level of 15 degrees, the switch is in the ON state; when (OFF) side below the level of 15 degrees, the switch is in the OFF state; when achieved by external shaking shaking force, or set the conduction angle, the conductive pin electrical characteristics will produce short or continuous conduction.

when the electrical characteristics of the open state to be restored (OFF) when the switch is set to the environment must be static, and the (OFF) is set to be lower than the level of the open end angle;

the switch all materials are manufactured using environmentally friendly raw materials, in line with ROHS requirements;

when the switch below the horizontal angle of 15 degrees, shaking hard trigger conduction;

the trigger switch for low current circuit, does not apply when the power switch;

this switch is a sealed package, dustproof and waterproof.

The switch is lacoste type better than the single bead type conduction effect


Maximum operating voltage (Vmax): 12V

Maximum operating current (Imax): 2mA

Open resistance: greater than 10M

Resistance: less than 5 ohm

Ambient temperature: less than 100 degrees

Life: 500,000 times


* Contents

- Connect

1 ---- 5V

2 ----- R220 ----- D2

           ------ GND


- Key Code

int pin = 2;

int val = digitalRead(pin);


if(val == LOW)

  lcd.setCursor(0,2);

  lcd.print("Tilt CLOSE");

}

else

{

  lcd.setCursor(0,2);

  lcd.print("Tilt OPEN ");  

}

Posted by RDIoT
|

Ultrasonic Ranging Module (HC-SR04) [S011]



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


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


* Specs

Working Voltage DC 5 V

Working Current 15mA

Working Frequency 40Hz

Max Range 4m

Min Range 2cm

MeasuringAngle 15 degree

Trigger Input Signal 10uS TTL pulse

Echo Output Signal Input TTL lever signal and the range in proportion

Dimension 45*20*15mm


* Contents

VCC - 5V

Trig - D8 

Echo - D9

GND - GND


- Key Code

#include "U8glib.h"

U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);


const int TriggerPin = 8; //Trig pin

const int EchoPin = 9; //Echo pin

long Duration = 0;

long Distance_mm = 0;


void setup() {

  pinMode(TriggerPin, OUTPUT); // Trigger is an output pin

  pinMode(EchoPin, INPUT); // Echo is an input pin

  Serial.begin(9600); // Serial Output

}


void loop(void) {

  digitalWrite(TriggerPin, LOW);

  delayMicroseconds(2);

  digitalWrite(TriggerPin, HIGH); // Trigger pin to HIGH

  delayMicroseconds(10); // 10us high

  digitalWrite(TriggerPin, LOW); // Trigger pin to HIGH


  Duration = pulseIn(EchoPin, HIGH); // Waits for the echo pin to get high

  Distance_mm = Distance(Duration); // Use function to calculate the distance


  Serial.print("Distance = "); // Output to serial

  Serial.print(Distance_mm);

  Serial.println(" mm");


  // picture loop

  u8g.firstPage();  

  do {

    draw();

  } while( u8g.nextPage() );

  // rebuild the picture after some delay

  delay(500);

}


long Distance(long time)

{

  // Calculates the Distance in mm

  // ((time)*(Speed of sound))/ toward and backward of object) * 10


  long DistanceCalc; // Calculation variable

  DistanceCalc = ((time / 2.9) / 2); // Actual calculation in mm

  //DistanceCalc = time / 74 / 2; // Actual calculation in inches

  return DistanceCalc; // return calculated value

}


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

Infrared distance sensor (GP2Y0A21YK0F) [S036]  (0) 2019.02.23
Posted by RDIoT
|