• First Steps
  • General
  • Projects
Facebook Twitter YouTube
Tutorials for Raspberry Pi Tutorials for Raspberry Pi
  • Hardware & GPIO
  • Sensors & Components
  • Scale
  • Cases
  • Fingerprint
  • Gas Sensor
  • Heartbeat
  • German
  • French
Tutorials for Raspberry Pi Tutorials for Raspberry Pi
Home»Hardware & GPIO»Raspberry Pi Security Camera with Webcam

Raspberry Pi Security Camera with Webcam

Facebook Twitter LinkedIn Tumblr Email Reddit
Raspberry Pi Überwachungskamera
Share
Facebook Twitter LinkedIn Email Tumblr Reddit Telegram WhatsApp

A Raspberry Pi surveillance camera can be a cheap alternative to common variants like IP cameras. An ideal Raspberry Pi camera module represents normal webcams that can be used as well, connected via USB.

This tutorial shows how to use a webcam with the help of the software fswebcam. In addition, I show different settings for the perfect result.

 

Accessories

Only the following things are needed:

  • Raspberry Pi (internet access is required to view images everywhere, so it does not work with Model A)
  • USB Webcam (the price does not matter, you can also take the cheapest model. Almost all webcams are recognized.)

 

It’s best to connect the webcam before starting the Pi via USB. We use the software fswebcam, which recognizes almost all webcams. First we install it:

sudo apt-get install fswebcam

Everything is set up automatically. You can already take a picture now. With

fswebcam image.jpg

you will take a picture named “image.jpg” in the directory where the shell is currently located (for example, main directory). If you are connected via SSH you will not be able to view the image immediately, you must connect via FTP (instructions here) and open the corresponding image. If you work directly on the Pi, you can just open the directory and view the picture.

 

Other Commands – Raspberry Pi Security Camera

You have certainly noticed the bar with the date below. You can remove this by specifying the following option:

fswebcam --no-banner image.jpg

 

The resolution is also very easy to change. For this, however, you should pay attention to the resolution of your camera, so as not to get a distorted picture:

fswebcam -r 480x320 image.jpg

 

Another useful command is to skip the first frame, as the webcam will usually adjust brightness, etc. You can also skip multiple frames, but it takes longer to record:

fswebcam --skip 1 image.jpg

 

Of course, you can also combine these and other commands, e.g.:

fswebcam --no-banner -r 480x320 --skip 1 image.jpg

PS: If you have several webcams connected, you can choose the device from which the picture should be taken:

fswebcam --device /dev/video0 image.jpg

You can find the number by means of fswebcam –list-inputs (under “available inputs” is the number and the name).

camera CCTV camera fswebcam usb webcam
Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
Previous ArticleRaspberry Pi Traffic Light Circuit with GPIO Part 2
Next Article Use a Joystick on the Raspberry Pi (with MCP3008)

Related Posts

How to build a ESP8266 Scale (with Weight Sensor HX711)

How-To: Bluetooth Connection between ESP32’s and Raspberry Pi’s

How to create a Solar Powered Raspberry Pi Bitcoin Miner

How to build a Smart Agriculture System using IoT

6 Comments

  1. themsks on 28. November 2019 8:08

    This is not at all a security camera! Waste o time..

    Reply
  2. David Francis on 18. January 2021 13:21

    This isn’t a webcam, it’s a digital still camera.
    I want to be able to show continuous video on my 3.5″ GPIO screen.

    Reply
    • Ruud on 27. May 2021 22:04

      Me too, is it possible???

      Ruud.

      Reply
  3. polatalemdar on 2. February 2022 20:34

    check motion library for raspberry pi

    Reply
  4. steph on 26. September 2022 15:21

    nice tool, organized with a CronTab, and upload to a FTP server, it do the job, no need more 🙂

    Reply
  5. MrMarcie on 7. November 2023 18:14

    “USB Webcam* (the price does not matter, you can also take the cheapest model. Almost all webcams are recognized.)”

    I bought cheapest cam and does not work. Not recognized. Also no on my PC, Windows & Linux. So not all work. Now I found this list, maybe that helps: https://elinux.org/RPi_USB_Webcams

    Reply

Leave A Reply Cancel Reply

Remote Control a Raspberry Pi with 433Mhz Radio Transmitter

Develop Your Own Raspberry Pi Alexa Skill and Control Pi Remotely

Raspberry Pi Stepper Motor Control with L293D / ULN2003A

Control Raspberry Pi Robots via Infrared Remote Control (Part 3)

Telegram Messenger on the RaspberryPi

Raspberry Pi Robot Kit – Assembly (Part 1)

Subscribe to Blog
Subscribe to Raspberry Pi Tutorials and don't miss any new Tutorial!
Subscribe

Thank you!

We will contact you soon.

Tutorials for Raspberry Pi
Facebook Twitter YouTube
  • Contact & Disclaimer

Type above and press Enter to search. Press Esc to cancel.