Introduction: Raspberry Pi Pet Monitor

This Instructable will guide you through the setup of a (mostly) headless Raspberry Pi based pet monitor. This pet monitor will alert you whenever your pet becomes noisy by sending a Pushbullet notification. Also, if you would like, you can speak to the pet by using Mumble (VoIP Service).

Step 1: Materials

  • Raspberry Pi B+ (Raspbian Wheezy 12.24.2014)
  • 3.5mm Speakers
  • Sparkfun Sound Detector
  • 100kOhm Potentiometer (optional)
  • Breakaway header pins
  • Soldering iron and solder
  • Breadboard
  • Jumper wires

Step 2: Prepare the Sound Detector

The sound detector has three outputs: gate, envelope, and audio. Currently this project only utilizes the binary gate output. In the future, the audio output may be used as well to allow the user to listen to the pet using Mumble. But before we can get that far the header pins must be soldered to the board.

The sound detector allows the user the adjust the sensitivity for the gate output by attaching a resistor across the two pins on the lower back half of the board. I connected right angle headers to these pins so that I could attach a potentiometer to adjust the sensitivity on the fly.

Step 3: Building the Circuit

The circuit for this system is fairly simple. The sound detector is grounded to a ground pin on the Pi and VCC is supplied by a 5V pin. I connected the gate pin to GPIO 0, however you can use whichever GPIO pin you like. If you use GPIO 0 there will be less code that you will need to modify later.

Pin reference for the library that will be used.

Another pin reference.

Optional: If you choose to connect a potentiometer across the gain pins, do so now.

Step 4: Setting Up the Environment

  1. Ensure that git is installed.
    1. If it is not, run the following
      1. dpkg - - get-selections | grep git
  2. Download the Wiring Pi library
    1. git clone git://
  3. cd to the "wiringPi" directory and run the build script (./build)
  4. Verify that the library has been setup by running "gpio readall"
    1. If the library is correctly set up a table should appear showing the state of all GPIO pins.
  5. Create a directory that will contain the pet monitor. I will use ~/monitor in this example.

Step 5: Setting Up Pushbullet

  1. Create a Pushbullet account and log in.
  2. Create a channel. Make sure that you remember the tag that you choose. This tag will allow you to send alerts to multiple people at once. This can be useful if you would like to notify an entire family or multiple roommates, etc.
  3. Go to Pushbullet account settings and make a note of your access token. We will use this later.

Step 6: Compiling the Source Code

  1. Place the above source files in the directory created in the last step (~/monitor)
  2. listen.c
    1. If you decided to use a GPIO pin other than pin 0 then all references to pin 0 must be changed in listen.c.
    2. Change the path in line 35 to reflect your file structure
      1. ex: int fd = open ("/home/pi/monitor/events.log", O_APPEND | O_WRONLY | O_CREAT, 0666);
    3. Compile listen.c by running the following
      1. gcc –Wall –o listen listen.c –lwiringPi

  3. and
    1. Compile javac
  4. Change permissions for
    1. chmod 777

Step 7: Setting Up Mumble Server and Client

  1. Install the server
    1. sudo apt-get install mumble-server
  2. Configure the server
    1. sudo dpkg-reconfigure mumble-server

    2. I would suggest having the server autostart with high priority to keep the audio quality high.

  3. Advanced configuration
    1. sudo nano /etc/mumble-server.ini

    2. Feel free to edit as much as you would like in this file, but I would suggest editing "serverpassword" at a minimum.

  4. Restart the service
    1. sudo /etc/init.d/mumble-server restart

  5. The server can now be joined by any device running a Mumble client.

  6. Depending on your network setup, ports may need to be opened manually on your router to allow access from outside of your LAN.
  7. Install the client
    1. sudo apt-get install mumble

Murmur (Mumble) Setup Guide

Step 8: Running the Monitor

  1. There are two ways to do this:
  • Run the monitor automatically when the Pi boots
  • Run it on demand

    But first, there are a few configuration options you should be aware of to prevent you from receiving Pushbullet spam. With this system you are able to define how often the sound detector can detect noise before alerting you. To do this, you have to specify both the number of times and the time window. These values will be used in the next steps.

    • Automatic execution at boot
      1. Edit /etc/rc.local (sudo nano /etc/rc.local)
      2. Under the comment, add the following
    sudo -u pi touch /home/pi/monitor/events.log
    sudo /home/pi/monitor/listen & cd /home/pi/monitor/
    sudo java monitor [YourPetsName] [NumberOfEvents] [TimePeriodInMin] [PushbulletAPIKey] [YourPushbulletTag] &
    • Manual
      1. Run the following
    cd ~/monitor
    touch events.log
    sudo ./listen &
    java monitor [YourPetsName] [NumberOfEvents] [TimePeriodInMin] [PushbulletAPIKey] [YourPushbulletTag] &

    Step 9: Connecting to the Mumble Server...from the Server

    So this may seem a little odd at first, but it makes sense! If you would like to be able to speak to your pet, you will need to connect to the server FROM the server. At the moment there doesn't seem to be a great way to join a Mumble server using only a CLI so this is the one area where this system isn't 100% headless.

    1. Connect to the Pi using a remote desktop client or by connecting the Pi to a monitor.
      1. A guide to configuring a remote desktop connection can be found here.
    2. Open mumble and follow configuration prompts. At this time, the project can not provide audio input.
      1. This step will only need to be preformed once.
    3. When prompted about audio out, select ALSA and sysdefault:CARD=ALSA...
    4. Connect to the Mumble server
      1. A guide can be found here.

    Step 10: Finished!

    That's it! You should now receive notifications from the system when your pet is being noisy. Feel free to open mumble and talk to them whenever you want! Feel free to email me with any questions or suggestions.