Introduction: PetBeHome: a Device That Lets You Talk to Your Furry Friend for Under $100

Picture of PetBeHome: a Device That Lets You Talk to Your Furry Friend for Under $100

So, one day and my friend were hanging out and he told me he had to go home early to go watch the dog because his dog had separation anxiety. It was unfortunate because there were no inexpensive ways to be able to talk to their dog for a few minutes so he could go back to finishing what he was doing without interruption. Then I jumped straight into brainstorming to find a solution to this major problem in the world. I designed a simple, efficient, and inexpensive way to talk and hear your dog.

What you will need:

Equipment you will need:

  • Computer
  • SD Card Reader/Writer
  • Mouse and Keyboard
  • Monitor with HDMI Cable
  • Skill
  • 3D Printer (Optional)

Be sure to vote me for my contests!

Step 1: Prepare Software for Formatting SD Card

Picture of Prepare Software for Formatting SD Card

To start this project off, we need to prepare all of the sot ware and tools that we will use. First you will want to download Win32 Disk Imager to be able to install the operating system on the Raspberry Pi. Then you will want to download the Raspberry Pi image with the PITFT built in for easy installation. With this done, we can now start working on formatting the storage unit for the Pi.

Step 2: Use Win32 Disk Imager to Make Format for SD Card

Picture of Use Win32 Disk Imager to Make Format for SD Card

Once both files are downloaded, plug in your SD or Micro SD into your computer. Open the zip folder with the raspbian and move the .iso file somewhere out of the zip file. WARNING: Make sure you have nothing important on the SD because the software will reformat it!!! You will need to run the Win32 software as administrator so the software has permission to change the SD card. It will guide you through an install wizard and I checked create desktop icon for ease of access. Once you run the application, you want to press the little folder icon which you select where you have the .iso file. Then you want to find what Drive letter you SD card is and put that in the box to the right of the folder icon. Moving on to the Hardware side...

Step 3: Plug the Raspberry Pi, Camera, and the Screen

Picture of Plug the Raspberry Pi, Camera, and the Screen

Once the Card is ready, you can plug the camera into the black header behind the Ethernet port. Then put screen on to the back pins on a Pi 2 & 3 or it will fit exactly on the Pi 1. The pictures can help if you are having trouble finding where to plug the connectors in.

Step 4: Setting the Camera Up

Source: PI surveillance Camera Instructable

Connect a USB keyboard, power the Raspberry Pi from a USB phone charger or powered hub, and work through the usual first-time boot configuration.

The following options are required:

Expand Filesystem

Enable Camera

Once you are done and are at the terminal, fetching the camera software is just a couple extra steps…

A good motion detection software with many configuration options is motion.We now need to install it using the command line through the screen:

sudo apt-get install motion

Some packages will be installed in the installation process; just type "y" to proceed with the installation.As the current version of motion does not (yet) support the Raspberry camera module, we need to download and install a special build with support for this camera module.

cd /tmp
sudo apt-get install -y libjpeg62 libjpeg62-dev libavformat53 libavformat-dev libavcodec53 libavcodec-dev libavutil51 libavutil-dev libc6-dev zlib1g-dev libmysqlclient18 libmysqlclient-dev libpq5 libpq-dev

wget https://www.dropbox.com/s/xdfcxm5hu71s97d/motion-mmal.tar.gz

And now you need to unpack the downloaded file to the /tmp directory:

tar zxvf motion-mmal.tar.gz

After this unzipping, you now need to update your installed motion with the downloaded build:

sudo mv motion /usr/bin/motion

sudo mv motion-mmalcam.conf /etc/motion.conf

You also need to enable the motion daemon so that motion will always run:

sudo nano /etc/default/motion

and change the line to:

start_motion_daemon=yes

We're pretty sure that the official build of motion will shortly also support the Raspberry camera module as well.A very important command to edit the motion configuration file is

sudo nano /etc/motion.conf

Note: in the standard motion installation, the motion.conf is in /etc/motion/, but in the special motion-mmal build from dropbox-url (see above) it's in /etc/. If you follow this tutorial with all steps, this is no problem at all.Be sure to have the file permissions correct: when you install motion via ssh while being logged in as user "pi", you need to make sure to give the user "motion" the permissions to run motion as service after reboot:

sudo chmod 664 /etc/motion.conf

sudo chmod 755 /usr/bin/motion

sudo touch /tmp/motion.log

sudo chmod 775 /tmp/motion.log

We've made some changes to the motion.conf file to fit our needs. Our current motion.conf file can be downloaded here. Just download, unzip and copy the containing motion.conf to /etc/motion.conf if you would like to use the exact config options we describe below.Some of the main changes are:Make sure that motion is always running as a daemon in the background:

daemon on

We want to store the logfile in /tmp instead (otherwise autostart user won't be able to acces it in /home/pi/ folder):

logfile /tmp/motion.log

As we want to use a high quality surveillance video, we've set the resolution to 1280x720:

width 1280

height 720

We don't need real-time video, 10 pictures per second are totally ok for our needs:

framerate 10

This is a very handy feature of the motion software: record some (2 in our configuration) frames before and after the motion in the image was detected:

pre_capture 10

post_capture 10

We don't want endless movies. Instead, we want to have max. 10 minutes slices of the motion videos. This config option was renamed from max_movie_time to max_mpeg_time in motion. If you use the motion-mmal build, this one will work. If you get an error 'Unknown config option "max_mpeg_time"' either change this one to max_movie_time or make sure to really use the motion-mmal build as shown above.

max_mpeg_time 600

As some media players like VLC are unable to play the recorded movies, we've changed the codec to msmpeg4. Then, the movies play correctly in all players:

ffmpeg_video_codec msmpeg4

Enable access to the live stream from anywhere. Otherwise only localhost (= the Raspberry device) would be allowed to access the live stream:

stream_localhost off

If you want to protect the live stream with a username and password, you should enable this:

stream_auth_method 2

stream_authentication SOMEUSERNAME:SOMEPASSWORD

All configuration parameters are explained in detail in the motion config documentation. After your changes to the motion.conf, reboot the Raspberry:

sudo reboot

After the reboot, the red light of the camera module should be turned on, which shows that motion currently is using the camera to detect any movement.

You can also turn off the camera red LED by adding this line to /boot/config.txt:

disable_camera_led=1

Step 5: Save Your Cute Videos for a Later Time (Optional)

Picture of Save Your Cute Videos for a Later Time (Optional)

As the SD card of the Raspberry Pi is a pretty limited resource, I have decided to let the Pi store the videos on a windows computer. This is pretty easy:

First share a folder from some Windows machine. Just follow some guides on the internet if you've never shared a folder from a Windows machine before. Then open the fstab configuration on your Raspberry from a PuTTY console or directly from the device:

sudo nano /etc/fstab

Now add an extra line with the configuration of your Windows network shared folder: //YOURSERVERNAME/YOURSHAREDFOLDERNAME /mnt/camshare cifs username=YOURSHAREDFOLDERUSERNAME,password=YOURSHAREDFOLDERPASSWORD,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0

Be sure that the user has the correct permissions to save files to that shared folder. After a reboot, the Raspberry should have an extra folder /mnt/camshare mounted to the Windows shared folder. You should now set in your motion.conf:

target_dir /mnt/camshare

so that motion saves all movies to the shared folder on the Windows machine.

An issue that can be fixed easily was that the Pi would not start the program because the Windows folder was not available.

A very quick fix solved our problem:

Just edit the motion file with

sudo nano /etc/init.d/motion

and add the line

sleep 30

to the start-sequence.

The changed /etc/init.d/motion script can be downloaded from here.

Step 6: Accessing the PETCAM

Picture of Accessing the PETCAM

Now you can access the live stream from the camera from any browser via the url http://IPADDRESSOFRASPBERRY:8080

Where 8080 is the port that we've configured for our stream in the motion.conf file. See your own configuration setting "stream_port" in motion.conf for the port.

To make the live stream accessible from anywhere, you will need to enable some kind of dynamic domain services to your local network. This will enable you to always be able to connect to your local IP address from the outside even if your local IP address changes.

Once you have set up the dynamic ip url, you can access the camera stream from anywhere in your browser (i.e. http://YOURDYNAMICDOMAIN:8080).

And this also works from the browser on your mobile device.

This is my cute neighbors dog, Iceman:

Step 7: 3D Printing a Case!

Picture of 3D Printing a Case!

You can print a case here at:

http://www.thingiverse.com/thing:244361

pitouch-top.stl
about 75 minutes
14g
Houses the camera and Raspberry Pi. Snaps to pitouch-bottom.
PLA @230
2 shells
15% Infill
2.0 Layer Height
90/150mm/s
pitouch-bottom.stl
about 70 minutes
13g
Houses the touch screen and Raspberry P.PLA @230
2 shells
15% Infill
2.0 Layer Height
90/150mm/s
pitouch-cover.stl
about 30 minutes
6g
Fits inside pitouch-top.stl. Raspberry Pi Camera press-fits to cover.PLA @230
2 shells
15% Infill
2.0 Layer Height
90/150mm/s
pitouch-tripod.stl
about 35 minutes
6g
Mounts to bottom of pitouch-top.stl and pitouch-bottom.stl2 shells
15% Infill
2.0 Layer Height
90/150mm/s
pitouch-band.stl
about 25 minutes
5g
Attaches to sides of pitouch-top.stl and pitouch-bottom.stl. Adds grip and keeps pitouch-tripod mounted to pitouch-top.stl and pitouch-bottom.stl.NinjaFlex @225
2 shells
15% Infill
2.0 Layer Height
90/150mm/s
pitouch-camring.stl
about 3 minutes
0.5g
Snaps to pitouch-top.stl camera hole. PLA @230
2 shells
15% Infill
2.0 Layer Height
90/150mm/s

Step 8: Going On...

There are a thousand things you can do with such a surveillance cam basic setup now. How about sending Growl notifications when some motion was detected? This guide explains how to add this functionality easily.

Or you could easily add a temperature-sensor to the cam. It's only a few bucks and can be integrated very easily.

What will you add? Let me know in the comments!

Be sure to vote me for my contests!

Comments

parisusa (author)2016-06-27

Does anyone remember answering machines? I knew a lady who called her cats everyday & talked to them over the machine. Not me! Honest!

About This Instructable

548views

14favorites

License:

Bio: Im just a regular 15 year old who likes to do random science and engineering experiments! If you have any questions about anything at all ... More »
More by TheEpicIronman:Passive Omni-Directional Acoustically Amplifying SpeakerAn Unusual Use of Alcohol to Extract DNA From CellsLED Chandelier Dress
Add instructable to: