Vibration Sensor(SW-420): 두 판 사이의 차이

아두위키 : Arduwiki
(새 문서: {{#seo:|title=Arduwiki : Arduino Vibration Sensor(SW-420) Guide|title_mode=append|keywords=Arduino, Information Science, Maker Learning, Performance Assessment, Vibration Sensor(SW-420), Arduino Project, Capstone Project, Arduino Example Code|description=This introduces how to control a Vibration Sensor(SW-420) with Arduino (basic information, circuit, example code). It can be used in Information Science and Maker classes.}} 파일:아두이노진동감지센서SW-420대표...)
 
 
(같은 사용자의 중간 판 하나는 보이지 않습니다)
3번째 줄: 3번째 줄:
[[파일:아두이노진동감지센서SW-420대표이미지1.jpg|가운데|class=coders100]]
[[파일:아두이노진동감지센서SW-420대표이미지1.jpg|가운데|class=coders100]]


== '''개요''' ==
== '''Overview''' ==
SW-420 센서는 진동 감지 센서로, 주로 진동이나 충격을 감지하는 데 사용됩니다. 이 센서는 아두이노와 같은 마이크로컨트롤러와 함께 사용하여 다양한 프로젝트에 응용할 수 있습니다.
The SW-420 sensor is a vibration detection sensor primarily used for detecting vibrations or shocks. This sensor can be used with microcontrollers such as Arduino for various projects.


==== 1. 진동 감지 구조 ====
내부에 금속 볼이 포함된 기계적 스위치를 사용합니다. 금속 볼은 센서 내부의 두 전극 사이에 위치해 있으며, 외부에서 진동이나 충격이 가해지면 볼이 이동하여 전극 간의 접촉을 형성하거나 끊습니다.


==== 2. 작동 원리 ====
==== 1. Vibration Detection Structure ====
It uses a mechanical switch that contains a metal ball inside. The metal ball is positioned between two electrodes within the sensor, and when external vibrations or shocks occur, the ball moves to make or break contact between the electrodes.
==== 2. Operating Principle ====


* '''정상 상태''': 센서가 안정된 상태일 때, 금속 볼은 전극 사이에 접촉하지 않아 출력 신호는 LOW(0V) 상태입니다.
'''Normal State''': When the sensor is in a stable state, the metal ball does not make contact between the electrodes, resulting in a LOW (0V) output signal.
* '''진동 감지''': 외부에서 진동이 발생하면 금속 볼이 이동하여 전극과 접촉하게 됩니다. 이때 출력 신호는 HIGH(5V) 상태로 변하게 됩니다. 이 신호는 아두이노와 같은 마이크로컨트롤러에 전달되어 진동이 감지되었음을 알립니다.
'''Vibration Detection''': When vibrations occur externally, the metal ball moves and makes contact with the electrodes. At this point, the output signal changes to HIGH (5V). This signal is transmitted to a microcontroller like Arduino, indicating that a vibration has been detected.
==== 3. Sensitivity Adjustment ====
The SW-420 sensor has a built-in variable resistor that allows for sensitivity adjustment. By adjusting this resistor, the strength of the vibrations detected by the sensor can be controlled. In other words, increasing the sensitivity allows for the detection of weaker vibrations, while decreasing it makes the sensor only respond to stronger vibrations.


==== 3. 민감도 조정 ====
SW-420 센서에는 민감도를 조절할 수 있는 가변 저항이 내장되어 있습니다. 이 저항을 조정함으로써 센서가 감지하는 진동의 강도를 조절할 수 있습니다. 즉, 민감도를 높이면 약한 진동도 감지할 수 있고, 민감도를 낮추면 강한 진동만 감지하게 됩니다.


== '''Specifications''' ==


== '''사양''' ==
*'''Voltage Range''': DC 3.3V ~ 5V
*'''Signal Type''': Digital Output (HIGH/LOW)
*'''Output Voltage''': Approximately 5V in HIGH state, 0V in LOW state
*'''PCB Size''': Approximately 32mm x 14mm


* '''전압 범위''': DC 3.3V ~ 5V


* '''신호 유형''': 디지털 출력 (HIGH/LOW)
== '''Application Examples''' ==
* '''출력 전압''': HIGH 상태에서 약 5V, LOW 상태에서 0V
* '''PCB 크기''': 약 32mm x 14mm


 
=== Basic Circuit Configuration ===
== '''활용 예제''' ==
 
=== 기본 회로 구성 ===
{| class="wikitable"
{| class="wikitable"
!아두이노
!Arduino
!SW-420 진동 감지 센서
!SW-420 Vibration Sensor
|-
|-
|'''5V'''
|'''5V'''
|VCC
|VCC
|-
|-
|'''GND'''
|'''GND'''
|GND
|GND
|-
|-
|'''D2'''
|'''D2'''
|DO
|DO
|}
|}
[[파일:Sw420기본회로.jpg|가운데|class=coders100]]
[[파일:Sw420기본회로.jpg|가운데|class=coders100]]


=== 1. 진동을 감지하여 시리얼 모니터로 출력 ===
 
위 기본 회로를 구성하신 후, SW-420 진동 센서를 손으로 흔들어서 진동 감지 여부를 시리얼 모니터로 확인하는 예제입니다.<syntaxhighlight lang="c++" line="1">
=== 1. Detecting Vibration and Outputting to Serial Monitor ===
const int sensorPin = 2; // SW-420 OUT 핀 연결
After constructing the basic circuit above, this is an example of checking whether the SW-420 vibration sensor detects vibrations by shaking it with your hand and observing the output on the serial monitor.
<syntaxhighlight lang="c++" line="1">
const int sensorPin = 2; // SW-420 OUT Pin Connect
int sensorValue = 0;
int sensorValue = 0;


58번째 줄: 58번째 줄:
     sensorValue = digitalRead(sensorPin);
     sensorValue = digitalRead(sensorPin);
     if (sensorValue == HIGH) {
     if (sensorValue == HIGH) {
         Serial.println("진동 감지!");
         Serial.println("Vibration Detection!");
     } else {
     } else {
         Serial.println("진동 없음.");
         Serial.println("No Vibration.");
     }
     }
     delay(500);
     delay(500);
66번째 줄: 66번째 줄:
</syntaxhighlight>
</syntaxhighlight>


==== 실행결과 ====
==== Execution Result ====
[[파일:Sw420예제1시리얼모니터.png|class=coders70]]
[[파일:Sw420예제1시리얼모니터.png|class=coders70]]




=== 2. LED와 함께 활용 ===
=== 2. Using with LED ===
진동이 감지되면 LED가 켜지는 예제입니다.
This is an example where the LED turns on when vibration is detected.


==== Circuit Configuration ====
Connect the shorter leg of the LED to a resistor, and then connect the resistor to the GND pin of the Arduino. Typically, a 100Ω or 220Ω resistor is used.


==== 회로 구성 ====
Connect the longer leg of the LED to the Arduino pin D13. For more detailed information about the LED, please refer to the [[LED(5mm)]] document.
LED의 짧은 다리를 저항과 연결하고, 저항을 다시 아두이노 GND 핀에 연결합니다. 저항은 보통 100Ω, 220Ω을 사용합니다.


LED 긴 다리는 아두이노 D13핀에 연결합니다. LED에 대한 자세한 정보는 [[LED(5mm)]] 문서를 참고하세요.
[[파일:Sw420예제2회로.jpg|가운데|class=coders100]]


[[파일:Sw420예제2회로.jpg|가운데|class=coders100]]


==== 아두이노 코드 ====
==== Code ====
<syntaxhighlight lang="c++" line="1">
<syntaxhighlight lang="c++" line="1">
const int sensorPin = 2; // SW-420 OUT 핀 연결
const int sensorPin = 2; // SW-420 OUT Pin
const int ledPin = 13;  // 내장 LED
const int ledPin = 13;  // Built-in LED Pin
int sensorValue = 0;
int sensorValue = 0;


96번째 줄: 96번째 줄:
     sensorValue = digitalRead(sensorPin);
     sensorValue = digitalRead(sensorPin);
     if (sensorValue == HIGH) {
     if (sensorValue == HIGH) {
         Serial.println("진동 감지!");
         Serial.println("Vibration Detection!");
         digitalWrite(ledPin, HIGH); // LED 켜기
         digitalWrite(ledPin, HIGH); // Turning on LED
     } else {
     } else {
         Serial.println("진동 없음.");
         Serial.println("No Vibration");
         digitalWrite(ledPin, LOW); // LED 끄기
         digitalWrite(ledPin, LOW); // Turning off LED
     }
     }
     delay(500);
     delay(500);
107번째 줄: 107번째 줄:




==== 실행결과 ====
==== Execution Results ====
진동이 감지되면 LED가 켜지는 모습이며, 1번 예제와 같은 모습의 시리얼 모니터 또한 함께 확인할 수 있습니다.
When vibration is detected, the LED lights up, and the serial monitor will display results similar to those in Example 1.


<div class="coders100">
<div class="coders100">
<youtube> TTHueDfPt3o </youtube>
<youtube> TTHueDfPt3o </youtube>
</div>
</div>


== '''구매 링크''' ==
== '''구매 링크''' ==
[https://gongzipsa.com/shop/1715255545 공집사몰]
[https://gongzipsa.com/shop/1715255545 GONGZIPSA]

2024년 8월 9일 (금) 15:10 기준 최신판


Overview

The SW-420 sensor is a vibration detection sensor primarily used for detecting vibrations or shocks. This sensor can be used with microcontrollers such as Arduino for various projects.


1. Vibration Detection Structure

It uses a mechanical switch that contains a metal ball inside. The metal ball is positioned between two electrodes within the sensor, and when external vibrations or shocks occur, the ball moves to make or break contact between the electrodes.

2. Operating Principle

Normal State: When the sensor is in a stable state, the metal ball does not make contact between the electrodes, resulting in a LOW (0V) output signal. Vibration Detection: When vibrations occur externally, the metal ball moves and makes contact with the electrodes. At this point, the output signal changes to HIGH (5V). This signal is transmitted to a microcontroller like Arduino, indicating that a vibration has been detected.

3. Sensitivity Adjustment

The SW-420 sensor has a built-in variable resistor that allows for sensitivity adjustment. By adjusting this resistor, the strength of the vibrations detected by the sensor can be controlled. In other words, increasing the sensitivity allows for the detection of weaker vibrations, while decreasing it makes the sensor only respond to stronger vibrations.


Specifications

  • Voltage Range: DC 3.3V ~ 5V
  • Signal Type: Digital Output (HIGH/LOW)
  • Output Voltage: Approximately 5V in HIGH state, 0V in LOW state
  • PCB Size: Approximately 32mm x 14mm


Application Examples

Basic Circuit Configuration

Arduino SW-420 Vibration Sensor
5V VCC
GND GND
D2 DO


1. Detecting Vibration and Outputting to Serial Monitor

After constructing the basic circuit above, this is an example of checking whether the SW-420 vibration sensor detects vibrations by shaking it with your hand and observing the output on the serial monitor.

const int sensorPin = 2; // SW-420 OUT Pin Connect
int sensorValue = 0;

void setup() {
    Serial.begin(9600);
    pinMode(sensorPin, INPUT);
}

void loop() {
    sensorValue = digitalRead(sensorPin);
    if (sensorValue == HIGH) {
        Serial.println("Vibration Detection!");
    } else {
        Serial.println("No Vibration.");
    }
    delay(500);
}

Execution Result


2. Using with LED

This is an example where the LED turns on when vibration is detected.

Circuit Configuration

Connect the shorter leg of the LED to a resistor, and then connect the resistor to the GND pin of the Arduino. Typically, a 100Ω or 220Ω resistor is used.

Connect the longer leg of the LED to the Arduino pin D13. For more detailed information about the LED, please refer to the LED(5mm) document.


Code

const int sensorPin = 2; // SW-420 OUT Pin
const int ledPin = 13;   // Built-in LED Pin
int sensorValue = 0;

void setup() {
    Serial.begin(9600);
    pinMode(sensorPin, INPUT);
    pinMode(ledPin, OUTPUT);
}

void loop() {
    sensorValue = digitalRead(sensorPin);
    if (sensorValue == HIGH) {
        Serial.println("Vibration Detection!");
        digitalWrite(ledPin, HIGH); // Turning on LED
    } else {
        Serial.println("No Vibration");
        digitalWrite(ledPin, LOW); // Turning off LED
    }
    delay(500);
}


Execution Results

When vibration is detected, the LED lights up, and the serial monitor will display results similar to those in Example 1.


구매 링크

GONGZIPSA