Raspberry pi camera connection. Making a Wireless Spy Camera with Raspberry Pi. Enable camera support in Raspbian

Good day!

On New Year's Eve, I had the idea to build some kind of video surveillance. I had everything I needed on hand:

  • Raspberry Pi Model B single board computer
  • Webcam LOGITECH HD Webcam C270
After reading, I decided to develop the author’s idea a little.
Acquaintance
So, first, let's get acquainted with the main “component”:
Raspberry Pi appearance:

Specifications:

  • Broadcom BCM2835 700MHz ARM1176JZFS processor with FPU and Videocore 4 GPU
  • GPU provides Open GL ES 2.0, hardware-accelerated OpenVG, and 1080p30 H.264 high-profile decode
  • GPU is capable of 1Gpixel/s, 1.5Gtexel/s or 24GFLOPS with texture filtering and DMA infrastructure
  • 512MB RAM
  • Boots from SD card, running a version of the Linux operating system
  • 10/100 BaseT Ethernet socket
  • HDMI video out socket
  • 2 x USB 2.0 sockets
  • RCA composite video out socket
  • SD card socket
  • Powered from microUSB socket
  • 3.5mm audio out jack
  • Raspberry Pi HD video camera connector
  • Size: 85.6 x 53.98 x 17mm"
pi@hall-pi ~ $ cat /proc/cpuinfo processor: 0 model name: ARMv6-compatible processor rev 7 (v6l) BogoMIPS: 2.00 Features: swp half thumb fastmult vfp edsp java tls CPU implementer: 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part: 0xb76 CPU revision: 7 Hardware: BCM2708 Revision: 000e Serial: 000000005a82c372

A list of officially supported distributions can be found. I chose Raspbian without a graphical shell.

The installation process is quite simple and does not need a detailed description, so I will list the main facts that are worth paying attention to:

  1. Setting the time zone
  2. Setting the computer name
  3. Enabling SSH access
  4. System update
After completing all the necessary settings, you can begin.
Preparation
First, let's install all the necessary packages:
sudo apt-get install imagemagick libav-tools libjpeg8-dev subversion
Then download and assemble mjpg-streamer:
sudo svn co https://svn.code.sf.net/p/mjpg-streamer/code/mjpg-streamer/ mjpg-streamer cd mjpg-streamer make
Because We will store all data in the cloud, we will set up work with a remote file system via WebDAV:
sudo apt-get install davfs2 sudo mkdir /mnt/dav sudo mount -t davfs https://webdav.yandex.ru /mnt/dav -o uid=pi,gid=pi
In order not to enter your username and password every time, you need to add them to the file
/etc/davfs2/secrets
/mnt/dav user password
Workflow
Let's add commands to /etc/rc.local to mount WebDAV and run the script for broadcasting to the network:
mount -t davfs https://webdav.yandex.ru /mnt/dav -o uid=pi,gid=pi cd /home/pi/mjpg-streamer && ./mjpg_streamer -i "./input_uvc.so" -o "./output_http.so -w ./www"
Now, by going to http://:8080/ we will get access to the camera. All that remains is to forward the port on the router and you can access the camera outside the local network.
Creating timelapse video
First of all, we need to get an image from the camera. Because it is already occupied (the image is broadcast by the web server), then we will use the opportunity to obtain the current image from the web server:
curl http://localhost:8080/?action=snapshot > out.jpg
If we want to draw the date of the photo on the image, then we can use the convert command
timestamp=`stat -c %y out.jpg` convert out.jpg -fill black -fill white -pointsize 15 -draw "text 5.15 "$(timestamp:0:19)"" out_.jpg
Full version of the script:
#!/bin/bash filename=$(perl -e "print time") foldername=$(date --rfc-3339=date) curl http://localhost:8080/?action=snapshot > $filename timestamp=` stat -c %y $filename` mkdir /mnt/dav/out/$foldername convert $filename -fill black -fill white -pointsize 15 -draw "text 5.15 "$(timestamp:0:19)"" /mnt /dav/out/$foldername/$filename.jpg rm $filename
The video is assembled using the avconv command:
avconv -r 10 -i %06d.jpg -r 10 -vcodec mjpeg -qscale 1 out.avi
Full version of the video assembly script:
#!/bin/bash filename=$(date --rfc-3339=date) i=0 for f in `ls -tr /mnt/dav/out/$filename/*.jpg 2>/dev/null` do newf=`printf %06d $i`.jpg echo $f "-->" $newf mv $f $newf i=$((i+1)) done rmdir -R /mnt/dav/out/$filename/ avconv -r 10 -i %06d.jpg -r 10 -vcodec mjpeg -qscale 1 /mnt/dav/$filename.avi rm *.jpg
Now all that remains is to register the execution of scripts in the Cron scheduler:
* * * * * pi bash /home/pi/cam.sh 59 23 * * * pi bash /home/pi/build.sh
Example video
Conclusion
This approach helps eliminate the need to spend a lot of time watching videos, and also reduces the cost of the final product. Thanks to the presence of a full-fledged OS, it becomes possible to expand the functionality in the right direction.

Published 12/03/2014

Camera Matrix 5MP, the camera has a fixed focus lens and allows you to take photographs with resolution 2592×1944. Video: 1080p, FPS: 30 fps, 720p at 60 fps and 640x480 up to 90 fps. The camera is fully supported by the Raspbian operating system.

Connecting the camera

Be careful! Static electricity can damage the camera! The camera module is connected to the Raspberry Pi using a flexible cable into the connector, which is located between Ethernet And HDMI.

First, pull out the connector lock and insert the flexible cable with the contacts facing the HDMI connector. The train should go in without effort. Then clamp the cable with the clamp, carefully inserting it into the connector.

The camera weighs about 3 grams and is miniature in size. To properly secure the camera, I recommend making any holder. The holder you see in the photo is 3D printed.

Sudo apt-get update sudo apt-get upgrade

Then we launch raspi-config and enable camera support:

Sudo raspi-config

We change Disable on Enable

Reboot the Raspberry Pi:

Taking pictures from Raspberry Pi using the camera module

There are two standard tools for working with the camera raspivid And raspistill. The camera allows you to work with graphic effects and general camera parameters. You can change white balance, focus, photo type, exposure, ISO, etc.

Photo (raspistill)

The utility captures images in JPEG format. Using command options raspistill:

Usage: raspistill Image parameter commands -?, --help: This help information -w, --width: Set image width -h, --height: Set image height -q, --quality: Set jpeg quality<0 to 100>-r, --raw: Add raw bayer data to jpeg metadata -o, --output: Output filename (to write to stdout, use "-o -"). If not specified, no file is saved -l, --latest: Link latest complete image to filename -v, --verbose: Output verbose information during run -t, --timeout: Time (in ms) before takes picture and shuts down (if not specified, set to 5s) -th, --thumb: Set thumbnail parameters ( x:y:quality) or none -d, --demo: Run a demo mode (cycle through range of camera options, no capture) -e, --encoding: Encoding to use for output file (jpg, bmp, gif, png) -x, --exif: EXIF ​​tag to apply to captures (format as "key=value") or none -tl, --timelapse: Timelapse mode. Takes a picture every ms -fp, --fullpreview: Run the preview using the still capture resolution (may reduce preview fps) -k, --keypress: Wait between captures for a ENTER, X then ENTER to exit -s, --signal: Wait between captures for a SIGUSR1 from another process -g, --gl: Draw preview to texture instead of using video render component -gc, --glcapture: Capture the GL frame-buffer instead of the camera image -set, --settings: Retrieve camera settings and write to stdout -cs, --camselect: Select camera . Default 0 -bm, --burst: Enable "burst capture mode" Preview parameter commands -p, --preview: Preview window settings<"x,y,w,h">

The following command writes the photo taken by the camera to the photo.jpg file. The file will be written in the current directory:

Raspistill -o photo.jpg

The photo will be 2592x1944 (5 MP). To change photo settings, use the options described above.

Take a photo 640×480:

Raspistill -o image.jpg -w 640 -h 480

Video (raspivid)

The utility captures video in the format H264. Using command options raspivid:

Usage: raspivid Image parameter commands -?, --help: This help information -w, --width: Set image width . Default 1920 -h, --height: Set image height . Default 1080 -b, --bitrate: Set bitrate. Use bits per second (e.g. 10MBits/s would be -b 10000000) -o, --output: Output filename (to write to stdout, use "-o -") -v, --verbose: Output verbose information during run -t, --timeout: Time (in ms) to capture for. If not specified, set to 5s. Zero to disable -d, --demo: Run a demo mode (cycle through range of camera options, no capture) -fps, --framerate: Specify the frames per second to record -e, --penc: Display preview image * after* encoding (shows compression artifacts) -g, --intra: Specify the intra refresh period (key frame rate/GoP size). Zero to produce an initial I-frame and then just P-frames. -pf, --profile: Specify H264 profile to use for encoding -td, --timed: Cycle between capture and pause. -cycle on,off where on is record time and off is pause time in ms -s, --signal: Cycle between capture and pause on Signal -k, --keypress: Cycle between capture and pause on ENTER -i, -- initial: Initial state. Use "record" or "pause". Default "record" -qp, --qp: Quantification parameter. Use approximately 10-40. Default 0 (off) -ih, --inline: Insert inline headers (SPS, PPS) to stream -sg, --segment: Segment output file in to multiple files at specified interval -wr, --wrap: In segment mode, wrap any numbered filename back to 1 when reach number -sn, --start: In segment mode, start with specified segment number -sp, --split: In wait mode, create new output file for each start event -c, --circular: Run encoded data through circular buffer until triggered then save -x, --vectors: Output filename for inline motion vectors -cs, --camselect: Select camera . Default 0 -set, --settings: Retrieve camera settings and write to stdout H264 Profile options: baseline,main,high Preview parameter commands -p, --preview: Preview window settings<"x,y,w,h">-f, --fullscreen: Fullscreen preview mode -op, --opacity: Preview window opacity (0-255) -n, --nopreview: Do not display a preview window Image parameter commands -sh, --sharpness: Set image sharpness (-100 to 100) -co, --contrast: Set image contrast (-100 to 100) -br, --brightness: Set image brightness (0 to 100) -sa, --saturation: Set image saturation (- 100 to 100) -ISO, --ISO: Set capture ISO -vs, --vstab: Turn on video stabilization -ev, --ev: Set EV compensation -ex, --exposure: Set exposure mode (see Notes) - awb, --awb: Set AWB mode (see Notes) -ifx, --imxfx: Set image effect (see Notes) -cfx, --colfx: Set color effect (U:V) -mm, --metering: Set metering mode (see Notes) -rot, --rotation: Set image rotation (0-359) -hf, --hflip: Set horizontal flip -vf, --vflip: Set vertical flip -roi, --roi: Set region of interest (x,y,w,d as normalized coordinates ) -ss, --shutter: Set shutter speed in microseconds -awbg, --awbgains: Set AWB gains - AWB mode must be off -drc, --drc: Set DRC Level

The following command records 20 seconds of video in h264 format:

Raspivid -t 20000 -o video.h264

For a more detailed study of these commands, I recommend that you familiarize yourself with the . It contains many examples demonstrating all the capabilities of the camera module.

Streaming video

To receive streaming video, install on Raspberry Pi mjpg-streamer. First, let's install the necessary mjpg-streamer packages:

Apt-get install cmake apt-get install subversion apt-get install libv4l-dev apt-get install libjpeg8-dev apt-get install imagemagick

Now let's install mjpg-streamer:

Wget github.com/jacksonliam/mjpg-streamer/archive/master.zip unzip ./master -d ./ms cd ./ms/mjpg-streamer-master/mjpg-streamer-experimental make clean all

To configure mjpg-streamer correct the file start.sh:

Nano start.sh

We comment out all lines or delete them and add the following two lines:

Cd /root/ms/mjpg-streamer-master/mjpg-streamer-experimental ./mjpg_streamer -o "./output_http.so -w ./www" -i "./input_raspicam.so -x 640 -y 480 -fps 10 -ex auto -awb auto -vs -ISO 100"

Where:
-x 640– horizontal video size
-y 480– vertical video size
-fps 10– frame rate
-ex auto– automatic exposure
-awb auto– automatic white balance
-vs– vertical sync
-ISO 100– ISO settings

Let's launch mjpg-streamer:

./start.sh

Now from another computer on this network we can view streaming video using a regular browser using the link:

Where 192.168.1.100 – IP address of my Raspberry Pi. You need to change it to the address of your Raspberry Pi.

Videos can also be viewed from mobile devices - tablets, smartphones, etc. To watch videos on a smartphone with an operating system Android I use the program IP Cam Viewer Lite.

To stop mjpg-streamer in the console click Ctrl+c

Time lapse Video

Now let's try to do Time lapse video. This technique is used for filming very slow processes. A series of photos is taken at a certain interval, usually 1 second or more (this depends on the speed of the process you are shooting). Then a video is created from a set of photos using any available program that has such functions. Many cameras can take pictures for Time Lapse Video, but the Raspberry Pi has some advantages. In addition to taking pictures, the Raspberry Pi can do other things, such as turning on the lights while taking pictures, and then turning them off. This is quite appropriate when filming takes place over several weeks with fairly large time intervals. You don't want the light to be on all the time, especially if your shoot requires strong lighting. The Raspberry Pi is powered from the mains, which is necessary for long-term recording of fairly slow processes, such as the growth of crystals or plant life, the recording process of which can take several days, weeks or even months. The photos taken can be copied to another computer and processed during the shooting process. When filming, where the camera needs to change its position, the Raspberry Pi can help automate this process.

So, the easiest way to create a series of photos for Time lapse Video- use the key -tl on the team raspistill. For example:

Raspistill -t 600000 -tl 10000 -o image_num_%d_today.jpg

This command will create a photo every 10 (-tl 10000) seconds for 10 minutes (10 minutes = 600000ms). The files will be called image_num_1_today.jpg, image_num_2_today.jpg, image_num_3_today.jpg and so on. This method is quite suitable for shooting a short video. But when filming long processes, a small problem may arise. If the Raspberry Pi's power is interrupted for any reason, you will have to run the command again.

This didn't suit me. So I wrote a script and specified it to run in crontab. Script content:

#!/bin/bash echo 11 > /sys/class/gpio/export echo out > /sys/class/gpio/gpio11/direction echo 1 > /sys/class/gpio/gpio11/value DATE=$(date +" %Y-%m-%d_%H%M") raspistill -o /root/camera/$DATE.jpg echo 0 > /sys/class/gpio/gpio11/value echo 11 > /sys/class/gpio/unexport

Line in crontab:

*/10 * * * * root /root/camera/camera.bash

Now the script runs every 10 minutes. Even if the Raspberry Pi reboots, the script will still run. The script turns on the light (there is a circuit connected to GPIO11 that turns on the light bulb), takes a photo and then turns off the light.

You can collect a video from the received photos using the utility avconv. Installed avconv with the following command:

Apt-get install libav-tools

Photos must have file names in a unique format. Example of a script that renames jpg files in the current directory, taking into account their modification date, starts the conversion and writes the video to the file timelapse.avi:

#!/bin/bash i=0 for f in `ls -tr *.jpg 2>/dev/null` do newf=`printf %06d $i`.jpg echo $f "-->" $newf mv $ f $newf i=$((i+1)) done avconv -r 10 -i %06d.jpg -r 10 -vcodec mjpeg -qscale 1 timelapse.avi

But if processing the material requires additional actions, such as preliminary batch processing of photos, it makes sense to copy the photo material to a more powerful computer and not load the Raspberry Pi with it.

Here's what I got:

This first test video was made to select shooting parameters.

Captions on the photo

If you need to make a note on a photo, most often the date and time, you can use the command convert.

Let's modify the script so that it adds the date and time to the upper left corner of the photo taken:

#!/bin/bash echo 11 > /sys/class/gpio/export echo out > /sys/class/gpio/gpio11/direction echo 1 > /sys/class/gpio/gpio11/value DATE=$(date +" %Y-%m-%d_%H%M") timestamp=$(date +"%Y.%m.%d %H:%M:%S") raspistill -o /root/camera/tmp.jpg convert /root/camera/tmp.jpg -fill black -draw "rectangle 0.0 420.70" -fill white -pointsize 45 -draw "text 10.50 "$(timeshtamp)"" /root/camera/$DATE .jpg rm /root/camera/tmp.jpg echo 0 > /sys/class/gpio/gpio11/value echo 11 > /sys/class/gpio/unexport

Now all photos will have the date and time they were taken. First, a black rectangle is drawn in the photo ( -fill black -draw “rectangle 0.0 420.70”), and then the time is written in white ( -fill white -pointsize 45 -draw “text 10.50 ‘$(timeshtamp)"”).

Good luck.

Do you love to sit back and admire the beauty of our world while the birds chirp happily and sing their songs? Maybe you remember what breathtaking nature shots are filmed by various nature channels when the camera is in the thick of things. We'll make a hidden camera based on Raspberry Pi, thanks to which you can become a real naturalist and film animals that don't suspect anything.

Typically, these hidden cameras have motion detection capabilities that trigger the recording process whenever something comes into view. These cameras typically use PIR to trigger shooting or video recording.

PIR is a pyroelectric infrared motion sensor.

Unfortunately, using PIR may result in the camera not triggering or the subject disappearing completely before the camera fires. With the camera in the project, we can solve this problem by getting rid of PIR and using a detection system instead. We will also be able to capture events that occur before motion is detected (thanks to the software's capabilities), which increases the likelihood of getting the perfect photo or video.

The main thing now is to take your Raspberry Pi with you and rummage around the kitchen for a plastic food container.

If you use the No-IR Pi Camera module (no IR filter) and some IR LEDs, you can make a camera with night vision capability.

To make the project easier we use the MotionEyeOS library with our Raspberry Pi. It's designed for video surveillance, but it's perfect for our camera because it supports still images and also records HD quality video, plus it has motion detection capabilities.

Step 2. What you need

To create this simple camera, you will need the following components:

  • It is recommended to use a Raspberry Pi 3 Model B+, but you can use any Pi (including Zero).
  • MicroSD Card - Use Class 10 for better performance and larger capacity for longer recording time.
  • Pi Camera - The Pi V2 camera module is recommended, but USB webcams will also work.
  • Use an IR filter for Pi camera with IR LEDs for night vision.
  • Portable battery with USB output. Choose a larger battery capacity for longer run time.
  • Plastic container for food products. Use one with a sealed lid that can provide weather protection.

Additional details that can be considered:

  • Additional camera(s) - for multi-directional recording.

    Please note that the Pi only has one connection to the Camera Module, any additional cameras must be connected via USB.

  • Wire/fabric mesh to cover the additional vent.
  • USB HDD - adds additional capacity, but consumes battery faster.

You will need a small set of tools:

  • Screwdriver.
  • Hot glue.
  • Electric drill.
  • Add. tools.

Software:

MotionEyeOS - Download the appropriate image file for your Pi model.
- used to write the MEYEOS image file to a MicroSD card.
WinSCP - not required, but handy for downloading multiple media files from the Pi at once.

Step 3. Create a box for the Raspberry camera

The photos above show an example of the process.

  1. Using a marker, draw the outline of the camera lens on the wall of the container (including the IR LEDs if using).
  2. Using a taper drill bit, drill from the center of the outlines and cut holes until you can no longer see the edges of the marker marks.
  3. Use a tool to trim and clean holes if necessary.
  4. If you are installing an optional rain cover/shield, cut it to size and hot glue it in place.
  5. Attach the cable from the camera to the camera module (follow the instructions included with your camera).
  6. Use hot glue to securely attach the camera module - try to avoid sticking to the module components, this will make it easier to remove the camera from the box later.
  7. Place everything in a box.

Advice. Drill an additional hole in the box and cover it with mesh to provide ventilation. If you leave the camera in the sun for any period of time, it is recommended to allow air to enter the container to cool the Raspberry and especially the battery.

Step 4: Setting up the Raspberry Pi

If you're already familiar with Raspberry Pi, this step probably won't interest you and you can skip it.

Installation of operating systems:

  • Windows
  • MacOS
  • Linux

Note. We use the MotionEyeOS image so you don't need to download Raspbian.

To set up your Raspberry Pi, follow these steps:

  1. You can download the latest MotionEyeOS image file from your GitHub.
  2. Once you have downloaded the image, you need to extract it, use winRAR or other programs to do this.
  3. Insert the MicroSD card into your computer and record the image file. If you have Windows use .
  4. Once you've finished recording images, remove the MicroSD card from your computer, insert it into the Raspberry Pi, and then turn it on.
  5. Once the Pi is powered up and boots up (usually takes about 30 seconds), it can be accessed through a web browser, you just need to find out the hostname or IP address and then enter it into the browser's address bar.

Note. You'll want to connect the RJ45 Ethernet cable from the Pi to the router for initial setup, in which case it might be easier to do that first and then set up the Wi-Fi connection.

An easy way to find the Pi's IP address is through the web router's management console. This is usually done by entering its IP address in the address bar of your web browser (for example, http://192.168.0.1).

Step 5. Set up MotionEyeOS

At this point, you've created your box, prepared your Pi SD card, turned everything on, and accessed the MotionEyeOS web console. It's time to customize MotionEyeOS according to your requirements. We provided links to the library on GitHub above.

When you first try to log in to MotionEyeOS, you will be prompted for credentials, the default username is: admin and the default password: --blank--.

The web interface is quite intuitive, so you shouldn't have too many problems:

  1. It is recommended to set a password for two default accounts (Admin and User).
  2. Set the correct time zone so that your media files have the correct timestamp.
  3. Turn on Wi-Fi and enter your Wi-Fi credentials, you don't need to connect to an Ethernet cable.
  4. Set your desired camera frame rate and resolution (eg 1-10fps and 1920x1080).
  5. Set file storage - leave default if using SD card, change if using USB drive.
  6. You can choose whether to record still images (photos) or videos, or both.

Since we will have a hidden camera to take pictures of animals, we will use the Motion Detection feature. This allows a "motion" event to trigger the capture and recording of images and/or video. Motion detection is achieved by detecting changes in the pixels of the camera image, taking into account various parameters that can be configured.

We use the following motion detection settings below, but suggest you play around with the options until you find what works for you, as each scenario is a little different:

  • Frame Change Threshold = 1.5%
  • Auto Noise Detection = Off
  • Noise Level = 12%
  • Light Swith Detection = 0% (disabled)
  • Despeckle Filter = Off
  • Motion Gap = 5 seconds
  • Captured Before = 5 frames
  • Captured After = 10 frames
  • Minimum Motion Frames = 5 frames

MotionEyeOS also gives you the option to enable a detection mask, which allows you to exclude areas of the image from motion detection.

Once you are done making changes to the settings, click the Apply button, it will take about 10-20 seconds to update. Please note that some changes will require rebooting the Pi.

Step 6. Place the camera

Now that you've set up the Raspberry Pi camera itself, it's time to place it. How you do this will largely depend on what you are trying to shoot. In our case, we covered the camera with branches. Our “cache” blends well with nature and does not scare animals. But you can use, for example, camouflage packaging.

Be sure to cover as much of the box as possible without obscuring the lens. If you're using infrared LEDs for night vision, you'll also need to make sure you don't cover them.

How long your camera will last will largely depend on the capacity of the battery you are using and whether you have any additional power consuming items (i.e. IR LEDs, USB drive, etc.).

It's also worth downloading that MotionEyeOS gives you the ability to view captured images and videos directly from the web interface, which is quite convenient. It also allows you to download individual media files and save them to your device for later viewing and sharing.

Greetings! In this review I want to talk about the Raspberry Pi 3 and its use as home video surveillance in the vestibule (video peephole). There are many solutions on the market from Chinese manufacturers, but their quality and functionality did not suit me. There are solutions that I liked, for example or, but prices from 200 to 240 euros are very expensive! Therefore, I decided to make my own device. The review includes a concept that will be further developed.
So, I decided to implement video surveillance on Raspberry for the following reasons:
Firstly, for a low price we get a mini-computer with great functionality (both software and hardware) in contrast to stationary IP cameras (video eyes);
Secondly, it is possible to connect a video camera via the CSI (Camera Serial Interface), which minimally uses the processor. Today there are two versions of such cameras (with a resolution of 5 and 8 megapixels);
Thirdly, there are many sources of information in case of problems and questions;

I ordered everything I needed from the Gearbest store.
1.
2.
3.
4. Just in case, set, there were a lot of horror stories about the third raspberry overheating.

Order screen



I will not describe the Raspberry Pi 3 in detail; this can be done by reading the review. I will give only the main characteristics:
Processor: 64-bit 4-core ARM Cortex-A53 clocked at 1.2 GHz on Broadcom BCM2837 single-chip chip;
RAM: 1GB LPDDR2 SDRAM;
digital video output: HDMI;
composite output: 3.5 mm (4 pin);
USB ports: USB 2.0×4;
network: WiFi 802.11n, 10/100 MB RJ45 Ethernet;
Bluetooth: Bluetooth 4.1, Bluetooth Low Energy;
Display connector: Display Serial Interface (DSI);
video camera connector: MIPI Camera Serial Interface (CSI-2);
Memory card: MicroSD;
I/O ports: 40;
dimensions: 85x56x17 mm.

I decided to use a first generation video camera; this is more than enough for vestibule surveillance.
Specifications:
-5MP Omnivision 5647 matrix with fixed focus;
-Maximum photo resolution 2592x1944 pixels;
-Video resolution: 1080p (30 fps), 720p (60 fps), 640x480p (60/90 fps);

Packaging, board, comments

"Raspberry pi 3" is packed in such a box


It says made in China


Inside, quick start and safety instructions


The board itself is in an antistatic bag


Raspberry from different angles










The flux is poorly washed in places


Camera module packaging




Camera board




The camera module is connected to Raspberry using a 15-core ribbon cable.

I thought for a long time about what to choose as software for my tasks. There are many package programs like GStreamer, Motion, mjpg-streamer and others. But each of them has significant drawbacks. I understand that Linux experts can put all the necessary packages together, write a GUI and optimize the work. However, my knowledge of Linux will not be enough. This means that for people like me, we need a solution that works out of the box. And such a program was found!!! Called MotionEye OS. This is not even a separate program, but a Linux distribution with its own graphical interface.

MotionEye OS features:
- Work with multiple cameras
- Time synchronization via the Internet
- Ethernet and Wi-Fi support
- Record event logs
- Setting camera operating modes (brightness, contrast, saturation, auto brightness balance, frame rate per second, camera rotation and resolution). It is possible to set your own non-standard settings.
- Saving screenshots and videos according to scenarios. With the ability to save to an SD card, network share or cloud (Google Drive and DropBox are supported).
- Using a motion detector, sending Get/Post requests, executing your own scripts, sending notifications by e-mail
- Overlay any text on an image
- Simultaneous broadcast of video to the Internet with the ability to restrict access and your own camera resolution and fps settings.
- Fine-tuning the motion detector
- Work according to schedule.
- This distribution is absolutely free

This is what the main program window looks like


Main MotionEye settings windows















Example of an image from a camera, resolution 1280x1024

So, MotionEye OS can be installed on: Banana PI, Cubietruck, Odroid C1 (and C1+), Odroid XU4, Raspberry PI (A, B, A+, B+, Compute Module and Zero models), Raspberry PI 2, Raspberry PI 3.
There are two installation methods.

The first method is to install a “naked” image.
Download the distribution from . The image is installed on the Micro SD card using . The first launch of the distribution must be done with an Ethernet cable connected!!! Login admin without password. The admin panel will be available in the browser using the IP received by the raspberry.
This method is fast, but only MotionEye OS will be installed. And this is not good, because... We greatly reduce the functionality of Raspberry.

The second method is installation on Raspbian.
1. Install Raspbian (I think there is no need to explain how to do this).
2. Check and install updates
sudo apt-get update sudo apt-get upgrade
3. Install the ffmpeg codec
sudo wget https://github.com/ccrisan/motioneye/wiki/precompiled/ffmpeg_2.8.3.git325b593-1_armhf.deb sudo dpkg -i ffmpeg_2.8.3.git325b593-1_armhf.deb
4. If the system has old codecs, they must be removed and new ones installed
sudo apt-get remove libavcodec-extra-56 libavformat56 libavresample2 libavutil54 sudo apt-get install libavutil54 libavformat56 libswscale3
5. Install motion
sudo apt-get install motion sudo wget https://github.com/ccrisan/motioneye/wiki/precompiled/motion-mrdave-raspbian -O /usr/local/bin/motion sudo chmod +x /usr/local/bin/ motion
6. Install dependent packages
sudo apt-get install python-pip python-dev curl libssl-dev libcurl4-openssl-dev libjpeg-dev
7. Install motioneye
sudo pip install motioneye
8. Configure directories
sudo mkdir -p /etc/motioneye sudo cp /usr/local/share/motioneye/extra/motioneye.conf.sample /etc/motioneye/motioneye.conf sudo mkdir -p /var/lib/motioneye
9. Launch motionEye and add it to startup
sudo cp /usr/local/share/motioneye/extra/motioneye.systemd-unit-local /etc/systemd/system/motioneye.service sudo systemctl daemon-reload sudo systemctl enable motioneye sudo systemctl start motioneye
10. To update and get a new version of motionEye
sudo pip install motioneye --upgrade sudo systemctl restart motioneye
11. To support the camera module, you need to add the bcm2835_v4l2 entry to /etc/modules
sudo nano /etc/module
This completes the installation. You can access the admin panel in the browser by specifying the raspberry IP and port 8765. Now we have a full-fledged raspbian and a working motioneye.

Next, we’ll add a useful feature, such as Push notification to your phone if motion is detected. This can be useful if someone is standing in front of your door and you are not at home.
The first thing to do is go to the website. There you can download the app on Android or iOS. Complete registration. Then register the application “Register an Application”. Then fill in the “Name” and “Description” fields and select “Application” in the “Type” tab. If desired, you can add an icon. After confirmation, an application with a unique API Token/Key will be added. Your User Key is indicated on the main page.
The next step is to write a script in Python.

#!/usr/bin/python import httplib, urllib conn = httplib.HTTPSConnection("api.pushover.net:443") conn.request("POST", "/1/messages.json", urllib.urlencode(( "token": "am25zkm2p3msdgtmohaho9fraiieb", # Insert app token here "user": "umsxy2qh9ub14rbkc59711fzca5nfx", # Insert user token here "html": "1", # 1 for HTML, 0 to disable "title": "Tambur web camera ", # Title of the message "message": " Motion detect!!", # Content of the message "url": "http://192.168.1.33:8081", # Link to be included in message "url_title": "View live stream", # Text for the link "sound": " siren", # Define the sound played )), ( "Content-type": "application/x-www-form-urlencoded" )) conn.getresponse()
Don't try to send me anything, I changed the keys))
Next, let's create a pushover.py file for this
touch ./pushover.py
Open and add the above script text. Save. Close the file.
sudo nano pushover.py
Let's assign permissions to the file
sudo chmod 777 pushover.py
Now our script is ready to run. All that remains is to add it to the “Motion Notifications” menu in the “Run a command” field /home/pi/pushover.py

A few tests.
For testing I used an Ethernet connection. The pictures show the maximum fps in normal mode and when motion is detected.






CPU load is 20-30%. The operating temperature is 45 - 48 degrees, the processor does not require additional cooling.

Conclusion.
Of course, there are slight delays when displaying images. I consider the optimal resolution to be 1024 x 768 and lower. Overall, I was pleased with the results of the camera. We plan to add the ability to record sound from a microphone when motion is detected.

The review turned out to be focused on the software part, but I have been collecting information on this issue for a long time and wanted to talk about it. I apologize for any mistakes, I'm still on board with Linux-like systems)) Additions and comments are very welcome! Also ready to answer questions.

P.s. Now the price in this store for Raspberry pi 3 is $35.99

I'm planning to buy +85 Add to favorites I liked the review +54 +117

The Raspberry Pi single board computer can be used not only to create home automation systems and other non-resource-intensive projects, but also to work with video, in particular for streaming video from a webcam over a network.



This material will provide step-by-step instructions for setting up a Raspberry Pi as a server with a webcam, from which video will be streamed over the network using special software. In our case, we will use the Motion software package, which is free and open access.


So, for this project you will need a Raspberry Pi Model B or newer, a USB WiFi adapter, a USB webcam with microphone, an SD card with Raspbian OS, access to the Raspberry Pi via keyboard and mouse or remotely.


Make sure all software packages have received the necessary updates. To do this you can simply enter:


sudo apt-get update


Then you need to install the Motion application:


sudo apt-get install motion


If you want to use a dedicated camera module for the Raspberry Pi, this version of Motion does not yet support it. To add support for the camera module, you need to download and install a specific assembly as follows:



sudo apt-get install -y libjpeg62 libjpeg62-dev libavformat53 libavformat-dev libavcodec53 libavcodec-dev libavutil51 libavutil-dev libc6-dev zlib1g-dev libmysqlclient18 libmysqlclient-dev libpq5 libpq-dev


Now you need to configure this software. The first step is to edit the motion.conf configuration file. Enter the following line:


sudo nano /etc/motion/motion.conf


Here you need to change the following: DAEMON = OFF (change to ON), Webcam_localhost = ON (change to OFF). Next we need to activate the Daemon service. We print:


sudo nano /etc/default/motion


And change start_motion_daemon = no (change to yes).


Now you need to start the webcam server. Make sure the webcam is connected to the Raspberry Pi via USB. Enter the following line:


sudo service motion start


If you want to stop this service, then use this command:


sudo service motion stop


To restart the Motion service, you can use the following command:


sudo service motion restart


If Motion is working, then you can open a web page on your regular desktop computer, in the address bar of which there will be the IP of your Raspberry Pi and port 8081 (or another one if you changed it). Then you will see the image from the webcam connected to the Raspberry Pi.