Basic tutorial of how to setup a sound sensor with the Raspberry Pi.
PARTS:
RPI 3 – https://amzn.to/2VA9pQY
4 Amp Power Adapter – https://amzn.to/2CTptWu
16GB micro SD – https://amzn.to/2SFMwd3
120 pcs jumper cable: https://ebay.to/2VAb9cY
Sound Sensors: https://amzn.to/2FoZg4I
SCHEMATIC:
CODE:
#!/usr/bin/python import RPi.GPIO as GPIO import time #GPIO SETUP channel = 17 GPIO.setmode(GPIO.BCM) GPIO.setup(channel, GPIO.IN) def callback(channel): if GPIO.input(channel): print "Sound Detected!" else: print "Sound Detected!" GPIO.add_event_detect(channel, GPIO.BOTH, bouncetime=300) # let us know when the pin goes HIGH or LOW GPIO.add_event_callback(channel, callback) # assign function to GPIO PIN, Run function on change # infinite loop while True: time.sleep(1)
hey, what cable are you using for wiring the sound sensor to the rasberry pi and where can I buy it?
They are generic jumper cables, you can find them on amazon or ebay for a couple bucks. It’s actually listed above. 120 pcs jumper cable: https://goo.gl/spWoaC