Ks0021 keyestudio Collision Sensor

From Keyestudio Wiki
Revision as of 16:59, 18 November 2016 by Keyestudio (talk | contribs)
Jump to navigation Jump to search

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 AL alloy mobile robot platform to realize collision detection function. It is both convenient and effecient. Note: You can make a collision flasher using collision module and built-in LED on interface 13. Connect the collision senser to pin 3, when the collision sensor senses a collision signal, the LEDs on mainboard and module will light up simultaneously.
thumb


Specification

  • 1. If collision happens upfront of where collision module is installed, module outputs low level signal; no collision, outputs high level signal.
  • 2. Module reserves M3 mounting hole, convenient for fixation on a car.
  • 3. Module size: 3.1cm * 2.1cm
  • 4. With switch indicator light, if there is collision, light is on; no collision, light is out.

Pin definition

  • 1 +  3v-12v power supply
  • 2 - GND
  • 3 S Gigh-low level output

Connection Diagram


thumb

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);
}
}

Resources

Video

http://www.keyestudio.com/wp/2016/05/ks0021-keyestudio-collision-sensor-module/

Datasheet

http://www.keyestudio.com/files/index/download/id/1463649332/

Get One Now

http://www.keyestudio.com/keyestudio-collision-sensor.html

https://www.amazon.com/Keyestudio-Collision-Sensor-Arduino-raspberry/dp/B0179DNR5U/ref=sr_1_3?ie=UTF8&qid=1479459450&sr=8-3&keywords=keyestudio+collision+sensor