Sound Detection Sensor(LM393): 두 판 사이의 차이

아두위키 : Arduwiki
(Created page with "{{#seo:|title=아두위키 : 아두이노 소리 감지 센서(LM393) 가이드|title_mode=append|keywords=아두이노, 정보과학, 메이커학습, 수행평가, 소리 감지 센서(LM393), 아두이노 작품, 캡스톤작품, 아두이노 예제코드|description=아두이노로 소리 감지 센서(LM393)를 제어하는 방법(기본정보, 회로, 예제 코드)을 소개합니다. 정보과학과 메이커수업에 활용가능합니다.}} File:소리감지...")
 
잔글편집 요약 없음
 
(같은 사용자의 중간 판 2개는 보이지 않습니다)
8번째 줄: 8번째 줄:
* Digital output
* Digital output
* Sensitivity adjustable via a variable resistor
* Sensitivity adjustable via a variable resistor
 
[[File:Sound Detection Sensor.png|center|class=coders100]]
[[File:Lm393 추가.png|center|class=coders100]]


== '''Example Required Hardware''' ==
== '''Example Required Hardware''' ==
74번째 줄: 73번째 줄:


=== Execution Result ===
=== Execution Result ===
Please check the provided [https://blog.naver.com/gongzipsa/223170697369 link] for the operation video.
<div class="coders70">
<youtube> dfLBgC5YEhk </youtube>
</div>

2024년 7월 10일 (수) 14:23 기준 최신판

This sensor utilizes a microphone to detect ambient sound.

Specifications

  • Operating Voltage: 4V ~ 6V
  • Digital output
  • Sensitivity adjustable via a variable resistor

Example Required Hardware

  • Arduino board
  • Jumper cables
  • Sound detection module
  • LED
  • 330 ohm resistor

Connection

Arduino Sound Detection Module LED Resistor
5V 5V
GND GND K
A2 OUT
D2 connected
A connected

Example Code

This example toggles an LED ON/OFF when sound is detected.

const int soundPin = A2;
const int LED = 2;

void setup() {
  pinMode(LED, OUTPUT);
  pinMode(soundPin, INPUT);
  digitalWrite(LED, LOW);
}

void loop() {
  if (digitalRead(soundPin) == HIGH) {
    digitalWrite(LED, !(digitalRead(LED)));
    delay(100);
  }
}

Execution Result