Piezo Vibration Sensor without hat

Hi Blu,



Thank you a lot for response. Indeed, I could detect the sensor that way.



By modifying your code, I have tried to use the RPi.GPIO Documentation to get an output:

[code]
import time
import RPi.GPIO as GPIO

SENSOR_PIN = 2
SENSOR_POUT = 3

GPIO.setwarnings(False)

GPIO.setmode(GPIO.BCM)
GPIO.setup(SENSOR_PIN, GPIO.IN)
GPIO.setup(SENSOR_POUT, GPIO.OUT)

while True:
if GPIO.input(SENSOR_PIN) == GPIO.HIGH:
print(“Detected”)
print(GPIO.output(SENSOR_POUT, GPIO.HIGH))

time.sleep(0.1)

[/code]

The output I get is:

The “None” is showing up independently if there is vibration or not. Is there a way to get any value out of the sensor as an output, that I can correlate to vibration?



Best regards,

David