Introduction: How to Use a Vibration Sensor (shake Switch) - Arduino Tutorial

Picture of How to Use a Vibration Sensor (shake Switch) - Arduino Tutorial

In this tutorial we will use one vibration sensor (or shake switch) to make a beep sound from a buzzer while we shake our breadboard.

Watch a demonstration video:


Let's get started!

Step 1: What You Will Need

Picture of What You Will Need

For this tutorial you will need:

  • Arduino uno
  • Breadboard (or breadboard shield)
  • Buzzer
  • Vibration/shake sensor

Step 2: The Circuit

Picture of The Circuit

The connections are pretty easy, see the above image with the breadboard circuit schematic.

  • Connect one pin of vibration sensor to Arduino Analog pin A0 and the other to 5V pin.
  • Now connect the buzzer, one pin to Arduino pin 8 and the other to GND.

Step 3: The Code

Picture of The Code

Here's the code, embedded using Codebender!

Try downloading the Codebender plugin and clicking on the "Run on Arduino" button to program your Arduino board with this sketch. And that's it, you've programmed your Arduino with this sketch.

You can keep playing with that by clicking the "Edit" button and start making your own modifications to the code.

For example, try to change delay time or 1022 analog value see how it changes the program.

Press connect button below to start serial communication and start shaking the sensor.

Step 4: Well Done!

You have successfully completed one more Arduino "How to" tutorial and you learned how to use a vibration/shake sensor!

I hope you liked this, let me know in the comments.

There will be more of them, so make sure to click Follow button!

Find more useful Arduino Tutorials here

Comments

g7lfc (author)2017-10-11

Any idea where you can purchase the vibration sensor in the UK please?

Thanks.
Derek

rafaelnfs (author)2016-04-13

I boutgh module but only show me around values 417 or 420 max.

DIY Hacks and How Tos (author)2015-10-10

Great Tutorial! Shake Sensors are really useful for a lot of projects.

About This Instructable

31,323views

35favorites

License:

Bio: Arduino Tutorials by Codebender.cc Team
More by codebender_cc:How to use a magnetic door switch / sensor with ArduinoHow to Measure LUX With ArduinoHow to Control an RGB LED Strip - Arduino Tutorial
Add instructable to: