I came across this project the other day and found it very interesting both to show you how to do it and to start distributing Foscam cameras, which it must be said, for chinese they are one of the best I've seen in terms of quality/price.. The idea is to create a closed recording circuit that can be accessed from anywhere, as we use Raspberry Pi as a switchboard for the cameras that we have configured.
Basically, what we will do is to order the cameras that when they detect movement, they save a capture via FTP in a specific folder on the Raspberry Pi.
The first step is common to almost all projects, we prepare the Raspberry Pi with RaspianI am not going to expand here because we have already explained it perfectly well in another article.
- Raspberry Pi
- uSD of 8Gb with Raspbian (it doesn't matter the capacity and the class as the ideal is to save the screenshots on an external HDD).
- Power supply
- Network cable.
- Foscam camera, in this case we have used the FI8909W model.
Note: There is no need for a video connection, because once the project has been set up, we can remotely manage the system via VNC Viewer.
Using Raspberry Pi as an FTP server
With this, the camera will automatically upload a series of captures to the server once it detects motion, i.e, we will automatically save on the hard disk that we put in the Raspberry Pi images of everything that happens in front of our Foscam.
To set up the FTP server on the Raspberry Pi the software we are going to use is VSFTPD. We open a terminal session and start updating repositories:
sudo apt-get update
And then installing the programme:
sudo apt-get install vsftpd
Once installed we will need to change some parameters, so:
sudo nano /etc/vsftpd.conf
We are looking for the following lines, remove the front cushions and press Ctrl+O to save.
This will allow reading/writing by users of the programme.
We restart the service:
sudo service vsftpd restart
The FTP server is now installed, so we can move on to configuring the camera itself.
From Windows, we download the IP Camera Tool to find out the IP address of our camerawhich must already be connected to our network for it to be detected. We run it (no installation required) and if all goes well, we will obtain the local IP of our camera or cameras.
We put the IP in our browser and access the login panel, enter the credentials, by default admin for the user and the empty pass. If we are using Chrome, Safari or Firefox, we choose Server Push ModeIf we are using Internet Explorer, we will use ActiveX Mode and if we are using a mobile phone, we will use Mobile Phone.
Now we will see the camera with some parameters that we can touch and we will have to look for the FTP settings (FTP Service Settings) at Device Management at the bottom left.
Once there, we introduce the Raspberry Pi IP (remember, from the Raspberry itself, you can get it using the command ifconfig), the username and password (Raspbian default), the username and password (Raspbian default pi / raspberry) and the directory in which you want to save the screenshots. In this last step I recommend you to create one on the desktop for testing purposes. and give it all permissions (right click Properties).
Once we have all this, we click on save in the Foscam menu and then click on TestIf it does not give us an error message, it means that it is correctly configured.
Configuring alert actions
Now we are going to configure the camera so that when it detects movement it automatically sends the captures to the directory we have chosen on our Raspberry Pi.
We enter Alarm Service Settings and we will see two options, to capture when detecting sound or when detecting movement. This is obviously a matter of personal preference, but my tests were done with motion detection and the following parameters:
Once I had it perfectly adjusted, I left it overnight to test it and to my surprise in the morning, my cat had taken a few walks in the early hours of the morning. You can see some of the pictures in the gallery below.
If we have several cameras we can create different directories for each of them and thus have a complete security network at home or in the company at a very low cost.