Make a Raspberry Pi Baby Monitor

RaspberryPi_LogoThe Raspberry Pi is an incredible tool which can be used for a variety of projects. It handles many tasks well, but is not meant to serve as a powerful desktop PC or replace a multi-core server. Since I don’t want to buy a baby monitor that will do what I want it to do (and I want to tinker around with the Pi), I am going to make one myself.

What you will need for this project (for specific details see minimum requirements page 2):

The next section explains the steps necessary to prepare the SD card with the Linux operating system.

  1. Download the Raspbian Wheezy image (Linux distribution specifically for Raspberry Pi). I recommend doing this first because it might take a while depending on your internet speed.
  2. Download and install the SD card formatting tool.
  3. Follow these instructions to format the SD card.
  4. Unzip downloaded Raspbian wheezy image.
  5. Write the extracted image file to the formatted SD card using this utility.
  6. Slide the SD card into the Raspberry Pi’s SD card slot.

Now we will connect to the Raspberry Pi and begin configuration. You will need a terminal emulation client such at Putty to connect to your Raspberry Pi via SSH.

  1. Connect your raspberry pi to power.
  2. Connect your raspberry pi to your local network.
  3. Using a terminal emulation client such at Putty, connect to your Raspberry Pi via SSH. (You will need to know the IP address of your Raspberry Pi. I found mine by checking the DHCP logs of my home router.)

ssh putty window

The default username of the raspberry pi is “pi” and the password is “raspberry”.

ssh username password

This is what the SSH connection looks like after you login.

ssh command line

Update your Raspberry Pi to get the latest software and drivers using these two commands:

  1. sudo apt-get updatesudo apt-get updatesudo apt-get update done
  2. sudo apt-get upgradesudo apt-get upgrade sudo apt-get upgrade done

Install and configure the free linux software “motion”:

sudo apt-get install motionmotion install install motion in progress install motion in progress 2

The following warning will appear at the end of the installation:

“[warn] Not starting motion daemon, disabled via /etc/default/motion … (warning).”motion install done

There is a change we must make in order to allow the daemon to start automatically. Enter the command:

sudo nano /etc/default/motionedit config

Change the value “start_motion_daemon=no” to “yes”

Press “Ctrl” + “X” to exit. Press “Y” to save and “Enter” to continue.

Connect your USB webcam. You may need to connect your webcam to a USB powered hub so it can get enough power to turn on.  Type the command:

lsusblshub

You should see console output indicating that the device was recognized by the operating system. You should be able to see the webcam manufacturer name such as

“Bus 001 Device 004: ID 046d:0802 Logitech, Inc. Webcam C200”.

Now we will configure the motion software. Enter this command to edit the configuration file:

sudo nano /etc/motion/motion.conf

Change “Daemon = OFF” to “ON” and “webcam_localhost = ON” to “OFF”

motion.confdaemon onwebcam_localhost off

Press “Ctrl” + “X” to exit. Press “Y” to save and “Enter” to continue.

Start the motion software:

sudo service motion startsudo service motion start service started

After about 30 seconds, browse to the web interface of your raspberry pi by entering this URL:

http://192.168.1.24:8081

You should see an image that refreshes about twice per second.

sample frame

REMEMBER: Change the IP address from my example to whatever the Raspberry Pi’s local IP address is on your network!

NOTE: I first tried to access the web interface using Google’s Chrome browser and it didn’t work. Neither did Internet Explorer. Mozilla Firefox did work. It has to do with support for moving jpeg images.

Additional customizations:

Open the configuration file

To make the camera title appear, edit the motion.conf file:

sudo nano /etc/motion/motion.conf

Find the line “; text_left CAMERA %t” and remove semicolon and space. Restart motion service:

sudo service motion restart

I also decided to make my video feed externally accessible. I had to do this by logging into my home router. In the firewall settings I had to direct external requests on port 80 to the internal IP address for the Raspberry Pi. I would detail the process here but it varies by router manufacturer. Now I can enter the external IP address of my home router on my iPhone’s browser and it will bring up the video feed.

This page provided significant inspiration to me:

http://pingbin.com/2012/12/raspberry-pi-web-cam-server-motion/

This is a good two-part youtube tutorial on customizing the config file:


Posted in DIY, Linux, Raspberry Pi Tagged with: , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*



Categories