Raspberry pi Security Camera (Live Stream) over Internet

Raspberry pi Security Camera

For this project, we are going to use raspberry pi and a camera module to stream the camera feed over WiFi and also over internet. This is an interesting project. With this, we can access the live camera feed from anywhere in the world on any device. The good thing about this project is that you need least number of components to work on and a very easy installation procedure. Again,for this, i would use any of the Raspberry pi 0 w or the Raspberry pi 3. But i prefer Raspberry pi 0 w as it is compact.


Parts:

1) Raspberry pi 0 wireless: Get one at Microcenter cheaper or order at Amazon. You can also use Raspberry pi 3. and a micro SD card.

2) Camera module: There are several camera modules available in the market. I chose this camera module because it is compact.

3) Power Supply for the board. We can power it in either directly using the wall outlet or a Portable power bank.

4) A Monitor, mouse and keyboard for the initial setup.

Installation:

For this project, we need the Noobs operating system. I have already given the step wise installation of Noobs in the previous blog: wireless usb hub Now that the Noobs operating system is up and running, we can proceed with the further installation.

Procedure:

Step 1: First we should be updating and upgrading the whole system.

sudo apt-get update
sudo apt-get upgrade

Step 2: Now, we need to make sure that the camera module is connected to the raspberry pi board the right way. I am using a pi 0 wireless board here as it is smaller in size and has WiFi and Bluetooth in it.

Step 3: Now, we make sure and install all the packages for the camera module to work on the raspberry pi board using terminal in the raspberry pi.

sudo modprobe bcm2835-v412
sudo nano /etc/modules
sudo reboot

Step 4: Make sure the pi camera is switched on in the raspberry pi configuration. Head over to start and go to raspberry pi config and select the camera to be on.

Step 5: Now we can start installing the packages. 

sudo apt-get remove libavcodec-extra-56 libavformat56 libavresample2 libavutil54
wget https://github.com/ccrisan/motioneye/wiki/precompiled/ffmpeg_3.1.1-1_armhf.deb
sudo dpkg -i ffmpeg_3.1.1-1_armhf.deb
sudo apt-get install curl libssl-dev libcurl4-openssl-dev libjpeg-dev libx264-142 libavcodec56 libavformat56 libmysqlclient18 libswscale3 libpq5
sudo apt-get install curl libssl-dev libcurl4-openssl-dev libjpeg-dev libx264-142 libavcodec56 libavformat56 libmysqlclient18 libswscale3 libpq5
sudo dpkg -i pi_jessie_motion_4.0.1-1_armhf.deb
sudo nano /etc/motion/motion.conf

Step 6: Now that we have installed all the packages, we need to edit the configurations so that the video projection is well on the browser. set daemon to on, stream_localhost to off, output_pictures to off, ffmpeg_output_movies to off, stream_maxrate to 100, framerate 100, width 640, height 480 and save the file.

Step 7: Now that we have the setting every way we need, we can start the file and launch it in the terminal. We use the following command to start the stream.

sudo service motion start

Step 8: We can also stop the service by the following command. It stops streaming the video.

sudo service motion stop

Step 9: We can also restart the stream using a restart command.

sudo service motion restart

Step 10: Now we can head onto a browser and just enter the IP address with the port number to watch the stream like : 192.168.1.xxx.8081. To find out the IP address there are several ways. we can use apps like Fing on the mobile to see all the devices connected to the network. We can also look into the router map to see the devices.

Step 11: To browse the stream over internet, we need to enable the port forwarding option in the router settings and give the internal IP address and internal port and find out an empty external port. Now, we should find out the public IP of the network.

Step 12: Now, after we have the public IP and the external port, we can use any device on any network entering the public IP:external port, we can watch the camera feed from anywhere.

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

Thanks for reading my blog. Hope this project worked out for you. If there are any difficulties or questions regarding this project or any other projects, please contact me at makersblog9594@gmail.com. You can also comment here. Please subscribe for several projects and hardware hacks.

Comments

Popular posts from this blog

Wireless USB Hub using Raspberry Pi

Scanner Radio for PC using SDR RTL