Grove - Piezo Vibration Sensor

Introduction

3.3V 5.0V Analog

Grove- Piezo Vibration Sensor is suitable for measurements of flexibility, vibration, impact and touch. The module is based on PZT film sensor LDT0-028. When the sensor moves back and forth, a certain voltage will be created by the voltage comparator inside of it. A wide dynamic range (0.001Hz~1000MHz) guarantees an excellent measuring performance. And, you can adjust its sensitivity by adjusting the on-board potentiometer with a screw.

Features

  • Standard grove socket
  • Wide dynamic range:0.1Hz~180Hz
  • Adjustable sensitivity
  • High receptivity for strong impact

Tip

More details about Grove modules please refer to Grove System

Platforms Supported

Applications

  • Vibration Sensing in Washing Machine
  • Low Power Wakeup Switch
  • Low Cost Vibration Sensing
  • Car Alarms
  • Body Movement
  • Security Systems

Usage

With Arduino

The Grove - Piezo Vibration Sensor outputs a logic HIGH when vibration was detected. We can use any of Arduino pins to read the data. Here is an example of Piezo Vibration Sensor controlling LED. When the vibration was detected, this sensor outputs a logic high signal (the sensitivity can be changed by adjusting the potentiometer), an LED lights up.

Note

It may output low level even though originally output high level when you increase the threshold voltage by clockwise adjusting the potentiometer.

1.Connect the module to the Analog port 0 of base shield using the 4-pin grove cable and connect LED to Pin 12.

2.Plug the Grove - Basic Shield into Arduino.

3.Connect Arduino to PC by using a USB cable.

4.Copy and paste code below to a new Arduino sketch.

const int ledPin=12;
void setup() {
    Serial.begin(9600);
    pinMode(ledPin,OUTPUT);
}

void loop() {
    int sensorValue = analogRead(A0);
    Serial.println(sensorValue);
    delay(1000);
    if(sensorValue==1023)
    {
        digitalWrite(ledPin,HIGH);
    }
    else
    {
        digitalWrite(ledPin,LOW);
    }
}

5.Touch the piezo sensor to make it vibrate, of course, any way to make it vibrate would be OK too. The LED would be on when vibration detected. You can also Open the serial monitor to see the sensor outputs.

You can directly use a digital pin, take D5 of base shield as an example, and connect LED to Pin 12.

const int ledPin=12;
void setup() {
    Serial.begin(9600);
    pinMode(ledPin,OUTPUT);
}

void loop() {
    int sensorState = digitalRead(5);
    Serial.println(sensorState);
    delay(1000);
    if(sensorState == HIGH)
    {
        digitalWrite(ledPin,HIGH);
    }
    else
    {
        digitalWrite(ledPin,LOW);
    }
}

With Raspberry Pi

1.You should have a raspberry pi and a grovepi or grovepi+.

2.You should have completed configuring the development enviroment, otherwise follow here.

3.Connection

  • Plug the sensor to grovepi socket A0 by using a grove cable.

4.Navigate to the demos’ directory:

    cd yourpath/GrovePi/Software/Python/
  • To see the code
    nano grove_piezo_vibration_sensor.py   # "Ctrl+x" to exit #
    import time
    import grovepi

    # Connect the Grove Piezo Vibration Sensor to analog port A0
    # OUT,NC,VCC,GND
    piezo = 0

    grovepi.pinMode(piezo,"INPUT")

    while True:
        try:
            # When vibration is detected, the sensor outputs a logic high signal
            print grovepi.analogRead(piezo)
            time.sleep(.5)

        except IOError:
            print "Error"

5.Run the demo.

    sudo python grove_piezo_vibration_sensor.py

Resources


ArduinoWioBeagleBoneRaspberry PiLinkIt ONE

Caution

The platforms mentioned above as supported is/are an indication of the module's hardware or theoritical compatibility. We only provide software library or code examples for Arduino platform in most cases. It is not possible to provide software library / demo code for all possible MCU platforms. Hence, users have to write their own software library.

Help us make it better

Thank you for choosing Seeed. A couple of months ago we initiated a project to improve our documentation system. What you are looking at now is the first edition of the new documentation system. Comparing to the old one, here is the progresses that we made:

  • Replaced the old documentation system with a new one that was developed from Mkdocs, a more widely used and cooler tool to develop documentation system.
  • Integrated the documentation system with our official website, now you can go to Bazaar and other section like Forum and Community more conveniently.
  • Reviewed and rewrote documents for hundreds of products for the system’s first edition, and will continue migrate documents from old wiki to the new one.

An easy-to-use instruction is as important as the product itself. We are expecting this new system will improve your experience when using Seeed’s products. However since this is the first edition, there are still many things need to improve, if you have any suggestions or findings, you are most welcome to submit the amended version as our contributor or give us suggestions in the survey below, Please don’t forget to leave your email address so that we can reply.

Happy hacking