Interfacing Vibration Sensor with Raspberry Pi 3 💥 🎯 Objective To detect vibration or shock using a Vibration Sensor module (SW-420) with Raspberry Pi 3. Useful in industrial machinery monitoring and security systems. 🧰 Components Required Component Quantity Raspberry Pi 3 1 SW-420 Vibration Sensor Module 1 Jumper Wires As required Breadboard 1 ⚡ Circuit Connections Sensor Pin Connect To VCC 3.3V (Pin 1 on RPi) GND GND (Pin 6 on RPi) D0 (Digital Out) GPIO27 (Pin 13) 🧠 Python Code import RPi.GPIO as GPIO import time VIBRATION_PIN = 27 GPIO.setmode(GPIO.BCM) GPIO.setup(VIBRATION_PIN, GPIO.IN) try: while True: if GPIO.input(VIBRATION_PIN): print("💥 Vibration Detected!") else: print("🟢 No Vibration.") time.sleep(0.5) except KeyboardInterrupt: GPIO.cleanup() 📊 Output 💥 Displays "Vibration Detected!" if vibration is sensed. 🟢 Displa...
|LEARN | EXPLORE | INNOVATE | I.O.T | A.I | ROBOTICS |