Webcam

Raspberry PI as a remote IP Web Cam

Raspberry PI as a remote IP Web Cam

Note.: The Webcam is using USB 2.0 settings but the Amp-meter needs USB 1.1 settings on the Raspberry Pi, which means either you use remote current measurement or remote video surveillance. So far I have not found the good solution to make both work at the same time. For the current measurement it needs slower and absolute error free packets over the USB port. For webcam it needs fast data stream that USB 2.0 can provide.

The Raspberry PI is perfectly equipped to turn your USB based web cam into a fully functional IP web cam and you can use tools such as Python to make your project more unique.

If you just want to have a web cam that can be access from anywhere with an internet connection, then this is your guide.

You need:

- Raspberry Pi with a Wheezy OS installed
- USB Powered Hub
- USB webcam - I have a Logitech Quickcam Pro 9000 Webcam http://www.logitech.com/en-in/product/5867?crid=34

Usually need a powered USB hub because the camera’s draw more power than the Raspberry Pi can actually provide, you see the same with some keyboards and USB dongles. However my webcam works perfectly from the USB port of the Rasberry Pi.


1. Get the software ready

Ok so I am going to assume that you have a working PI on some kind of LAN with internet access, the next step as always is to update your PI ensuring you have the latest software and drivers installed.

sudo apt-get update
sudo apt-get upgrade

Now we need to install the software, we are going to be using a great little application called Motion, this will do a few things for us including accessing the USB cam, getting the images, and streaming them via a built in web server.

sudo apt-get install motion

2. Plug in your web cam

So now the software is on there it’s time to plug in the web cam and ensure that everything is working, ensuring that you plug it into the powered hub, and then into the PI. Otherwise the webcam will not get enough power to turn on.

When plugged in type the “lsusb” command, you should see a line there with your web cam manufacture, that proves that you have the basic connectivity working.

lsusb
....
Bus 001 Device 002: ID 04ea:1142 Microsoft Corp.
....

3. Configure the 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

You can change other settings but it’s recommend you don’t take more than 2 frames, and you been the default frame pixel size, for stability.

4. Start the software
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”

Finally you can start the motion service to stream the web cam images

sudo service motion start

Then after about 30 seconds browse to the new web interface, which should be at the below URL (where 192.168.0.100 is your Raspberry PI’s IP address)

http://192.168.0.100:8081



5. Final Tweeks

Web Port

You could change the web interface port to 80 (from the default 8081), so that you can just browse to the IP address without having to put :8081 at the end, it’s really simple to do, just:

sudo nano /etc/motion/motion.conf

And then change “webcam_port 8081″ to “webcam_port 80″, save the file, and restart the motion service.

sudo service motion restart


Port Forwarding:
Final suggestion is enable port forwarding on your home broadband router to the Raspberry PI on port 80, that will mean you can access the web cam from anywhere in the world. There are too many routers in the word to explain how to do it here, but I am sure you will find some help on Google.


back

Admin