Even if it sounds complex – with a Raspberry Pi you can build a web server and a security camera very quickly. The exact procedure we explain in this article with a guide for how to build a surveillance camera in 10 steps.
Build a surveillance camera: Use Raspberry Pi to up your own web server
- It’s easy to use the Raspberry Pi as a web server, whether for classic websites or surveillance cameras.
- To do this, first execute the “ifconfig” command in the terminal and make a note of the IP that stands behind “inet addr:” in the section “eth0”.
- Then install Apache using the sudo apt-get install apache2 command. You should also install PHP and MySQL with the sudo apt-get install php5 mysql-server -y command.
- To load your own website into the server, use the command “sudo chown -R pi / var / www / html” to grant yourself access to the folder. In this folder you will already find a file called “index.html” that you can customize to your liking.
- To access the server, use a web-enabled device connected to your network to call the initially noted IP address in the browser.
Set up web server for surveillance camera – in 10 steps
- To build a surveillance camera with the Raspberry Pi, which is also accessible via a server, you will need the Raspberry Pi camera module, which you can plug into the dedicated port on the Pi.
- Then start the “Raspberry Pi Configuration” and activate the camera in the “Interfaces” tab.
- Install two small Video4Linux modules with the commands “sudo modprobe v4l2_common” and “sudo modprobe bcm2835-v4l2”.
- Then add them with the commands “echo” v4l2_common “| sudo tee -a / etc / modules «and» echo “bcm2835-v4l2” | Add sudo tee -a / etc / modules to the / etc / modules file.
- If you now use the ls / dev / video * command to display the video devices, the camera should also appear.
- In the next step, use the sudo apt-get install motion command to install a tool called Motion and edit the configuration file with sudo nano / etc / default / motion. In this “start_motion_daemon =” enter the command “yes” and save the file.
- In addition, create a new directory with the command “mkdir / home / pi / cam” and give it with the commands “sudo chgrp motion / home / pi / cam” and “chmod g + rwx / home / pi / cam” necessary rights.
- Now you have to edit the configuration file of Motion with “sudo nano /etc/motion/motion.conf”. Set the “daemon” to “on” here, select “/ home / pi / cam” as “target_dir” and set the “stream_localhost” to “off”. Tip: You can search for specific settings with [CTRL] + [W].
- Then select “width” as “640”, as “height” as “480” and “framerate” as “10” so that images are not delayed on slow Internet.
- Now select “5000” as the “threshold”, set “ffmpeg_output_movies” and “output_pictures” to “off”, set “8081” as “stream_port”, “75” as “stream_port” and “10” as stream_maxrate “10” ” firmly. Finally, set the “stream_motion” to “on”.
- Finally, start the surveillance camera with the command “sudo service motion start”. To access the stream, enter the noted IP, as well as the suffix “: 8081” behind it (as a port) in the browser.