Skip to main content


Shock Sensor Arduino Compatible

Arduino Compatible Shock Sensor


1 $2.95


This shock sensor uses a SW-18015P switch to detect shocks, vibrations and impacts. It can be used to build a simple LED circuit which lights up when an impact is detected.

The switch primarily consists of a terminal that forms a center post and a second terminal that is a spring that surrounds the center post. When a sufficient force is transferred to the switch, the terminal consisting of the spring moves and shorts both terminals together momentarily.

Generally the switch should be located as close as possible to the area being monitored. Otherwise, the vibration may be dampened by other structural components in your project. Conversely, if you find that the switch is too sensitive for your application try moving the switch further away from the area of interest to decrease sensitivity.

Test Code

int Led = 13; // define LED Interface
int Shock = 3; // define the vibration sensor interface
int val; // define numeric variables val

void setup () {
pinMode(Led, OUTPUT); // define LED as output interface
pinMode(Shock, INPUT); // output interface defines vibration sensor

void loop () {
val = digitalRead(Shock); // read digital interface is assigned a value of 3 val

// When the shock sensor detects a signal, LED flashes
if (val == HIGH) {
digitalWrite(Led, LOW);
else {
digitalWrite(Led, HIGH);


  • Detect shocks, vibrations and impacts
  • Digital switch output (0 & 1)


Operating Voltage

3.3 - 5.0V

Output Digital switch

(0 & 1)

Board Colour







Length (mm)


Width (mm)


Height (mm)



You Might Also Like

All prices are in Australian Dollars and include GST. GST will be removed from your order if you are ordering from outside Australia.
Products may differ from pictured.
All trademarks and trade names are the properties of their respective owners. Wiltronics disclaims any proprietary interest in trademarks and trade names other than its own.

Shock Sensor Arduino Compatible



We use cookies to ensure you have the best experience on our site. If you continue to use this site you consent to the use of these cookies. OK

Find out more in our Privacy Policy