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 generated 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

Getting Started


With Arduino

Connection

Here we will show you how this Grove - Piezo Vibration works via a simple demo. First of all, we need to prepare the below stuffs:

Seeeduino V4 Grove - Piezo Vibration Base Shield
enter image description here enter image description here enter image description here
Get ONE Now Get ONE Now Get ONE Now

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.
  • Connect the module to the A0 of base shield using the 4-pin grove cable, we use digital pin13 on board LED as output.
  • Plug the Grove - Basic Shield into Arduino.
  • Connect Arduino to PC by using a USB cable.

Software

  • Copy and paste code below to a new Arduino sketch.
const int ledPin=13;
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);
    }
}
  • Touch the piezo sensor to make it vibrate, of course, any way to make it vibrate will work. The LED will be on when vibration is detected. We can also Open the serial monitor to see the sensor outputs.

  • We can directly use a digital pin, take D5 of base shield as an example, and connect LED to Pin 13.
const int ledPin=13;
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

Connection

First of all, we need to prepare the below stuffs:

Raspberry pi Grove - Piezo Vibration GrovePi_Plus
enter image description here enter image description here enter image description here
Get ONE Now Get ONE Now Get ONE Now
  • Follow instruction to configure the development environment.
  • Plug the sensor to grovepi+ socket A0 by using a grove cable.

Software

  • 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"
  • 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.

Techsupport

For any technical issue, you are most welcome to contact techsupport@seeed.cc, our techsupport engineers will help you. Thank you!

Help us make it better

Welcome to the new documentation system of Seeed Studio. We have made a lot of progress comparing to the old wiki system and will continue to improve it to make it more user friendly and helpful. The improvement can't be done without your kindly feedback. If you have any suggestions or findings, you are most welcome to submit the amended version as our contributor via Github or give us suggestions in the survey below, it would be more appreciated if you could leave your email so that we can reply to you. Happy Hacking!