members
Raspberry basics: Project 02c Raspberry PI camera module V2 - video streaming
of Acoptex.com in Raspberry Pi 3
Raspberry basics: Project 02c
Project name: Raspberry PI camera module V2 - video streaming
Tags: Raspberry, Raspberry camera V2, Raspberry PI camera module, Raspberry PI 3
Attachments: script
In this project, you need these parts :
1.Raspberry PI 3 model B 1 pc
2. Raspberry PI camera module V2 1 pc
3. Micro SD card with NOOBS and SD card adapter 1 pc
4. Micro USB power supply (2.1 A, max 2.5 A) 1 pc
5. TV or monitor 1 pc
6. HDMI cable 1 pc
7. USB keyboard 1 pc
8. USB mouse 1 pc
General
We will learn about video streaming - how to stream live video into a web page that you can access in any device that has a browser and is connected to the same network as the Raspberry Pi 3.
Understanding the Raspberry PI camera module V2
The Raspberry Pi Camera Module v2 replaced the original Camera Module in April 2016. The v2 Camera Module has a Sony IMX219 8-megapixel sensor (compared to the 5-megapixel OmniVision OV5647 sensor of the original camera).
The Camera Module can be used to take high-definition video, as well as stills photographs. It’s easy to use for beginners, but has plenty to offer advanced users if you’re looking to expand your knowledge. There are lots of examples online of people using it for time-lapse, slow-motion, and other video cleverness. You can also use the libraries we bundle with the camera to create effects.
You can read all the gory details about IMX219 and the Exmor R back-illuminated sensor architecture on Sony’s website, but suffice to say this is more than just a resolution upgrade: it’s a leap forward in image quality, colour fidelity, and low-light performance. It supports 1080p30, 720p60 and VGA90 video modes, as well as still capture. It attaches via a 15cm ribbon cable to the CSI port on the Raspberry Pi.
The camera works with all models of Raspberry Pi 1, 2, and 3. It can be accessed through the MMAL and V4L APIs, and there are numerous third-party libraries built for it, including the Picamera Python library. See the Getting Started with Picamera resource to learn how to use it.
The camera module is very popular in home security applications, and in wildlife camera traps.
There’s also an infrared version of the camera (called Pi NoIR) which gives you everything the regular Camera Module offers, with one difference: it doesn’t use an infrared filter. This gives you the ability to see in the dark with infrared lighting.
You can read more about camera module here.
Understanding the Raspberry PI 3 model B
The Raspberry Pi 3 is the third-generation Raspberry Pi. It replaced the Raspberry Pi 2 Model B in February 2016.
Specification:
- Quad Core 1.2GHz Broadcom BCM2837 64bit CPU
- 1GB RAM
- BCM43438 wireless LAN and Bluetooth Low Energy (BLE) on board
- 40-pin extended GPIO
- 4 USB 2 ports
- 4 Pole stereo output and composite video port
- Full size HDMI
- CSI camera port for connecting a Raspberry Pi camera
- DSI display port for connecting a Raspberry Pi touchscreen display
- Micro SD port for loading your operating system and storing data
- Upgraded switched Micro USB power source up to 2.5A
Signals and connections of the Raspberry PI 3 model B
Signals and connections of the Raspberry PI camera module V2
You can see on the back of ribbon cable one side has a piece of blue plastic and other has some traces on it. Line up traces on the ribbon cable with traces on the Raspberry PI 3 camera port. There is the tab which you can lift up and pull it by its edges. By doing that it will open up so you can insert the ribbon cable end with traces into the camera port. When it's in press tab to fix the ribbon cable.
Step by Step instruction
You should have the Raspbian or Raspbian Lite operating system installed in your Raspberry Pi 3
- Connect the Raspberry PI camera module V2 to the Raspberry Pi 3 camera port (CSI camera port). Make sure that Raspberry PI 3 switched off.
- Connect Raspberry PI 3 board HDMI port and to your TV or Monitor HDMI port with HDMI cable.
- Make sure that your monitor or TV is turned on, and that you have selected the right input (e.g. HDMI 1, etc).
- Plug in your USB mouse and USB keyboard to Raspberry PI 3 USB ports.
- Connect Micro USB power supply to Raspberry PI 3 board micro USB input.
- The Raspberry PI desktop will start up.
- Open the Raspberry Pi Configuration tool from the main menu. Go to Raspberry icon-> Preferences -> Raspberry PI configuration
- Ensure the camera software is enabled. If it’s not enabled, enable it and reboot your Raspberry PI 3 board to begin.
- There is another way to do it. When The Raspberry PI desktop start up go to Terminal.
- In the Terminal window, type the following command: sudo raspi-config
- You should see the Raspberry Pi software configuration tool. Select the Interfacing Options.
- Select P1 Camera and Yes to enable it and Finish.Reboot your Raspberry Pi 3.
- You need to know your Raspberry Pi 3 IP address in order to access your video streaming web server. Use the following command in the Terminal's command line: ifconfig
- You will see some information together with Raspberry Pi 3 IP address. In our case it is 192.168.0.124.
- Create a new file and name it rpi_camera_cctv.py by using this command: nano rpi_camera_cctv.py
- Copy the attached code to your newly created file.
- Press Ctrl+X, type Y and press Enter to save your file.
- Use this command to run the script: python3 rpi_camera_cctv.py
- You can access your video streaming web server at: http://Raspberry Pi IP address:8765. Replace with your own Raspberry Pi IP address, in our case http://192.168.0.124:8765. Any device that has a browser and is connected to the same network that your Raspberry Pi 3 has access to the video streaming. The Raspberry Pi 3 can be used to monitor your home as CCTV system.
Summary
We have learnt about video streaming - how to stream live video into a web page that you can access in any device that has a browser and is connected to the same network as the Raspberry Pi 3.
Library
- No libraries needed in this project
Script
- Attached on the begining of this project
Other projects of Acoptex.com










Viewed: 1230 times