Introduction: Dog Bark Sensor

I recently got a new puppy and I wanted to know if he was barking when I left the house. I rigged this little hack together to send me a text message if he barks.

This is my first instructable so I'd like to apologize for any errors. If you could point them out in the comments I'll do my best to correct them. Thanks!

You'll need:

1) Raspberry Pi 2 I'm running it on Raspbian Jessie (I bet it will work on other models and OSs but I haven't tested it).

2) Breadboard.

3) MCP3008 ADC

4) Electret Microphone Amplifier - MAX4466 with Adjustable Gain (however, you won't use the adjustable gain).

5) A way to connect the Raspberry Pi to the network (I used an ethernet cable).

6) ~12 wires for the breadboard and GPIO pins.

Step 1: Update

You'll need to update your Raspberry Pi (RPi). Type into the terminal:

sudo apt-get update
sudo apt-get upgrade

Step 2: Wire MCP3008 and Enable SPI

Step 3: Software

cd ~
mkdir Pupnet
cd Pupnet/
    • Sprint
    • Verizon
    • T-Mobile
    • AT&T
    • AIM +1phonenumber
# python program to communicate with an MCP3008
# Import our SpiDe wrapper and out sleep function
import spidev
import os
# Establish SPI device on Bus 0, Device 0
spi = spidev.SpiDev(),0)
def getAdc (channel):
	#check for valid channel
	if ( (channel > 7) or (channel < 0) ):
		return -1
	# Preform SPI transaction and store returned bits in 'r'
	r = spi.xfer( [1, (8 + channel) << 4, 0] )
# Filter data bits from returned bits
	adcOut = ( (r[1] & 3) << 8 ) + r[2]
	# If adcOut is greater than 700 send a text via email through terminal
	if (adcOut > 700 ):
		os.system("echo 'WOOF! WOOF!' | mail")
while True:

Step 4: Set Up SMTP

The last step is to setup SMTP.

Follow the simple tutorial from here

To start up the service type into the terminal:

cd ~
cd Pupnet/
cd sudo python

You should have a working bark sensor now. If you need to adjust the sound level higher or lower play with the if statement in the code. If the number is higher than 700 the sound to set it off will need to be louder. If its lower than 700 the sound won't need to be so loud. Let me know if you have problems in the comments below.

if (adcOut > 700 ): ...

Step 5: Sources