Hackster is hosting Hackster Holidays, Finale: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Tuesday!Stream Hackster Holidays, Finale on Tuesday!
Dave Able
Published © GPL3+

Sound Detector with Visual Alerts

Create a WiFi-enabled sound detector that sends your phone notifications using Prowl and Python!

BeginnerFull instructions provided1.5 hours10,213
Sound Detector with Visual Alerts

Things used in this project

Hardware components

Raspberry Pi Zero Wireless
Raspberry Pi Zero Wireless
×1
Sound Detection Sensor
×1
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

ProwlPy script
Prowl for iOS

Story

Read more

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.

Code

Sensor.py

Python
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

Dave Able
0 projects • 0 followers
Thanks to Jacob Burch.

Comments