Home / Tutorials / Arduino Tutorial / Vibration Sensor Tutorial
SW-420 Vibration Sensor breakout board

Vibration Sensor Tutorial

Vibrations can be an indicator that trouble is coming. It can be your machine going haywire, a gear on a robot missing a teeth, or worse, a looming earthquake! In this vibration sensor tutorial, we will look at how to detect vibrations using especially designed sensors and an Arduino microcontroller.

There are two widely available vibration sensors in the market: SW-420 and 801S. I will discuss both of them here. Jump to SW-420 to skip my 801S discussion that follows.

801S Vibration Sensor

The 801S shock and vibration sensor, by itself, changes its resistance when subjected to vibrations. The resistance changes are so extreme that the 801S is like a switch. The datasheet claims that this gold plated device can withstand 60 million shocks. As with most resistance-varying devices, the 801S is connected in a voltage divider circuit to get a voltage output.

You can purchase standalone 801S sensors but I would recommend acquiring the breakout board shown:

801S vibration sensor breakout board

This board contains an LM393 op-amp IC (as a comparator) and a trimmer to adjust the sensitivity. The three pins are DOUT, + and -. The board accepts 5V power source and should be connected to the + and - pins. The DOUT pin produces a TTL signal that corresponds to the vibration on the 801S.

Sadly, the datasheet of the 801S doesn’t contain enough information especially on the sensor’s transfer function. The transfer function could have helped us determine how much force is needed for the sensor to trigger. Furthermore, this could have lead us to display the amount of vibration on the serial monitor or LCD.

What we can do is create an Arduino sketch based on whatever value the board is spewing when vibration is applied. We can then use this value as a limiting factor and then create a task whenever this factor is reached.

For example, my 801S board gives pulses every time I shake it. It’s hard to determine if the intensity of the shaking has any effect. What I know is that the board is giving a signal for every shake.

Here’s my wiring diagram followed by the sketch:

801s Vibration Sensor Arduino Diagram

Here, the serial monitor displays “The Titans are coming!” when I shake the board. Otherwise, “Tranquility is here” is displayed.

SW-420 Vibration Sensor

The SW-420 is another vibration switch that opens when vibration is detected and closes when there is no vibration. You may also buy standalone SW-420 devices but you’ll save time if you purchase this breakout board instead:

SW-420 Vibration Sensor breakout board

The breakout board contains an LM393 op-amp IC but it is used as a comparator and not an amplifier. Basically, the D0 pin goes high when there is vibration and goes low when there isn’t. You can adjust the sensitivity of the sensor by turning the trimmer on the board.

The board comes with two LEDs: one for power indication and one tied directly to D0. When the D0 pin is high, the D0 LED turns off and vice versa. Yeah, it’s the opposite of what we would like the LED to do.

My SW-420 breakout board gives a high pulse every time I give it a shake. I could use the pulse width to indicate that there is vibration going on. Here’s my wiring diagram and Arduino sketch:

SW-420 Vibration Sensor Arduino Diagram

I wrote the same messages when vibrations are detected similar to the 801S sketch.

801S vs. SW420

Assuming you don’t have any of these two yet, which vibration sensor should you get? The answer would depend on the intended project. But first, I would not recommend these sensors for detecting ground movement. There’s another sensor for that.

Speaking from experience, I find that the 801S is more sensitive to small movements compared to the SW420. But ultimately both can be used only as a vibration switch as there is no way you can measure the amount of vibration with any of these two devices.

Check Also

Using an Arduino Turbidity Sensor

Turbidity refers to the haziness of a fluid caused by the increased number of very …

Leave a Reply

Your email address will not be published. Required fields are marked *