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.
- ๐ข Displays "No Vibration." otherwise.
๐ก Applications
- Earthquake or shock detection systems
- Industrial equipment monitoring
- Anti-theft alarms
๐ฏ เคเคฆ्เคฆिเคท्เค
เคต्เคนाเคฏเคฌ्เคฐेเคถเคจ เคธेเคจ्เคธเคฐ (SW-420) เคตाเคชเคฐूเคจ เคंเคชเคจ (vibration) เคเคณเคเคฃे เคเคฃि Raspberry Pi 3 เคตाเคชเคฐूเคจ เคคो เคกेเคा เคฎोเคเคฃे.
๐งฐ เคฒाเคเคฃाเคฐे เคธाเคนिเคค्เคฏ
เคเคเค | เคธंเค्เคฏा |
Raspberry Pi 3 | 1 |
SW-420 เคต्เคนाเคฏเคฌ्เคฐेเคถเคจ เคธेเคจ्เคธเคฐ | 1 |
เคंเคชเคฐ เคตाเคฏเคฐ्เคธ | เคเคฐเคेเคจुเคธाเคฐ |
เคฌ्เคฐेเคกเคฌोเคฐ्เคก | 1 |
⚡ เคธเคฐ्เคिเค เคเคจेเค्เคถเคจ
เคธेเคจ्เคธเคฐ เคชिเคจ | เคोเคกเคฃी |
VCC | 3.3V (Raspberry Pi เคตเคฐ) |
GND | GND (Raspberry Pi เคตเคฐ) |
D0 | GPIO27 (Pin 13) |
๐ง เคชाเคเคฅเคจ เคोเคก
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("๐ฅ เคंเคชเคจ เคเคขเคณเคฒे!")
else:
print("๐ข เคोเคฃเคคेเคนी เคंเคชเคจ เคจाเคนी.")
time.sleep(0.5)
except KeyboardInterrupt:
GPIO.cleanup()
๐ เคเคเคเคชुเค
- ๐ฅ เคंเคชเคจ เคเคฒ्เคฏाเคธ "เคंเคชเคจ เคเคขเคณเคฒे!" เคนा เคฎेเคธेเค เคฆिเคธเคคो.
- ๐ข เคถांเคคเคคा เค
เคธเคฒ्เคฏाเคธ "เคोเคฃเคคेเคนी เคंเคชเคจ เคจाเคนी." เค
เคธे เคฆाเคเคตเคคे.
๐ก เคเคชเคฏोเค
- เคญूเคंเคช เคिंเคตा เคงเค्เคा เคเคณเค เคช्เคฐเคฃाเคฒी
- เคเคฆ्เคฏोเคाเคคीเคฒ เคฏंเคค्เคฐांเค्เคฏा เคฆेเคเคฐेเคीเคธाเค ी
- เคोเคฐी เค
เคฒाเคฐ्เคฎ เคธिเคธ्เคीเคฎ्เคธ
Comments