Tilt Switch Module KY-020 (Arduino,Raspberry Pi,AVR,PIC)

Tilt Switch Module KY-020 (Arduino,Raspberry Pi,AVR,PIC)
รหัสสินค้า AS40147
หมวดหมู่ การเคลื่อนไหว หมุน เอียงและสั่น Motion/Rotation/Tilt/Vibration
ราคา 39.00 บาท
สถานะสินค้า พร้อมส่ง
จำนวน
ชิ้น
หยิบลงตะกร้า
หนังสือรับรองบริษัท
บุ๊คแบ๊งค์
คุ้มครองโดย LnwPay

Tilt Switch Module KY-020
KY-020 can detect when it is tilted. The sensor contains a small metal ball that will complete a circuit depending on where it is in the sensor. Because the sensor is very basic, it can only detect large changes in its tilt, and cannot measure the angle of its tilt.

Technical data / Short description

Depending on the angle, a switch connects the circuit.

Pinout

3 G V S.png

Code example Arduino

This example will light up a LED after a sensor detected a signal.

the modules KY-011, KY-016 or KY-029 could be used as LED too for example.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
int Led = 13 ;// Declaration of the LED output pin
int Sensor = 10; // Declaration of the sensor input pin
int val; // Temporary variable
  
void setup()
{
  pinMode(Led, OUTPUT) ; // Initialization output pin
  pinMode(Sensor, INPUT) ; // Initialization sensor pin
}
  
void loop()
{
  val = digitalRead(Sensor) ; // The current signal at the sensor will be read
  
  if(val == HIGH) // If a signal will be detected, the LED will light up
  {
    digitalWrite(Led, LOW);
  }
  else
  {
    digitalWrite(Led, HIGH);
  }
}

Connections Arduino:

LED + = [Pin 13]
LED - = [Pin GND]
Sensor Signal = [Pin 10]
Sensor +V = [Pin 5V]
Sensor - = [Pin GND]

Example program download

SensorTest_Arduino_withoutPullUP

Code example Raspberry Pi

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Needed modules will be imported and configured
import RPi.GPIO as GPIO
import time
  
GPIO.setmode(GPIO.BCM)
  
# Declaration of the input pin which is connected with the sensor. Additional to that, a pullup resistor will be activated.
GPIO_PIN = 24
GPIO.setup(GPIO_PIN, GPIO.IN)
  
print"Sensor-test [press ctrl+c to end]"
  
# This outFunction will be started at signal detection.
def outFunction(null):
        print("Signal detected")
  
# The outFunction will be started after detecting of a signal (falling signal edge)
GPIO.add_event_detect(GPIO_PIN, GPIO.FALLING, callback=outFunction, bouncetime = 100)
  
# Main program loop
try:
        whileTrue:
                time.sleep(1)
  
# Scavenging work after the end of the program
except KeyboardInterrupt:
        GPIO.cleanup()

Connections Raspberry Pi:

Signal = GPIO24 [Pin 18]
+V = 3,3V [Pin 1]
GND = GND [Pin 6]

Example program download

SensorTest_RPi_withoutPullUP

To start, enter the command:

1
sudopython SensorTest_RPi_withoutPullUP.py

วิธีการชำระเงิน

ชำระเงินค่าสินค้าโดยการโอนเงินเข้าบัญชีธนาคาร KBANK, SCB, BBL,TMB

กรุณาเก็บหลักฐานการโอนเงินของท่านไว้เพื่อแจ้งการชำระเงินด้วยค่ะ

 

ท่านสามารถแจ้งการชำระเงินผ่านระบบอัตโนมัติได้โดย Click Link ข้างล่างค่ะ

https://www.arduitronics.com/informpayment

 

บมจ. ธนาคารกสิกรไทย สาขาเซ็นทรัล แจ้งวัฒนะ ออมทรัพย์
ธนาคารไทยพาณิชย์ จำกัด (มหาชน) สาขาเซ็นทรัล แจ้งวัฒนะ ออมทรัพย์
ธนาคารกรุงเทพ จำกัด (มหาชน) สาขาเซนทรัล พระราม 3 สะสมทรัพย์
ธนาคารทหารไทยธนชาต จำกัด (มหาชน) สาขาเซนทรัล พระราม 3 กระแสรายวัน

เพิ่มเพื่อน

@rfm0967y

ติดต่อสอบถาม

เพิ่มเพื่อน

CATEGORY

Sensors / Modules [1704]

CONTACT US

มือถือ 0887823467 แฟกซ์ 02-0153201

Join เป็นสมาชิกร้านค้า

ร้านArduitronics
ร้านArduitronics
/www.arduitronics.com/
Join เป็นสมาชิกร้าน
2146
สมัครสมาชิกร้านนี้ เพื่อรับสิทธิพิเศษ

STATISTICS

หน้าที่เข้าชม15,429,823 ครั้ง
ผู้ชมทั้งหมด5,932,901 ครั้ง
เปิดร้าน21 พ.ค. 2556
ร้านค้าอัพเดท12 ต.ค. 2568

MEMBER

พูดคุย-สอบถาม