Create your own security recording system with Raspberry Pi and Foscam

Foscam and Raspberry Pi recording system

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

Setting up FTP server on Raspberry Pi

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.

Configuring Foscam

Getting IP from Foscam

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.

Foscam Access

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).

Foscam FTP configuration

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:

Foscam Alarm System

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.

22 thoughts on “Crea tu propio sistema de grabación de seguridad con Raspberry Pi y Foscam”

  1. Hi Alberto. I have a raspberry and a Foscam C2. I want to use the raspberry as ftp to store the images and photos I take. could it be set as continuous recording? could it be set to receive alerts of movement or sound of videos or photos at the same time as continuous recording or do I have to put two different folders?
    Let me explain. I have configured the raspberry as indicated in the tutorial.
    Then I went to the ip address of the foscam. I have to say that the configuration software of the foscam c2 is different to the images you have. I managed to set the ftp of the raspberry, the user and password and so on and I do the test and it comes out OK, but in your image the destination folder comes out. In the foscam software this box does not appear. They have it somewhere else (SAVE / DESTINATION) and the default folder is c:\ipcamrecord and there is no way to put the raspberry folder. When I click on save in foscam client, the default is c:\ipcamrecord again.
    I can't find a way to set the destination folder to the one on the raspberry.
    can you help me?
    Thank you

      1. Hi Alberto. Thanks for replying, but it's the same tutorial that you explain. It doesn't work for me, because despite doing the test and giving me everything correct, I still can't change the destination folder for the recording on the raspberry. I get by default the one for Windows when you download the Client Foscam tools in Windows, which is the folder c:\ipcamrecord.
        On the raspberry, rasbian system, the client foscam tools that works on Windows to configure the camera does not work.
        Thank you.

  2. Erik Daniel Gonzalez Lopez

    Sorry, are the cameras wireless to the rasberry, and are they for outdoor use?

    1. Alberto Navarro

      Yes, they are used when both devices are connected to the same network.

      And no, this is not an outdoor model.


  3. And if I want to connect 4 webcams via usb...does the Motion software support them? How would be the configuration? Thanks

  4. Good.
    I have tried to set up an ipcam, a Ciam to be precise.
    I have configured everything, and when I do the test I get the following error message.
    Test ... Error
    The file cannot be uploaded. Please make sure your account is authorised.
    What could it be due to, because the server connects, it must be an authorisation problem?
    Thank you.

Leave a Comment

Your email address will not be published.

Scroll to Top