Dog Bark Sensor





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



    • Pocket-Sized Contest

      Pocket-Sized Contest
    • Pro Tips Challenge

      Pro Tips Challenge
    • Paper Contest 2018

      Paper Contest 2018

    We have a be nice policy.
    Please be positive and constructive.




    When I try to start up the service in the terminal, i receive the following message:

    bash: cd: too many arguments

    What did I miss?


    Hello, this is a nice post. Thanks for the all the details. I just had a quick question in the code below. How do we say that if the adcOut is greater than 700 it is a dog bark ?

    # If adcOut is greater than 700 send a text via email through terminal

    if (adcOut > 700 ):
    os.system("echo 'WOOF! WOOF!' | mail")

    We don't. My dog's bark, at the time, was the loudest noise anyone ever really made in my house. So, I just set the magic number to 700 because pretty much any noise made in my house was never that loud. Unless, it was my dog barking.

    Hey dude, great project! Though i can't seem to see the circuit diagram.

    Okay I'll try to find it and get it back up.

    Thank you so much for the update!
    My friend and I are playing around with sensor networks and this was one of the only projects we found online that uses the same mic :)


    This is so cool! How often do you receive texts that your puppy is barking?

    He's crate trained pretty well, so he only barks when he needs to go poop/potty. It's saved me a messy clean up a few times.

    Great idea. Need to build this.