Ks0021 keyestudio Collision Sensor: Difference between revisions
Keyestudio (talk | contribs) No edit summary |
Keyestudio (talk | contribs) |
||
(7 intermediate revisions by the same user not shown) | |||
Line 17: | Line 17: | ||
<br> | <br> | ||
==Pin Definition== | ==Pin Definition== | ||
* + pin: 3v-12v power supply | * '''+ pin:''' 3v-12v power supply | ||
* - pin: GND | * '''- pin:''' GND | ||
* S pin: High-low level output | * '''S pin:''' High-low level output | ||
<br> | <br> | ||
==Connection Diagram == | ==Connection Diagram == | ||
<br>[[File: | <br>[[File:Ks0021.png|700px|frameless|thumb]]<br> | ||
<br> | <br> | ||
Line 50: | Line 50: | ||
<br> | <br> | ||
== Result == | |||
Wire it up well and then upload the code to the board. | |||
When the object crashes the switch of sensor, both the led on the sensor and led 13 on the board are turned on. | |||
<br>[[File:KS0349 8-4.png|600px|frameless|thumb]]<br> | |||
<br> | |||
==Resources == | ==Resources == | ||
Line 56: | Line 64: | ||
* '''PDF and Code'''<br> | * '''PDF and Code'''<br> | ||
https:// | https://fs.keyestudio.com/KS0021 | ||
<br> | <br> | ||
==Get One Now== | ==Get One Now== | ||
*[https://www.keyestudio.com/keyestudio-collision-sensor-module-for-arduino-p0396-p0396.html '''Official Website'''] | |||
*[https://ru.aliexpress.com/store/product/Keyestudio-Crash-Collision-Sensor-Module-for-Arduino-Robot/4247007_32885617714.html?spm=a2g0v.12010615.8148356.3.284442daks4Z52 '''Shop on aliexpress'''] | |||
[[Category: Sensor]] | [[Category: Sensor]] |
Latest revision as of 14:41, 7 January 2021
Introduction
Collision sensor, also known as electronic switch, is a digital on-off input module necessary for elementary electronic learning.
By programming, it can realize control over light, sound device, key choice function of LCD display, etc.
Using 3P sensor cable to connect it to sensor shield, it can be installed to 4WD alloy mobile robot platform to realize collision detection function. It is both convenient and efficient.
Note:
You can make a collision flasher using collision module and built-in LED on interface 13.
Connect the collision sensor to pin 3, when the collision sensor senses a collision signal, the LEDs on main board and module will light up simultaneously.
More Details
- If collision happens upfront of where collision module is installed, module outputs low level signal; no collision, outputs high level signal.
- Module reserves M3 mounting hole, convenient for fixation on a car.
- With switch indicator light, if there is collision, light is on; no collision, light is out.
Pin Definition
- + pin: 3v-12v power supply
- - pin: GND
- S pin: High-low level output
Connection Diagram
Sample Code
int Led=13;// set pin for LED int Shock=3// set pin for collision sensor ;int val;// set digital variable val void setup() { pinMode(Led,OUTPUT);// set pin LED as output pinMode(Shock,INPUT);// set collision sensor as input } void loop() { val=digitalRead(Shock);// read value on pin 3 and assign it to val if(val==HIGH)// when collision sensor detects a signal, LED turns on. { digitalWrite(Led,LOW); } else { digitalWrite(Led,HIGH); } }
Result
Wire it up well and then upload the code to the board.
When the object crashes the switch of sensor, both the led on the sensor and led 13 on the board are turned on.
Resources
- Video
http://video.keyestudio.com/ks0021/
- PDF and Code
https://fs.keyestudio.com/KS0021