Vibration Sensor

../../../../_images/vibration_sensor_h.png

Overview

Used for detecting object vibration. It can sense weak vibrations of objects and outputs a high level when triggered.

Technical Specifications

Operating voltage: VCC 3.3V -5V

Module dimensions: 24*48mm

Mounting: 2 plastic building block compatible through-holes

Data type: Vibration–1 Still–0

Pin Definition

Pin

Definition

GND

Ground

VCC

Power

DO

Digital output

NC

Not connected

Example Code

When the vibration sensor is triggered, the mPython Board RGB LED lights up.

from mpython import *

p0 = MPythonPin(0, PinMode.IN)

import time

def boolean_P0():
    return p0.read_digital() == 1
while True:
    if boolean_P0():
        rgb.fill((int(255), int(0), int(0)))
        rgb.write()
        time.sleep_ms(1)
        time.sleep(1)
    else:
        rgb.fill( (0, 0, 0) )
        rgb.write()
        time.sleep_ms(1)
../../../../_images/vibration_sensor.png