Sound Detector with Visual Alerts – AI-IOT – Free Course – Share Value – Internet Of Think

Sound Detector with Visual Alerts

THINGS USED IN THIS PROJECT

Hardware components:
475267 240424 01 front zoom kankcmvqdh
Raspberry Pi Raspberry Pi Zero Wireless
× 1
Sound Detection Sensor
× 1
12002 04
Breadboard (generic)
× 1
11026 02
Jumper wires (generic)
× 1
Software apps and online services:
ProwlPy script
Prowl for iOS

SCHEMATICS

Connections
Simply connect Power and Ground to GPIO pins(pin 4 for Power, pin 6 for ground) and signal to physical pin 12 on the PI0w.
Img 8578 hxiwyucv1k

CODE

Sensor.pyPython
Paste into examples folder of Prowlpy. Signup for a Prowl account, and add your Prowl API key to Sensor.py. Run via SSH or Terminal on Raspbian.
import time
import prowlpy
import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BOARD) # use board pin numbers
# define pin #12 as input pin
GPIO.setup(12, GPIO.IN)
apikey = '0123456789' #Dummy API-key)
p = prowlpy.Prowl(apikey)
time.sleep(20) #Startup Buffer to prevent false alarms

while 1:
    time.sleep(0.01)
    if GPIO.input(12)==1:
            print("Sound Heard!")
            p.add('OHNO','LOUD NOISES!!!',"Theres a good chance someone is awake and crying!", 2, None, "http://www.prowlapp.com/")
            time.sleep(10)

CREDITS

Thanks to Jacob Burch.

Share This:

Be the first to comment

Leave a Reply

Your email address will not be published.


*