Crash Sensor - Help

Guys,

I have bought this Crash Sensor device from AliExpress: http://www.aliexpress.com/item/Free-Shipping-For-Arduino-Car-Helicopter-Crash-Collision-Sensor-Switch-Module-Robot-Model/32292724764.html

Just have a small query, on connecting the Crash Sensor with ICSP pins of Arduino; the LED of Crash Senor shows that it is connected however if it is plugged in any other pins of Arduino it seems that Crash Sensor didn't respond. Can anyone help me in explaining me the right pins, design or how to go about it.

Would highly appreciate your support.

Your program must read the pins connected to the device, which is just a switch.

Actually this is the program which I have written just to check its responsiveness:

int Led = 10; // define LED Interface
int buttonpin = 8; // define the collision sensor interface
int val ; // define numeric variables val
void setup ()
{
pinMode (Led, OUTPUT) ; // define LED as output interface
pinMode (buttonpin, INPUT) ; // output interface defines the collision sensor
}
void loop ()
{
val = digitalRead (buttonpin); // digital interface will be assigned a value of 12 to read val
if (val == HIGH) // When a collision sensor detects a signal, LED flashes
{digitalWrite (Led, HIGH);}
else
{digitalWrite (Led, LOW);}
}

If I put it in this config as VCC=5V pin of Arduino, Output=GND and Ground = GND it does respond as in attached picture

IMG_20151223_000018_HDR[2]-min.jpg

Why are you connecting the output to ground? This is the pin the device give the signal to your Arduino. It needs to go to a digital input and will probably require a pull up R.

Weedpharma

You need a short delay so the led stays on long enough to see, also make sure you have a resistor(330 - 680 ohms) in series with the LED and the LED polarity is right (long leg is +).
Well, according to AliExpress page, the output is LOW when a crash occurs so reverse your logic.

void loop ()
{
val = digitalRead (buttonpin); // digital interface will be assigned a value of 12 to read val
if (val == LOW) // When a collision sensor detects a signal, LED flashes
{digitalWrite (Led, HIGH);
delay(100);}
else
{digitalWrite (Led, LOW);}
}

I think he is trying to control the LED on the crash sensor board.
I don't think it is intended to be used that way.
The LED on the sensor is only to indicate that the switch is on, it is not
a LED to be controlled by the adruino.
You need to cable the VCC pin to a +3.3V or +5V, depending on your
processor, the GND cabled to a ground and the OUT pin to an input.
It is possible to use the I/O pins as a power source and ground, since the power
requirements are so low.. It does use up 3 I/O pins though. That way you can
plug it straight into the board without cables.
You can take three sequential pins.

byte Plus = 10; // power lead
byte Ground = 9
byte ButtonPin = 8; // define the collision sensor interface
byte Val ; // define numeric variables val
byte Led = 13;
void setup ()
{
pinMode (Plus, OUTPUT) ; // for power
digitalWrite(Plus,HIGH);
pinMode (Ground,OUTPUT) ; // for power ground
digitalWrite(Plus,LOW);
pinMode (buttonpin, INPUT) ; // output interface defines the collision sensor
pinMode (Led,OUTPUT) ;
digitalWrite (Led,HIGH);
}
void loop ()
{
val = digitalRead (buttonpin); // digital interface will be assigned a value of 12 to read val
if (val == LOW) // When a collision sensor detects a signal, LED flashes
{digitalWrite (Led, HIGH);}
else
{digitalWrite (Led, LOW);}
}

You might modify it so the LED on the boards stays on for some time on a momentary
crash like this, just for fun.

byte Plus = 10; // power lead
byte Ground = 9
byte ButtonPin = 8; // define the collision sensor interface
byte Val ; // define numeric variables val
byte Led = 13;
void setup ()
{
pinMode (Plus, OUTPUT) ; // for power
digitalWrite (Plus,HIGH);
pinMode (Ground,OUTPUT) ; // for power ground
digitalWrite (Plus,LOW);
pinMode (buttonpin, INPUT) ; // output interface defines the collision sensor
pinMode (Led,OUTPUT) ;
digitalWrite (Led,HIGH);
}
void loop ()
{
val = digitalRead (buttonpin); // digital interface will be assigned a value of 12 to read val
if (val == LOW) // When a collision sensor detects a signal, LED flashes
{digitalWrite (Led, HIGH);
pinMode (buttonpin,OUTPUT) ; 
digitalWrite (buttonpin,LOW);
delay(2000);
pinMode (buttonpin, INPUT) ;
}
else
{digitalWrite (Led, LOW);}
}

Both pieces of code are untried. Use at your own risk.
Dwight

This just has worked ..many thanks... Crash sensor's LED does blink when it is triggered ... however Arduino LED flashes off at that instant ... and when i serial.print the output it gives me ... 'OFF' ... and When I release sensor's button it gives me 'ON'

musa786:
This just has worked ..many thanks... Crash sensor's LED does blink when it is triggered ... however Arduino LED flashes off at that instant ... and when i serial.print the output it gives me ... 'OFF' ... and When I release sensor's button it gives me 'ON'

Do you want help with code? If so, post the code you're using.

can I use this sensor to detect car accident?