Raspberry Pi Remote Webcam




This will allow you to create a remote webcam for your Raspberry Pi so that you can view it from any computer on the local network. For this instructable you will need:

• Raspberry Pi with an Whezzy Raspbian installed and internet connection established
• Webcam (I use PS3 Eye Camera, but it will work with most USB webcams)
• IP address on your local network (this can be found with the command $ ifconfig and should be something like:

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Getting Started

Run up your Raspberry Pi to the command prompt

Install the webcam server software using the following command:
$ sudo apt-get install motion

This will take a few minutes to download and install but once it has finished and takes you back to the command prompt we are ready to continue.

Step 2: Configure the Software

Next we need to edit some of the config files so that the motion service will start on run up and be available on local network.

First we will edit the motion.conf file by typing:
$ sudo nano /etc/motion/motion.conf

This is quite a large conf file but the points you need to edit are:
DAEMON = OFF (change to ON)
Webcam_localhost = ON (Change to OFF)

Step 3: Set the Service Up

Next we need to enable the Daemon (service):
$ sudo nano /etc/default/motion

start_motion_daemon = no (change to yes)

Step 4: Start Her Up :)

Ensure your webcam is plugged into the usb port on your Raspberry Pi and start the service:
$ sudo service motion start

If you want to stop the service then use the command:
$ sudo service motion stop

 With the service started you can now open a webpage on your normal computer and by going to the IP of the Raspberry pi on port 8081 (in the address bar) you should be able to view your webcam (please note that the one in the picture shows port 8089 as I have set this up in the conf file. The default port is 8081):

I hope you have enjoyed this instructable and in the near future I will do a guide to allow you to view your webcam over the internet. The reason I have this is so I can connect my webcam to the eye piece of my telescope and transmit my astroviews over the web so friends and family can see the galaxy.

Raspberry Pi Contest

Participated in the
Raspberry Pi Contest

11 People Made This Project!


  • Made with Math Contest

    Made with Math Contest
  • Multi-Discipline Contest

    Multi-Discipline Contest
  • Robotics Contest

    Robotics Contest

135 Discussions


Question 6 months ago

I can't get Motion to run. No errors, just when I access the page, it says "Empty Response" in Chrome. When I try to take a picture with fswebcam, the camera turns on and stays on until I unplug it. video0 doesn't exist, though the camera is detected in lsusb, make and all. It doesn't save a picture either. How can I fix this?


Question 1 year ago

How can I make this work with the Pi Camera (MMAL camera)?

1 answer

Answer 6 months ago

This software is not for the Pi Camera. Check the Raspberry Pi documentation for more information on how to use it.


Question 1 year ago

I tried with Logitech webcam and it works but the dimensions of the picture in browser are just 176x144 regardless of settings. Any ideas how to use higher resolutions?


1 year ago

Good job it works on me


1 year ago


I got stuck when entering the IP address, I get an error of
page not found, any suggestions please? Thanks

2 replies

Reply 1 year ago

try to reboot. it sometimes helps.

Check you don't have a firewall blocking the port if you access from another computer.

sudo service ufw disable

But you also might want to try directly on localhost first with


Another port is provided for control


If that works check if the port is not redirected by a router in your network

You can edit the motion.conf file and change to another port. Don't forget to start/stop the motion daemon after the change.

Does you webcam works with other software ?


and see if your hardware is detected

You should see something similar:

Bus 001 Device 004: ID 046d:082b Logitech, Inc. Webcam C170

For some help see that page


on the webcam section


Reply 1 year ago

forgot to say the motion.conf file seems to have changed since this article has been posted the first time so llok for every occurence of localhost and turm them to off

# Restrict stream connections to localhost only (default: on)
stream_localhost off
# Restrict control connections to localhost only (default: on)
webcontrol_localhost off


1 year ago

great! it works like a charm


1 year ago

This is a good write up. Some things have worked for me and Moition is not to complicated. I needed a server for my webcam and raspberry pi3 so I can spy on my dogs and give them treats via my phones. Thanks for the help.


2 years ago

Linux Motion is cool. Also, check out the RPI-Cam-Web Interface project when you get a chance: https://elinux.org/RPi-Cam-Web-Interface


2 years ago

Hi, this is interesting and working but I want to edit the motion softwares index file where you see the image output. How to do that?


4 years ago

For the life of me I can not get this to work. I have followed the instructions to a T.. I have a logitech c310 which I see in lsusb so I know it's there. I finish the instructions and run sudo service motion start.... nothing happens. I figure maybe I should reboot the pi. It comes back up.. and the daemon appears to kick in.. lights on the cam!!! ...then a few seconds after the raspberry is back up and again nothing. sudo service motion start yields no results. I have the files edited correctly, and even turned localhost off for both streaming and management but 8080 and 8081 show nothing. Help? Other options?

7 replies

Reply 3 years ago

Hi! I had the same problem and, like others in this thread, noticed that the webcam turned off when motion was detected. The motion config file is set to save pictures when motion is detected. Since I didn't want to store photos nor videos, I disabled these options by setting output_pictures off and ffmpeg_output_movies off in the config file. This allowed the camera to stream without a problem. Jarrad's solution to give permissions to the directory would probably work if you wanted to store pics/videos.


Reply 2 years ago

Thanks Ricardo. I've been going through so many pages for the past hour because the webcam stopped streaming after a few seconds. Your fix is working for me. And what JarradD2 below said made sense. "Motion" module doesn't have permission to save photos/videos. I don't know how to give permission so I'm following your route.

Folks, if you want this to work, make sure you got the following settings correct for /etc/motion/motion.conf:
output_pictures off (default on)
ffmpeg_output_movies off (default on)
stream_localhost off
daemon on
stream_maxrate 100
framerate 100
weight xxx
height xxx

webcam_localhost is an outdated variable. The new one is now called stream_localhost


Reply 3 years ago

I think motion is crashing right after it starts- mabe something in your config doesn't match the webcam, like the resolution (called width and height).

I have a Logitech c310 and I know it does work also maybe try reinstalling motion after an "apt-get update"


Reply 3 years ago

I had a similar problem until I placed the camera in a position where there was no motion for it to detect. I'm thinking the motion detection is too resource hungry for the Pi?


Reply 3 years ago

Got it going on mine, you need to make sure it has permissions for the directory where it saves the photos/videos. I found this out in the syslog. And make sure you have ffmpeg installed