Thursday, June 25, 2015

Setting Up Motion to Access a Webcam Over Your Local Network

In this tutorial we will use Motion to access a webcam connected to your Pi. When we are finished, you will be able to see a live stream of a camera on your local network.

Time: About 30 minutes.
Difficulty: Medium

You will need:

  • A way to access your Pi's terminal. SSH, works great because all you need is the command line.
  • A webcam.
  • An internet connection.
  1. Log in to your Pi and open the terminal.
  2. type sudo apt-get install motion
  3. sudo nano /etc/motion/motion.conf
  4. This will open a long configuration file.
  5. There are a couple of things you will need to change, but since the .conf file is so long, it can be helpful to use CTRL+W to find things.
  6. You will need to change daemon off to daemon on.
  7. You will also need to change webcam_localhost on to webcam_localhost off. This will make it so any computer on the network can access the stream, not just the Pi.
  8. You will also need to disable control_localhost by changing it from control_localhost on to control_localhost off.
  9. That should be it, just exit the nano editor and restart.
  10. You will need the IP address of your Pi. You can get it by typing hostname -I.
  11. In a browser, type the address and at the end, type :8081. You should see a live stream from your webcam. I have had problems with Google Chrome but Firefox works fine.