We often need to monitor the outside of our home or to check activities of children inside a room.
In this post, I am going to demonstrate a simple Raspberry Pi project that uses any webcam to provide the option for live monitoring.
First, you will have to install an OS in the Raspberry Pi. You can choose any and flush that in a MicroSD card. Check my other post where I have provided the details of doing so.
Find IP address
Now, if you have connected your Raspberry Pi to your home network, we will have to obtain the IP address of the Pi. We can simply use the
nmap or any other IP scanner tool to find the IP address of the Pi.
$ sudo nmap -sP 10.0.0.0/24
Or if you are using a monitor, then skip it and avoid the following step (SSH) as well.
SSH into the Pi
Now, if you have your IP address, just SSH into the system.
$ ssh -p 2222 firstname.lastname@example.org
motion, which provides the option for live monitoring.
$ sudo apt-get install motion
Connect a webcam to the raspberry pi and find the webcam using the command
Now, we will have to configure
motion. Let’s open the file in an editor.
$ sudo nano /etc/motion/motion.conf
Now, change the following configurations:
- Make sure ‘daemon’ is ON.
- framerate $\rightarrow$ 1000 to 1500.
- Stream_port $\rightarrow$ 8081.
- Stream_quality $\rightarrow$ 100.
- Stream_localhost $\rightarrow$ OFF.
- webcontrol_localhost $\rightarrow$ OFF.
- quality $\rightarrow$ 100.
- width & height $\rightarrow$ 640 & 480.
- post_capture $\rightarrow$ 5.
Press ctrl + x to exit. Type y to save and enter to conform.
Now, open the following file and configure as follows:
$ sudo nano /etc/default/motion
- start_motion_daemon $\rightarrow$ yes
Use the following commands to run
$ sudo service motion restart $ sudo motion [444040:motion] [NTC] [ALL] conf_load: Processing thread 0 - config file /etc/motion/motion.conf [444040:motion] [NTC] [ALL] motion_startup: Motion 4.1.1 Started [444040:motion] [NTC] [ALL] motion_startup: Logging to file (/var/log/motion/motion.log)
Checking Live Feed
Now, you will be able to find the live by typing the following in your browser and enter.
If you want to see the live feed from outside, you need to configure port forwarding in your home router
That’s all for today. Cheers!