Ks0024 keyestudio Knock Sensor Module: Difference between revisions

From Keyestudio Wiki
Jump to navigation Jump to search
No edit summary
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
<br>
==Introduction==
==Introduction==
This module is a knock sensor. When you knock it, it can send a momentary signal. You can combine it with Arduino to make some interesting experiments, e.g. electronic drum.
This is a knock sensor module. When you knock it, it can send a momentary signal. You can combine it with Arduino to make some interesting experiment, e.g. electronic drum.
<br>[[File:241.png|500px|frameless|thumb]]<br>
* Working voltage: 5V
<br>[[File:Ks0024.png|500px|frameless|thumb]]<br>


==Specification==
<br>
*Working Voltage: 5V
*Size: 30*20mm
*Weight: 3g


==Connection Diagram ==
==Connection Diagram ==
<br>[[File:Ks0024-.png|700px|frameless|thumb]]<br>


<br>[[File:242.png|500px|frameless|thumb]]<br>
<br>
 
==Sample Code ==
==Sample Code ==
<pre>
<pre>
int Led=13;//define LED interface
int Led=13;//define LED interface
int Shock=3//define knock sensor interface
int Shock=3;//define knock sensor interface
;int val;//define digital variable val
int val;//define digital variable val
void setup()
void setup()
{
{
Line 34: Line 32:
{
{
digitalWrite(Led,HIGH);
digitalWrite(Led,HIGH);
}</pre>
}
}
</pre>


<br>
Upload the code to the board. When the sensor detects a knock signal, both the led on the sensor and led 13 on the UNO board are turned on.
<br>
==Extension==
You can extend to connect an external LED; when knock the sensor, the external LED will turn on. For example:<br>
<br>[[File:图片-KS0024.png|600px|frameless|thumb]]<br>
<br>
==Resources ==
==Resources ==


'''Video'''
* '''Video'''<br>
http://video.keyestudio.com/ks0024/


http://www.keyestudio.com/wp/2016/05/ks0024-keyestudio-knock-sensor/
* '''PDF and Code'''<br>
https://drive.google.com/open?id=1KqXGAd6G9valrVIvrcwSKVqIH4LJiWOg


'''Datasheet'''


http://www.keyestudio.com/files/index/download/id/1463649536/
<br>


==Get One Now==
==Get One Now==


http://www.keyestudio.com/keyestudio-knock-sensor-module.html
*[https://www.keyestudio.com/free-shipping-keyestudio-knock-sensor-module-compatible-with-arduino-p0457-p0457.html   '''Official Website''']
 
*[https://www.aliexpress.com/store/product/Keyestudio-Knock-Sensor-Module-For-Arduino-UNO-r3-CE-FCC/4247007_32889194291.html?spm=2114.12010615.8148356.1.32081edeYiisQk    '''Shop on aliexpress''' ]


https://www.amazon.com/Keyestudio-Sensor-Module-Arduino-raspberry/dp/B016ZWRK1I/ref=sr_1_1?srs=13497667011&ie=UTF8&qid=1479870736&sr=8-1&keywords=keyestudio+Knock+Sensor+Module


[[Category: Sensor]]
[[Category: Sensor]]

Revision as of 08:45, 7 May 2019


Introduction

This is a knock sensor module. When you knock it, it can send a momentary signal. You can combine it with Arduino to make some interesting experiment, e.g. electronic drum.

  • Working voltage: 5V


thumb


Connection Diagram


thumb


Sample Code

int Led=13;//define LED interface
int Shock=3;//define knock sensor interface
int val;//define digital variable val
void setup()
{
pinMode(Led,OUTPUT);//define LED to be output interface
pinMode(Shock,INPUT);//define knock sensor to be output interface
}
void loop()
{
val=digitalRead(Shock);//read the value of interface3 and evaluate it to val
if(val==HIGH)//when the knock sensor detect a signal, LED will be flashing
{
digitalWrite(Led,LOW);
}
else
{
digitalWrite(Led,HIGH);
}
}


Upload the code to the board. When the sensor detects a knock signal, both the led on the sensor and led 13 on the UNO board are turned on.



Extension

You can extend to connect an external LED; when knock the sensor, the external LED will turn on. For example:

thumb



Resources

  • Video

http://video.keyestudio.com/ks0024/

  • PDF and Code

https://drive.google.com/open?id=1KqXGAd6G9valrVIvrcwSKVqIH4LJiWOg



Get One Now