This is one of the first projects I did with my Raspberry Pi. I wanted to see if I could make a completely wireless web cam and set it to stream over the internet. Below are the steps and items I used.
All items except for the Raspberry Pi were purchased from ebay.comRaspberry Pi Model B 512MB RAM5000mAh Solar Powered External Battery Dual USB For iPad/Mobile Phone/Tablet PC802.11n/g/b 150Mbps Mini USB WiFi Wireless Adapter Network LAN Card w/AntennaRaspberry Pi Case Raspi Enclosure Box with GPIO Access and Logo (optional)Logitech QuickCam for Notebooks Deluxe Laptop Webcam (Other web cams may work)
The first thing you want to do is get the Raspian Wheezy Image from here. Once you install it and boot up, you’ll come to a configuration screen.
Go to Expand_Rootfs to allow the operating system to use the entire SD card.
Go to SSH and Enable it. This will allow you to remotely shell into the OS to make configuration changes and get updates.
Save changes and reboot the Raspberry Pi.
Once booted up, you will want to download updates.
sudo apt-get update
This can take sometime to complete.
sudo apt-get upgrade
Type Y for yes and wait for the updates to download and install.
Next we want to setup the WiFi adapter. Shutdown the RPi with “sudo shutdown now” and plug in your WiFi adapter.
When booted up login and then type: sudo nano /etc/network/interfaces
We want to give the Raspberry Pi a static IP address so that we can access it remotely. Below is an example of my configuration. Yours may vary. I set the Ethernet port and the WiFi to the same IP address so that I can access it from the same IP even if it is connected via Ethernet or WiFi.
iface lo inet loopback
iface eth0 inet static
iface wlan0 inet static
Save your changes using Ctrl-O and shutdown the device.
Unplug the Ethernet cable.
You should see your static IP on the verbose screen “My IP address is xxx.xxx.xxx.xxx”
Verify that you are connected to the internet by typing: sudo ping -c 3 google.com
From this point on, I do the rest of the setup through SSH and PuTTy on a Windows machine.
Log into your RPi via PuTTy using the Pi’s static IP address.
Plug in your webcam.
Next we need to install the “motion” service. This is a package that contains everything you need to stream your cam over the internet and view it from any browser.
sudo apt-get install motion
Once the installation has completed we need to start the service.
sudo services motion start
If your web cam has a light on it, you should see it light up.
Now lets configure the motion software.
sudo nano /etc/motion/motion.conf
In here there are a few basic changes that you need to perform:
Daemon = OFF to ON
webcam_localhost = ON to OFF
webcam_port = desired port number or 8088
control_port = desired port number or 8089
To ensure that the motion service will actually start as a daemon we need to change another configuration setting, so enter the following:
sudo nano /etc/default/motion
Then change the value “start_motion_daemon=no” to “yes”
sudo service motion restart
You can now open up a browser from another computer on the same network and go to: http://192.168.0.85:8088 to view your web cam.
You can remotely control the web cam settings by going to http://192.168.0.85:8089.
Power off the RPi, hook up the battery pack and turn it on. You should now only have the WiFi adapter and web cam plugged into the usb ports. Try viewing the cam from a web browser and walk around your house or even outside.
You will need to enable port forwarding on your home broadband router to the Raspberry PI on port 8088, that will mean you can access the web cam from anywhere in the world. You can also sign up with a service like www.dyndns.org.